mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-09 21:36:52 +08:00
parent
d2b67007ff
commit
9fc7466167
2 changed files with 86 additions and 28 deletions
|
@ -129,6 +129,9 @@ tracker:
|
||||||
notifiarr: torrentleech
|
notifiarr: torrentleech
|
||||||
tv-vault:
|
tv-vault:
|
||||||
tag: TV-Vault
|
tag: TV-Vault
|
||||||
|
# The "other" key is a special keyword and if defined will tag any other trackers that don't match the above trackers into this tag
|
||||||
|
other:
|
||||||
|
tag: other
|
||||||
|
|
||||||
nohardlinks:
|
nohardlinks:
|
||||||
# Tag Movies/Series that are not hard linked
|
# Tag Movies/Series that are not hard linked
|
||||||
|
|
|
@ -442,45 +442,44 @@ class Config:
|
||||||
tracker["limit_upload_speed"] = None
|
tracker["limit_upload_speed"] = None
|
||||||
tracker["notifiarr"] = None
|
tracker["notifiarr"] = None
|
||||||
tracker["url"] = None
|
tracker["url"] = None
|
||||||
if not urls:
|
tracker_other_tag = self.util.check_for_attribute(
|
||||||
return tracker
|
self.data, "tag", parent="tracker", subparent="other", default_is_none=True, var_type="list", save=False
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
tracker["url"] = util.trunc_val(urls[0], os.sep)
|
tracker["url"] = util.trunc_val(urls[0], os.sep)
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
tracker["url"] = None
|
tracker["url"] = None
|
||||||
logger.debug(f"Tracker Url:{urls}")
|
if not urls:
|
||||||
logger.debug(e)
|
urls = []
|
||||||
|
if not tracker_other_tag:
|
||||||
|
tracker_other_tag = ["other"]
|
||||||
|
tracker["url"] = "No http URL found"
|
||||||
|
else:
|
||||||
|
logger.debug(f"Tracker Url:{urls}")
|
||||||
|
logger.debug(e)
|
||||||
if "tracker" in self.data and self.data["tracker"] is not None:
|
if "tracker" in self.data and self.data["tracker"] is not None:
|
||||||
tag_values = self.data["tracker"]
|
tag_values = self.data["tracker"]
|
||||||
for tag_url, tag_details in tag_values.items():
|
for tag_url, tag_details in tag_values.items():
|
||||||
for url in urls:
|
for url in urls:
|
||||||
if tag_url in url:
|
if tag_url in url:
|
||||||
try:
|
if tracker["url"] is None:
|
||||||
tracker["url"] = util.trunc_val(url, os.sep)
|
default_tag = tracker_other_tag
|
||||||
default_tag = tracker["url"].split(os.sep)[2].split(":")[0]
|
else:
|
||||||
except IndexError as e:
|
try:
|
||||||
logger.debug(f"Tracker Url:{url}")
|
tracker["url"] = util.trunc_val(url, os.sep)
|
||||||
logger.debug(e)
|
default_tag = tracker["url"].split(os.sep)[2].split(":")[0]
|
||||||
# If using Format 1 convert to format 2
|
except IndexError as e:
|
||||||
|
logger.debug(f"Tracker Url:{url}")
|
||||||
|
logger.debug(e)
|
||||||
|
# Tracker Format 1 deprecated.
|
||||||
if isinstance(tag_details, str):
|
if isinstance(tag_details, str):
|
||||||
tracker["tag"] = self.util.check_for_attribute(
|
e = (
|
||||||
self.data, tag_url, parent="tracker", default=default_tag, var_type="list"
|
"Config Error: Tracker format invalid. Please see config.yml.sample for correct format and fix "
|
||||||
|
f"`{tag_details}` in the Tracker section of the config."
|
||||||
)
|
)
|
||||||
self.util.check_for_attribute(
|
self.notify(e, "Config")
|
||||||
self.data,
|
raise Failed(e)
|
||||||
"tag",
|
# Using new Format
|
||||||
parent="tracker",
|
|
||||||
subparent=tag_url,
|
|
||||||
default=tracker["tag"],
|
|
||||||
do_print=False,
|
|
||||||
var_type="list",
|
|
||||||
)
|
|
||||||
if tracker["tag"] == default_tag:
|
|
||||||
try:
|
|
||||||
self.data["tracker"][tag_url]["tag"] = [default_tag]
|
|
||||||
except Exception:
|
|
||||||
self.data["tracker"][tag_url] = {"tag": [default_tag]}
|
|
||||||
# Using Format 2
|
|
||||||
else:
|
else:
|
||||||
tracker["tag"] = self.util.check_for_attribute(
|
tracker["tag"] = self.util.check_for_attribute(
|
||||||
self.data, "tag", parent="tracker", subparent=tag_url, default=tag_url, var_type="list"
|
self.data, "tag", parent="tracker", subparent=tag_url, default=tag_url, var_type="list"
|
||||||
|
@ -543,6 +542,62 @@ class Config:
|
||||||
save=False,
|
save=False,
|
||||||
)
|
)
|
||||||
return tracker
|
return tracker
|
||||||
|
if tracker_other_tag:
|
||||||
|
tracker["tag"] = tracker_other_tag
|
||||||
|
tracker["max_ratio"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_ratio",
|
||||||
|
parent="tracker",
|
||||||
|
subparent="other",
|
||||||
|
var_type="float",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default=-1,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
tracker["min_seeding_time"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"min_seeding_time",
|
||||||
|
parent="tracker",
|
||||||
|
subparent="other",
|
||||||
|
var_type="int",
|
||||||
|
min_int=0,
|
||||||
|
do_print=False,
|
||||||
|
default=-1,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
tracker["max_seeding_time"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_seeding_time",
|
||||||
|
parent="tracker",
|
||||||
|
subparent="other",
|
||||||
|
var_type="int",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default=-1,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
tracker["limit_upload_speed"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"limit_upload_speed",
|
||||||
|
parent="tracker",
|
||||||
|
subparent="other",
|
||||||
|
var_type="int",
|
||||||
|
min_int=-1,
|
||||||
|
do_print=False,
|
||||||
|
default=0,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
tracker["notifiarr"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"notifiarr",
|
||||||
|
parent="tracker",
|
||||||
|
subparent="other",
|
||||||
|
default_is_none=True,
|
||||||
|
do_print=False,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
return tracker
|
||||||
if tracker["url"]:
|
if tracker["url"]:
|
||||||
default_tag = tracker["url"].split(os.sep)[2].split(":")[0]
|
default_tag = tracker["url"].split(os.sep)[2].split(":")[0]
|
||||||
tracker["tag"] = self.util.check_for_attribute(
|
tracker["tag"] = self.util.check_for_attribute(
|
||||||
|
|
Loading…
Add table
Reference in a new issue