mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-14 07:47:03 +08:00
bug_fix: allow empty remote_dir
bug_fix: check previous noHL tagged torrents that now have HL.
This commit is contained in:
parent
c748b30934
commit
63d5f6abde
1 changed files with 14 additions and 15 deletions
|
@ -422,7 +422,7 @@ def rem_orphaned():
|
||||||
logger.error('root_dir not defined in config.')
|
logger.error('root_dir not defined in config.')
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'remote_dir' in cfg['directory']:
|
if ('remote_dir' in cfg['directory'] and cfg['directory']['remote_dir'] != ''):
|
||||||
remote_path = os.path.join(cfg['directory']['remote_dir'], '')
|
remote_path = os.path.join(cfg['directory']['remote_dir'], '')
|
||||||
root_files = [os.path.join(path.replace(remote_path,root_path), name) for path, subdirs, files in os.walk(remote_path) for name in files if os.path.join(remote_path,'orphaned_data') not in path]
|
root_files = [os.path.join(path.replace(remote_path,root_path), name) for path, subdirs, files in os.walk(remote_path) for name in files if os.path.join(remote_path,'orphaned_data') not in path]
|
||||||
else:
|
else:
|
||||||
|
@ -480,7 +480,7 @@ def tag_nohardlinks():
|
||||||
else:
|
else:
|
||||||
logger.error('root_dir not defined in config.')
|
logger.error('root_dir not defined in config.')
|
||||||
return
|
return
|
||||||
if 'remote_dir' in cfg['directory']:
|
if ('remote_dir' in cfg['directory'] and cfg['directory']['remote_dir'] != ''):
|
||||||
remote_path = os.path.join(cfg['directory']['remote_dir'], '')
|
remote_path = os.path.join(cfg['directory']['remote_dir'], '')
|
||||||
else:
|
else:
|
||||||
remote_path = root_path
|
remote_path = root_path
|
||||||
|
@ -552,6 +552,16 @@ def tag_nohardlinks():
|
||||||
else:
|
else:
|
||||||
n_info += (' \n Cleanup flag set to true. Deleting torrent + contents.')
|
n_info += (' \n Cleanup flag set to true. Deleting torrent + contents.')
|
||||||
|
|
||||||
|
#Checks to see if previous noHL tagged torrents now have hard links.
|
||||||
|
if (not (nohardlink(torrent['content_path'].replace(root_path,remote_path))) and ('noHL' in torrent.tags)):
|
||||||
|
n_info += (f'\n - Previous Tagged noHL Torrent Name: {torrent.name} has hard links found now.')
|
||||||
|
n_info += (' Removing tags noHL.')
|
||||||
|
n_info += (' Removing ratio and seeding time limits.')
|
||||||
|
if args.dry_run != 'dry_run':
|
||||||
|
#Remove tags and share limits
|
||||||
|
torrent.remove_tags(tags='noHL')
|
||||||
|
client.torrents_set_share_limits(-2,-2,torrent.hash)
|
||||||
|
|
||||||
if(nohardlinks[category] != None):
|
if(nohardlinks[category] != None):
|
||||||
#loop through torrent list again for cleanup purposes
|
#loop through torrent list again for cleanup purposes
|
||||||
if ('cleanup' in nohardlinks[category] and nohardlinks[category]['cleanup']):
|
if ('cleanup' in nohardlinks[category] and nohardlinks[category]['cleanup']):
|
||||||
|
@ -566,17 +576,6 @@ def tag_nohardlinks():
|
||||||
else:
|
else:
|
||||||
torrent.delete(hash=torrent.hash, delete_files=False)
|
torrent.delete(hash=torrent.hash, delete_files=False)
|
||||||
|
|
||||||
|
|
||||||
#Checks to see if previous noHL tagged torrents now have hard links.
|
|
||||||
if (not (nohardlink(torrent['content_path'].replace(root_path,remote_path))) and ('noHL' in torrent.tags)):
|
|
||||||
n_info += (f'\n - Previous Tagged noHL Torrent Name: {torrent.name} has hard links found now.')
|
|
||||||
n_info += (' Removing tags noHL.')
|
|
||||||
n_info += (' Removing ratio and seeding time limits.')
|
|
||||||
if args.dry_run != 'dry_run':
|
|
||||||
#Remove tags and share limits
|
|
||||||
torrent.remove_tags(tags='noHL')
|
|
||||||
client.torrents_set_share_limits(-2,-2,torrent.hash)
|
|
||||||
|
|
||||||
if args.dry_run == 'dry_run':
|
if args.dry_run == 'dry_run':
|
||||||
if t_count >= 1 or len(n_info) > 1:
|
if t_count >= 1 or len(n_info) > 1:
|
||||||
logger.dryrun(n_info)
|
logger.dryrun(n_info)
|
||||||
|
|
Loading…
Add table
Reference in a new issue