mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-11 06:16:35 +08:00
Fixes #196
This commit is contained in:
parent
0785d5efca
commit
db2cb47795
2 changed files with 100 additions and 47 deletions
|
@ -242,6 +242,8 @@ class Config:
|
||||||
self.nohardlinks = {}
|
self.nohardlinks = {}
|
||||||
for cat in self.data["nohardlinks"]:
|
for cat in self.data["nohardlinks"]:
|
||||||
if cat in list(self.data["cat"].keys()):
|
if cat in list(self.data["cat"].keys()):
|
||||||
|
is_max_ratio_defined = self.data["nohardlinks"][cat].get("max_ratio")
|
||||||
|
is_max_seeding_time_defined = self.data["nohardlinks"][cat].get("max_seeding_time")
|
||||||
self.nohardlinks[cat] = {}
|
self.nohardlinks[cat] = {}
|
||||||
self.nohardlinks[cat]["exclude_tags"] = self.util.check_for_attribute(
|
self.nohardlinks[cat]["exclude_tags"] = self.util.check_for_attribute(
|
||||||
self.data,
|
self.data,
|
||||||
|
@ -255,27 +257,52 @@ class Config:
|
||||||
self.nohardlinks[cat]["cleanup"] = self.util.check_for_attribute(
|
self.nohardlinks[cat]["cleanup"] = self.util.check_for_attribute(
|
||||||
self.data, "cleanup", parent="nohardlinks", subparent=cat, var_type="bool", default=False, do_print=False
|
self.data, "cleanup", parent="nohardlinks", subparent=cat, var_type="bool", default=False, do_print=False
|
||||||
)
|
)
|
||||||
self.nohardlinks[cat]["max_ratio"] = self.util.check_for_attribute(
|
if is_max_ratio_defined or is_max_seeding_time_defined:
|
||||||
self.data,
|
self.nohardlinks[cat]["max_ratio"] = self.util.check_for_attribute(
|
||||||
"max_ratio",
|
self.data,
|
||||||
parent="nohardlinks",
|
"max_ratio",
|
||||||
subparent=cat,
|
parent="nohardlinks",
|
||||||
var_type="float",
|
subparent=cat,
|
||||||
min_int=-2,
|
var_type="float",
|
||||||
do_print=False,
|
min_int=-2,
|
||||||
default=-1,
|
do_print=False,
|
||||||
)
|
default=-1,
|
||||||
self.nohardlinks[cat]["max_seeding_time"] = self.util.check_for_attribute(
|
save=False,
|
||||||
self.data,
|
)
|
||||||
"max_seeding_time",
|
self.nohardlinks[cat]["max_seeding_time"] = self.util.check_for_attribute(
|
||||||
parent="nohardlinks",
|
self.data,
|
||||||
subparent=cat,
|
"max_seeding_time",
|
||||||
var_type="int",
|
parent="nohardlinks",
|
||||||
min_int=-2,
|
subparent=cat,
|
||||||
do_print=False,
|
var_type="int",
|
||||||
default=-1,
|
min_int=-2,
|
||||||
save=False,
|
do_print=False,
|
||||||
)
|
default=-1,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.nohardlinks[cat]["max_ratio"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_ratio",
|
||||||
|
parent="nohardlinks",
|
||||||
|
subparent=cat,
|
||||||
|
var_type="float",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default_is_none=True,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
self.nohardlinks[cat]["max_seeding_time"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_seeding_time",
|
||||||
|
parent="nohardlinks",
|
||||||
|
subparent=cat,
|
||||||
|
var_type="int",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default_is_none=True,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
self.nohardlinks[cat]["min_seeding_time"] = self.util.check_for_attribute(
|
self.nohardlinks[cat]["min_seeding_time"] = self.util.check_for_attribute(
|
||||||
self.data,
|
self.data,
|
||||||
"min_seeding_time",
|
"min_seeding_time",
|
||||||
|
@ -295,7 +322,7 @@ class Config:
|
||||||
var_type="int",
|
var_type="int",
|
||||||
min_int=-1,
|
min_int=-1,
|
||||||
do_print=False,
|
do_print=False,
|
||||||
default=-1,
|
default=0,
|
||||||
save=False,
|
save=False,
|
||||||
)
|
)
|
||||||
self.nohardlinks[cat]["resume_torrent_after_untagging_noHL"] = self.util.check_for_attribute(
|
self.nohardlinks[cat]["resume_torrent_after_untagging_noHL"] = self.util.check_for_attribute(
|
||||||
|
@ -315,7 +342,7 @@ class Config:
|
||||||
raise Failed(e)
|
raise Failed(e)
|
||||||
else:
|
else:
|
||||||
if self.commands["tag_nohardlinks"]:
|
if self.commands["tag_nohardlinks"]:
|
||||||
e = "Config Error: nohardlinks attribute not found"
|
e = "Config Error: nohardlinks attribute max_ratio not found"
|
||||||
self.notify(e, "Config")
|
self.notify(e, "Config")
|
||||||
raise Failed(e)
|
raise Failed(e)
|
||||||
|
|
||||||
|
@ -494,17 +521,54 @@ class Config:
|
||||||
self.data["tracker"][tag_url]["tag"] = [tag_url]
|
self.data["tracker"][tag_url]["tag"] = [tag_url]
|
||||||
if isinstance(tracker["tag"], str):
|
if isinstance(tracker["tag"], str):
|
||||||
tracker["tag"] = [tracker["tag"]]
|
tracker["tag"] = [tracker["tag"]]
|
||||||
tracker["max_ratio"] = self.util.check_for_attribute(
|
is_max_ratio_defined = self.data["tracker"].get("max_ratio")
|
||||||
self.data,
|
is_max_seeding_time_defined = self.data["tracker"].get("max_seeding_time")
|
||||||
"max_ratio",
|
if is_max_ratio_defined or is_max_seeding_time_defined:
|
||||||
parent="tracker",
|
tracker["max_ratio"] = self.util.check_for_attribute(
|
||||||
subparent=tag_url,
|
self.data,
|
||||||
var_type="float",
|
"max_ratio",
|
||||||
min_int=-2,
|
parent="tracker",
|
||||||
do_print=False,
|
subparent=tag_url,
|
||||||
default=-1,
|
var_type="float",
|
||||||
save=False,
|
min_int=-2,
|
||||||
)
|
do_print=False,
|
||||||
|
default=-1,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
tracker["max_seeding_time"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_seeding_time",
|
||||||
|
parent="tracker",
|
||||||
|
subparent=tag_url,
|
||||||
|
var_type="int",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default=-1,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
tracker["max_ratio"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_ratio",
|
||||||
|
parent="tracker",
|
||||||
|
subparent=tag_url,
|
||||||
|
var_type="float",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default_is_none=True,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
tracker["max_seeding_time"] = self.util.check_for_attribute(
|
||||||
|
self.data,
|
||||||
|
"max_seeding_time",
|
||||||
|
parent="tracker",
|
||||||
|
subparent=tag_url,
|
||||||
|
var_type="int",
|
||||||
|
min_int=-2,
|
||||||
|
do_print=False,
|
||||||
|
default_is_none=True,
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
tracker["min_seeding_time"] = self.util.check_for_attribute(
|
tracker["min_seeding_time"] = self.util.check_for_attribute(
|
||||||
self.data,
|
self.data,
|
||||||
"min_seeding_time",
|
"min_seeding_time",
|
||||||
|
@ -513,18 +577,7 @@ class Config:
|
||||||
var_type="int",
|
var_type="int",
|
||||||
min_int=0,
|
min_int=0,
|
||||||
do_print=False,
|
do_print=False,
|
||||||
default=-1,
|
default=0,
|
||||||
save=False,
|
|
||||||
)
|
|
||||||
tracker["max_seeding_time"] = self.util.check_for_attribute(
|
|
||||||
self.data,
|
|
||||||
"max_seeding_time",
|
|
||||||
parent="tracker",
|
|
||||||
subparent=tag_url,
|
|
||||||
var_type="int",
|
|
||||||
min_int=-2,
|
|
||||||
do_print=False,
|
|
||||||
default=-1,
|
|
||||||
save=False,
|
save=False,
|
||||||
)
|
)
|
||||||
tracker["limit_upload_speed"] = self.util.check_for_attribute(
|
tracker["limit_upload_speed"] = self.util.check_for_attribute(
|
||||||
|
|
|
@ -475,7 +475,7 @@ class Qbt:
|
||||||
tags="noHL",
|
tags="noHL",
|
||||||
do_print=False,
|
do_print=False,
|
||||||
)
|
)
|
||||||
if body_tags_and_limits:
|
if body_tags_and_limits or add_tag:
|
||||||
num_tags += 1
|
num_tags += 1
|
||||||
# Resume torrent if it was paused now that the share limit has changed
|
# Resume torrent if it was paused now that the share limit has changed
|
||||||
if torrent.state == "pausedUP" and nohardlinks[category]["resume_torrent_after_untagging_noHL"]:
|
if torrent.state == "pausedUP" and nohardlinks[category]["resume_torrent_after_untagging_noHL"]:
|
||||||
|
|
Loading…
Add table
Reference in a new issue