mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-08 12:07:33 +08:00
[aria2c]fix unselected files
Signed-off-by: anasty17 <e.anastayyar@gmail.com>
(cherry picked from commit 281045c3a8
)
Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
parent
9f7906f864
commit
845d6710b4
6
aria.sh
6
aria.sh
@ -3,10 +3,10 @@ then
|
||||
TORRENT_TIMEOUT=0
|
||||
fi
|
||||
tracker_list=$(curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt https://ngosang.github.io/trackerslist/trackers_all_http.txt https://newtrackon.com/api/all https://raw.githubusercontent.com/hezhijie0327/Trackerslist/main/trackerslist_tracker.txt | awk '$0' | tr '\n\n' ',')
|
||||
aria2c --allow-overwrite=true --auto-file-renaming=true --bt-enable-lpd=true \
|
||||
aria2c --allow-overwrite=true --auto-file-renaming=true --bt-enable-lpd=true --bt-detach-seed-only=true \
|
||||
--bt-remove-unselected-file=true --bt-stop-timeout=$TORRENT_TIMEOUT --bt-tracker="[$tracker_list]" \
|
||||
--check-certificate=false --continue=true --content-disposition-default-utf8=true --daemon=true \
|
||||
--disk-cache=40M --enable-rpc=true --follow-torrent=mem --force-save=true --http-accept-gzip=true \
|
||||
--check-certificate=false --check-integrity=true --continue=true --content-disposition-default-utf8=true \
|
||||
--daemon=true --disk-cache=40M --enable-rpc=true --follow-torrent=mem --force-save=true --http-accept-gzip=true \
|
||||
--max-connection-per-server=10 --max-concurrent-downloads=20 --max-file-not-found=0 --max-tries=20 \
|
||||
--min-split-size=10M --netrc-path=/usr/src/app/.netrc --optimize-concurrent-downloads=true \
|
||||
--peer-id-prefix=-qB4430- --peer-agent=qBittorrent/4.4.3 --quiet=true --reuse-uri=true \
|
||||
|
@ -1,4 +1,5 @@
|
||||
from time import sleep, time
|
||||
from os import remove
|
||||
|
||||
from bot import aria2, download_dict_lock, download_dict, STOP_DUPLICATE, BASE_URL, LOGGER
|
||||
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
|
||||
@ -20,14 +21,10 @@ def __onDownloadStarted(api, gid):
|
||||
metamsg = "Downloading Metadata, wait then you can select files. Use torrent file to avoid this wait."
|
||||
meta = sendMessage(metamsg, listener.bot, listener.message)
|
||||
while True:
|
||||
try:
|
||||
download = api.get_download(gid)
|
||||
except:
|
||||
deleteMessage(listener.bot, meta)
|
||||
break
|
||||
if download.followed_by_ids:
|
||||
if download.is_removed or download.followed_by_ids:
|
||||
deleteMessage(listener.bot, meta)
|
||||
break
|
||||
download = download.live
|
||||
return
|
||||
else:
|
||||
LOGGER.info(f'onDownloadStarted: {download.name} - Gid: {gid}')
|
||||
@ -45,7 +42,7 @@ def __onDownloadStarted(api, gid):
|
||||
LOGGER.info('Checking File/Folder if already in Drive...')
|
||||
sname = download.name
|
||||
if listener.isZip:
|
||||
sname = sname + ".zip"
|
||||
sname = f"{sname}.zip"
|
||||
elif listener.extract:
|
||||
try:
|
||||
sname = get_base_name(sname)
|
||||
@ -101,6 +98,13 @@ def __onBtDownloadComplete(api, gid):
|
||||
if dl := getDownloadByGid(gid):
|
||||
listener = dl.listener()
|
||||
if listener.select:
|
||||
res = download.files
|
||||
for file_o in res:
|
||||
if not file_o.selected:
|
||||
try:
|
||||
remove(file_o.path)
|
||||
except:
|
||||
pass
|
||||
clean_unwanted(download.dir)
|
||||
if listener.seed:
|
||||
try:
|
||||
|
@ -1,4 +1,5 @@
|
||||
from telegram.ext import CommandHandler, CallbackQueryHandler
|
||||
from os import remove
|
||||
|
||||
from bot import aria2, BASE_URL, download_dict, dispatcher, download_dict_lock, SUDO_USERS, OWNER_ID
|
||||
from bot.helper.telegram_helper.bot_commands import BotCommands
|
||||
@ -79,6 +80,13 @@ def get_confirm(update, context):
|
||||
if len(id_) > 20:
|
||||
dl.client().torrents_resume(torrent_hashes=id_)
|
||||
else:
|
||||
res = aria2.client.get_files(id_)
|
||||
for f in res:
|
||||
if f['selected'] == 'false':
|
||||
try:
|
||||
remove(f['path'])
|
||||
except:
|
||||
pass
|
||||
aria2.client.unpause(id_)
|
||||
sendStatusMessage(listener.message, listener.bot)
|
||||
query.message.delete()
|
||||
|
@ -14,7 +14,7 @@ Advanced\AnnounceToAllTrackers=true
|
||||
Advanced\AnonymousMode=false
|
||||
Advanced\IgnoreLimitsLAN=false
|
||||
Advanced\LtTrackerExchange=true
|
||||
Advanced\RecheckOnCompletion=false
|
||||
Advanced\RecheckOnCompletion=true
|
||||
Bittorrent\AddTrackers=false
|
||||
Bittorrent\MaxRatio=-1
|
||||
Bittorrent\MaxRatioAction=0
|
||||
|
Loading…
Reference in New Issue
Block a user