mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2024-11-10 09:32:29 +08:00
Bugfix
- [Fixed] An errant for loop was causing unregistered torrents to take 6x as long to manage/delete. Now fixed.
This commit is contained in:
parent
51de7d82d4
commit
a073610c80
1 changed files with 29 additions and 30 deletions
|
@ -328,35 +328,34 @@ def rem_unregistered():
|
|||
rem_unr = 0
|
||||
del_tor = 0
|
||||
for torrent in torrent_list:
|
||||
for status in torrent.trackers:
|
||||
for x in torrent.trackers:
|
||||
if x.url.startswith('http'):
|
||||
t_url = trunc_val(x.url, '/')
|
||||
n_info = (f'\n - Torrent Name: {torrent.name} '
|
||||
f'\n - Status: {status.msg} '
|
||||
f'\n - Tracker: {t_url} '
|
||||
f'\n - Deleted .torrent but not content files.')
|
||||
n_d_info = (f'\n - Torrent Name: {torrent.name} '
|
||||
f'\n - Status: {status.msg} '
|
||||
f'\n - Tracker: {t_url} '
|
||||
f'\n - Deleted .torrent AND content files.')
|
||||
if 'Unregistered torrent' in status.msg or 'Torrent is not found' in status.msg:
|
||||
if torrent.name in dupes:
|
||||
if args.dry_run == 'dry_run':
|
||||
logger.dryrun(n_info)
|
||||
rem_unr += 1
|
||||
else:
|
||||
logger.info(n_info)
|
||||
torrent.delete(hash=torrent.hash, delete_files=False)
|
||||
rem_unr += 1
|
||||
elif torrent.name in no_dupes:
|
||||
if args.dry_run == 'dry_run':
|
||||
logger.dryrun(n_d_info)
|
||||
del_tor += 1
|
||||
else:
|
||||
logger.info(n_d_info)
|
||||
torrent.delete(hash=torrent.hash, delete_files=True)
|
||||
del_tor += 1
|
||||
for x in torrent.trackers:
|
||||
if x.url.startswith('http'):
|
||||
t_url = trunc_val(x.url, '/')
|
||||
n_info = (f'\n - Torrent Name: {torrent.name} '
|
||||
f'\n - Status: {x.msg} '
|
||||
f'\n - Tracker: {t_url} '
|
||||
f'\n - Deleted .torrent but not content files.')
|
||||
n_d_info = (f'\n - Torrent Name: {torrent.name} '
|
||||
f'\n - Status: {x.msg} '
|
||||
f'\n - Tracker: {t_url} '
|
||||
f'\n - Deleted .torrent AND content files.')
|
||||
if 'Unregistered torrent' in x.msg or 'Torrent is not found' in x.msg:
|
||||
if torrent.name in dupes:
|
||||
if args.dry_run == 'dry_run':
|
||||
logger.dryrun(n_info)
|
||||
rem_unr += 1
|
||||
else:
|
||||
logger.info(n_info)
|
||||
torrent.delete(hash=torrent.hash, delete_files=False)
|
||||
rem_unr += 1
|
||||
elif torrent.name in no_dupes:
|
||||
if args.dry_run == 'dry_run':
|
||||
logger.dryrun(n_d_info)
|
||||
del_tor += 1
|
||||
else:
|
||||
logger.info(n_d_info)
|
||||
torrent.delete(hash=torrent.hash, delete_files=True)
|
||||
del_tor += 1
|
||||
if args.dry_run == 'dry_run':
|
||||
if rem_unr >= 1 or del_tor >= 1:
|
||||
logger.dryrun(f'Did not delete {rem_unr} .torrents(s) or content files.')
|
||||
|
@ -379,4 +378,4 @@ def run():
|
|||
recheck()
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
run()
|
||||
|
|
Loading…
Reference in a new issue