mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-19 18:26:08 +08:00
Change default tag to format 2
This commit is contained in:
parent
5170da9c20
commit
1896ea283e
4 changed files with 45 additions and 37 deletions
|
@ -20,40 +20,30 @@ cat:
|
||||||
movies: "/data/torrents/Movies"
|
movies: "/data/torrents/Movies"
|
||||||
tv: "TV"
|
tv: "TV"
|
||||||
|
|
||||||
# Tag Parameters (Use either Format 1 or Format 2)
|
# Tag Parameters
|
||||||
tags:
|
tags:
|
||||||
# Format 1
|
# <Tracker URL Keyword>: # <MANDATORY> This is the keyword in the tracker url
|
||||||
# <Tracker URL Keyword>: <Tag Name>
|
# <MANDATORY> Set tag name
|
||||||
# Format 2
|
|
||||||
# <Tracker URL Keyword>:
|
|
||||||
# tag: <Tag Name>
|
# tag: <Tag Name>
|
||||||
# <MANDATORY> Will set the torrent Maximum share ratio until torrent is stopped from seeding/uploading. -2 means the global limit should be used, -1 means no limit.
|
# <OPTIONAL> Will set the torrent Maximum share ratio until torrent is stopped from seeding/uploading. -2 means the global limit should be used, -1 means no limit.
|
||||||
# max_ratio: 5.0
|
# max_ratio: 5.0
|
||||||
# <OPTIONAL> Will set the torrent Maximum seeding time (min) until torrent is stopped from seeding. -2 means the global limit should be used, -1 means no limit.
|
# <OPTIONAL> Will set the torrent Maximum seeding time (min) until torrent is stopped from seeding. -2 means the global limit should be used, -1 means no limit.
|
||||||
# max_seeding_time: 129600
|
# max_seeding_time: 129600
|
||||||
# <OPTIONAL> Will limit the upload speed KiB/s (KiloBytes/second) (-1 sets the limit to infinity)
|
# <OPTIONAL> Will limit the upload speed KiB/s (KiloBytes/second) (-1 sets the limit to infinity)
|
||||||
# limit_upload_speed: 150
|
# limit_upload_speed: 150
|
||||||
|
animebytes.tv:
|
||||||
#Format 1 Examples
|
tag: AnimeBytes
|
||||||
animebytes.tv: AnimeBytes
|
|
||||||
beyond-hd: Beyond-HD
|
|
||||||
blutopia: Blutopia
|
|
||||||
cartoonchaos: CartoonChaos
|
|
||||||
landof.tv: BroadcasTheNet
|
|
||||||
myanonamouse: MaM
|
|
||||||
passthepopcorn: PassThePopcorn
|
|
||||||
privatehd: PrivateHD
|
|
||||||
tleechreload: TorrentLeech
|
|
||||||
torrentdb: TorrentDB
|
|
||||||
torrentleech: TorrentLeech
|
|
||||||
tv-vault: TV-Vault
|
|
||||||
|
|
||||||
#Format 2 Examples
|
|
||||||
avistaz:
|
avistaz:
|
||||||
tag: Avistaz
|
tag: Avistaz
|
||||||
max_ratio: 5.0
|
max_ratio: 5.0
|
||||||
max_seeding_time: 129600
|
max_seeding_time: 129600
|
||||||
limit_upload_speed: 150
|
limit_upload_speed: 150
|
||||||
|
beyond-hd:
|
||||||
|
tag: Beyond-HD
|
||||||
|
blutopia:
|
||||||
|
tag: Blutopia
|
||||||
|
cartoonchaos:
|
||||||
|
tag: CartoonChaos
|
||||||
digitalcore
|
digitalcore
|
||||||
tag: DigitalCore
|
tag: DigitalCore
|
||||||
max_ratio: 5.0
|
max_ratio: 5.0
|
||||||
|
@ -63,6 +53,23 @@ tags:
|
||||||
hdts:
|
hdts:
|
||||||
tag: HDTorrents
|
tag: HDTorrents
|
||||||
max_seeding_time: 129600
|
max_seeding_time: 129600
|
||||||
|
landof.tv:
|
||||||
|
tag: BroadcasTheNet
|
||||||
|
myanonamouse:
|
||||||
|
tag: MaM
|
||||||
|
passthepopcorn:
|
||||||
|
tag: PassThePopcorn
|
||||||
|
privatehd:
|
||||||
|
tag: PrivateHD
|
||||||
|
tleechreload:
|
||||||
|
tag: TorrentLeech
|
||||||
|
torrentdb:
|
||||||
|
tag: TorrentDB
|
||||||
|
torrentleech:
|
||||||
|
tag: TorrentLeech
|
||||||
|
tv-vault:
|
||||||
|
tag: TV-Vault
|
||||||
|
|
||||||
|
|
||||||
#Tag Movies/Series that are not hard linked
|
#Tag Movies/Series that are not hard linked
|
||||||
nohardlinks:
|
nohardlinks:
|
||||||
|
|
|
@ -123,24 +123,23 @@ class Config:
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
logger.debug(f"Tracker Url:{url}")
|
logger.debug(f"Tracker Url:{url}")
|
||||||
logger.debug(e)
|
logger.debug(e)
|
||||||
# If using Format 1
|
# If using Format 1 convert to format 2
|
||||||
if isinstance(tag_details,str):
|
if isinstance(tag_details,str):
|
||||||
tags['new_tag'] = self.util.check_for_attribute(self.data, tag_url, parent="tags",default=default_tag)
|
tags['new_tag'] = self.util.check_for_attribute(self.data, tag_url, parent="tags",default=default_tag)
|
||||||
if tags['new_tag'] == default_tag: self.data['tags'][tag_url] = default_tag
|
self.util.check_for_attribute(self.data, "tag", parent="tags",subparent=tag_url, default=tags['new_tag'],do_print=False)
|
||||||
|
if tags['new_tag'] == default_tag: self.data['tags'][tag_url]['tag'] = default_tag
|
||||||
# Using Format 2
|
# Using Format 2
|
||||||
else:
|
else:
|
||||||
if 'tag' not in tag_details:
|
|
||||||
logger.warning(f'No tags defined for {tag_url}. Please check your config.yml file. Setting tag to {tag_url}')
|
|
||||||
tags['new_tag'] = self.util.check_for_attribute(self.data, "tag", parent="tags", subparent=tag_url, default=tag_url)
|
tags['new_tag'] = self.util.check_for_attribute(self.data, "tag", parent="tags", subparent=tag_url, default=tag_url)
|
||||||
if tags['new_tag'] == tag_url: self.data['tags'][tag_url]['tag'] = tag_url
|
if tags['new_tag'] == tag_url: self.data['tags'][tag_url]['tag'] = tag_url
|
||||||
tags['max_ratio'] = self.util.check_for_attribute(self.data, "max_ratio", parent="tags", subparent=tag_url, var_type="float", default_int=-2, default_is_none=True,do_print=False)
|
tags['max_ratio'] = self.util.check_for_attribute(self.data, "max_ratio", parent="tags", subparent=tag_url, var_type="float", default_int=-2, default_is_none=True,do_print=False,save=False)
|
||||||
tags['max_seeding_time'] = self.util.check_for_attribute(self.data, "max_seeding_time", parent="tags", subparent=tag_url, var_type="int", default_int=-2, default_is_none=True,do_print=False)
|
tags['max_seeding_time'] = self.util.check_for_attribute(self.data, "max_seeding_time", parent="tags", subparent=tag_url, var_type="int", default_int=-2, default_is_none=True,do_print=False,save=False)
|
||||||
tags['limit_upload_speed'] = self.util.check_for_attribute(self.data, "limit_upload_speed", parent="tags", subparent=tag_url, var_type="int", default_int=-1, default_is_none=True,do_print=False)
|
tags['limit_upload_speed'] = self.util.check_for_attribute(self.data, "limit_upload_speed", parent="tags", subparent=tag_url, var_type="int", default_int=-1, default_is_none=True,do_print=False,save=False)
|
||||||
return (tags)
|
return (tags)
|
||||||
if tags['url']:
|
if tags['url']:
|
||||||
default_tag = tags['url'].split('/')[2].split(':')[0]
|
default_tag = tags['url'].split('/')[2].split(':')[0]
|
||||||
tags['new_tag'] = self.util.check_for_attribute(self.data, default_tag, parent="tags",default=default_tag)
|
tags['new_tag'] = self.util.check_for_attribute(self.data, "tag", parent="tags",subparent=default_tag, default=default_tag)
|
||||||
self.data['tags'][str(default_tag)] = default_tag
|
self.data['tags'][default_tag]['tag'] = default_tag
|
||||||
logger.warning(f'No tags matched for {tags["url"]}. Please check your config.yml file. Setting tag to {default_tag}')
|
logger.warning(f'No tags matched for {tags["url"]}. Please check your config.yml file. Setting tag to {default_tag}')
|
||||||
return (tags)
|
return (tags)
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Qbt:
|
||||||
num_cat = 0
|
num_cat = 0
|
||||||
if self.config.args['cat_update']:
|
if self.config.args['cat_update']:
|
||||||
separator(f"Updating Categories", space=False, border=False)
|
separator(f"Updating Categories", space=False, border=False)
|
||||||
for torrent in alive_it(self.torrent_list):
|
for torrent in self.torrent_list:
|
||||||
if torrent.category == '':
|
if torrent.category == '':
|
||||||
new_cat = self.config.get_category(torrent.save_path)
|
new_cat = self.config.get_category(torrent.save_path)
|
||||||
try:
|
try:
|
||||||
|
@ -115,7 +115,7 @@ class Qbt:
|
||||||
num_tags = 0
|
num_tags = 0
|
||||||
if self.config.args['tag_update']:
|
if self.config.args['tag_update']:
|
||||||
separator(f"Updating Tags", space=False, border=False)
|
separator(f"Updating Tags", space=False, border=False)
|
||||||
for torrent in alive_it(self.torrent_list):
|
for torrent in self.torrent_list:
|
||||||
if torrent.tags == '' or ('cross-seed' in torrent.tags and len([e for e in torrent.tags.split(",") if not 'noHL' in e]) == 1):
|
if torrent.tags == '' or ('cross-seed' in torrent.tags and len([e for e in torrent.tags.split(",") if not 'noHL' in e]) == 1):
|
||||||
tags = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
tags = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
||||||
if tags["new_tag"]:
|
if tags["new_tag"]:
|
||||||
|
@ -261,7 +261,7 @@ class Qbt:
|
||||||
'TRUMP',
|
'TRUMP',
|
||||||
'RETITLED',
|
'RETITLED',
|
||||||
]
|
]
|
||||||
for torrent in alive_it(self.torrentissue):
|
for torrent in self.torrentissue:
|
||||||
t_name = torrent.name
|
t_name = torrent.name
|
||||||
t_count = self.torrentinfo[t_name]['count']
|
t_count = self.torrentinfo[t_name]['count']
|
||||||
t_msg = self.torrentinfo[t_name]['msg']
|
t_msg = self.torrentinfo[t_name]['msg']
|
||||||
|
@ -320,7 +320,7 @@ class Qbt:
|
||||||
dir_cs = self.config.cross_seed_dir
|
dir_cs = self.config.cross_seed_dir
|
||||||
dir_cs_out = os.path.join(dir_cs,'qbit_manage_added')
|
dir_cs_out = os.path.join(dir_cs,'qbit_manage_added')
|
||||||
os.makedirs(dir_cs_out,exist_ok=True)
|
os.makedirs(dir_cs_out,exist_ok=True)
|
||||||
for file in alive_it(cs_files):
|
for file in cs_files:
|
||||||
t_name = file.split(']', 2)[2].split('.torrent')[0]
|
t_name = file.split(']', 2)[2].split('.torrent')[0]
|
||||||
# Substring Key match in dictionary (used because t_name might not match exactly with torrentdict key)
|
# Substring Key match in dictionary (used because t_name might not match exactly with torrentdict key)
|
||||||
# Returned the dictionary of filtered item
|
# Returned the dictionary of filtered item
|
||||||
|
@ -350,7 +350,7 @@ class Qbt:
|
||||||
if dry_run: print_line(f'{t_name} not found in torrents.',loglevel)
|
if dry_run: print_line(f'{t_name} not found in torrents.',loglevel)
|
||||||
else: print_line(f'{t_name} not found in torrents.','WARNING')
|
else: print_line(f'{t_name} not found in torrents.','WARNING')
|
||||||
#Tag missing cross-seed torrents tags
|
#Tag missing cross-seed torrents tags
|
||||||
for torrent in alive_it(self.torrent_list):
|
for torrent in self.torrent_list:
|
||||||
t_name = torrent.name
|
t_name = torrent.name
|
||||||
if 'cross-seed' not in torrent.tags and self.torrentinfo[t_name]['count'] > 1 and self.torrentinfo[t_name]['first_hash'] != torrent.hash:
|
if 'cross-seed' not in torrent.tags and self.torrentinfo[t_name]['count'] > 1 and self.torrentinfo[t_name]['first_hash'] != torrent.hash:
|
||||||
tagged += 1
|
tagged += 1
|
||||||
|
@ -375,7 +375,7 @@ class Qbt:
|
||||||
#sort by size and paused
|
#sort by size and paused
|
||||||
torrent_list = self.get_torrents({'status_filter':'paused','sort':'size'})
|
torrent_list = self.get_torrents({'status_filter':'paused','sort':'size'})
|
||||||
if torrent_list:
|
if torrent_list:
|
||||||
for torrent in alive_it(torrent_list):
|
for torrent in torrent_list:
|
||||||
new_tag = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
new_tag = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
||||||
#Resume torrent if completed
|
#Resume torrent if completed
|
||||||
if torrent.progress == 1:
|
if torrent.progress == 1:
|
||||||
|
|
|
@ -53,6 +53,8 @@ class check:
|
||||||
if subparent not in loaded_config[parent] or not loaded_config[parent][subparent]:
|
if subparent not in loaded_config[parent] or not loaded_config[parent][subparent]:
|
||||||
loaded_config[parent][subparent] = {attribute: default}
|
loaded_config[parent][subparent] = {attribute: default}
|
||||||
elif attribute not in loaded_config[parent]:
|
elif attribute not in loaded_config[parent]:
|
||||||
|
if isinstance(loaded_config[parent][subparent],str):
|
||||||
|
loaded_config[parent][subparent] = {attribute: default}
|
||||||
loaded_config[parent][subparent][attribute] = default
|
loaded_config[parent][subparent][attribute] = default
|
||||||
else:
|
else:
|
||||||
endline = ""
|
endline = ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue