Changes default share limits to -1 if not defined

This commit is contained in:
bobokun 2022-11-22 20:46:32 -05:00
parent 0f74ba471d
commit 57fa0b0c41
No known key found for this signature in database
GPG key ID: B73932169607D927
4 changed files with 38 additions and 38 deletions

View file

@ -72,7 +72,7 @@ tracker:
# max_seeding_time: 129600
# <OPTIONAL> Will ensure that noHL torrents from this tracker are not deleted by cleanup variable if torrent has not yet met the minimum seeding time (min).
# min_seeding_time: 2000
# <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 means no limit)
# limit_upload_speed: 150
# <OPTIONAL> Set this to the notifiarr react name. This is used to add indexer reactions to the notifications sent by Notifiarr
# notifiarr: <notifiarr indexer>
@ -140,7 +140,7 @@ nohardlinks:
- Beyond-HD
- AnimeBytes
- MaM
# <OPTIONAL> cleanup var: WARNING!! Setting this as true Will remove and delete contents of any torrents that are in paused state and has the NoHL tag
# <OPTIONAL> cleanup var: WARNING!! Setting this as true Will remove and delete contents of any torrents that have a noHL tag and meets share limits
cleanup: false
# <OPTIONAL> max_ratio var: Will set the torrent Maximum share ratio until torrent is stopped from seeding/uploading
max_ratio: 4.0
@ -151,7 +151,7 @@ nohardlinks:
# <OPTIONAL> min seeding time var: Will prevent torrent deletion by cleanup variable if torrent has not yet minimum seeding time (min).
# Delete this key from a category's config to use the tracker's configured min_seeding_time. Will default to 0 if not specified for the category or tracker.
min_seeding_time: 43200
# <OPTIONAL> resume_torrent_after_untagging_noHL var: If a torrent was previously tagged as NoHL and now has hardlinks, this variable will resume your torrent after restoring original share limits
# <OPTIONAL> resume_torrent_after_untagging_noHL var: If a torrent was previously tagged as NoHL and now has hardlinks, this variable will resume your torrent after changing share limits
resume_torrent_after_untagging_noHL: false
# Can have additional categories set with separate ratio/seeding times defined.
series-completed:
@ -159,7 +159,7 @@ nohardlinks:
exclude_tags:
- Beyond-HD
- BroadcasTheNet
# <OPTIONAL> cleanup var: WARNING!! Setting this as true Will remove and delete contents of any torrents that are in paused state and has the NoHL tag
# <OPTIONAL> cleanup var: WARNING!! Setting this as true Will remove and delete contents of any torrents that have a noHL tag and meets share limits
cleanup: false
# <OPTIONAL> max_ratio var: Will set the torrent Maximum share ratio until torrent is stopped from seeding/uploading
max_ratio: 4.0
@ -169,7 +169,7 @@ nohardlinks:
limit_upload_speed:
# <OPTIONAL> min seeding time var: Will prevent torrent deletion by cleanup variable if torrent has not yet minimum seeding time (min).
# min_seeding_time: # Not specified for this category; tracker's value will be used. Will default to 0 if not specified for the category or tracker.
# <OPTIONAL> resume_torrent_after_untagging_noHL var: If a torrent was previously tagged as NoHL and now has hardlinks, this variable will resume your torrent after restoring original share limits
# <OPTIONAL> resume_torrent_after_untagging_noHL var: If a torrent was previously tagged as NoHL and now has hardlinks, this variable will resume your torrent after changing share limits
resume_torrent_after_untagging_noHL: false
recyclebin:

View file

@ -256,9 +256,9 @@ class Config:
parent="nohardlinks",
subparent=cat,
var_type="float",
default_int=-2,
default_is_none=True,
min_int=-2,
do_print=False,
default=-1,
)
self.nohardlinks[cat]["max_seeding_time"] = self.util.check_for_attribute(
self.data,
@ -266,9 +266,10 @@ class Config:
parent="nohardlinks",
subparent=cat,
var_type="int",
default_int=-2,
default_is_none=True,
min_int=-2,
do_print=False,
default=-1,
save=False,
)
self.nohardlinks[cat]["min_seeding_time"] = self.util.check_for_attribute(
self.data,
@ -276,9 +277,10 @@ class Config:
parent="nohardlinks",
subparent=cat,
var_type="int",
default_int=0,
default_is_none=True,
min_int=0,
do_print=False,
default=0,
save=False,
)
self.nohardlinks[cat]["limit_upload_speed"] = self.util.check_for_attribute(
self.data,
@ -286,9 +288,10 @@ class Config:
parent="nohardlinks",
subparent=cat,
var_type="int",
default_int=-1,
default_is_none=True,
min_int=-1,
do_print=False,
default=-1,
save=False,
)
self.nohardlinks[cat]["resume_torrent_after_untagging_noHL"] = self.util.check_for_attribute(
self.data,
@ -298,6 +301,7 @@ class Config:
var_type="bool",
default=True,
do_print=False,
save=False,
)
else:
e = f"Config Error: Category {cat} is defined under nohardlinks attribute "
@ -491,9 +495,9 @@ class Config:
parent="tracker",
subparent=tag_url,
var_type="float",
default_int=-2,
default_is_none=True,
min_int=-2,
do_print=False,
default=-1,
save=False,
)
tracker["min_seeding_time"] = self.util.check_for_attribute(
@ -502,9 +506,9 @@ class Config:
parent="tracker",
subparent=tag_url,
var_type="int",
default_int=0,
default_is_none=True,
min_int=0,
do_print=False,
default=-1,
save=False,
)
tracker["max_seeding_time"] = self.util.check_for_attribute(
@ -513,9 +517,9 @@ class Config:
parent="tracker",
subparent=tag_url,
var_type="int",
default_int=-2,
default_is_none=True,
min_int=-2,
do_print=False,
default=-1,
save=False,
)
tracker["limit_upload_speed"] = self.util.check_for_attribute(
@ -524,9 +528,9 @@ class Config:
parent="tracker",
subparent=tag_url,
var_type="int",
default_int=-1,
default_is_none=True,
min_int=-1,
do_print=False,
default=0,
save=False,
)
tracker["notifiarr"] = self.util.check_for_attribute(

View file

@ -255,7 +255,7 @@ class Qbt:
if self.config.commands["cat_update"]:
logger.separator("Updating Categories", space=False, border=False)
torrent_list = self.get_torrents({"category": "", "filter": "completed"})
torrent_list = self.get_torrents({"category": "", "status_filter": "completed"})
for torrent in torrent_list:
new_cat = self.config.get_category(torrent.save_path)
update_cat(new_cat, False)
@ -263,7 +263,7 @@ class Qbt:
# Change categories
if self.config.cat_change:
for old_cat in self.config.cat_change:
torrent_list = self.get_torrents({"category": old_cat, "filter": "completed"})
torrent_list = self.get_torrents({"category": old_cat, "status_filter": "completed"})
for torrent in torrent_list:
new_cat = self.config.cat_change[old_cat]
update_cat(new_cat, True)
@ -333,13 +333,7 @@ class Qbt:
):
body = []
if limit_upload_speed:
if limit_upload_speed == -1:
msg = logger.insert_space("Limit UL Speed: Infinity", 1)
if do_print:
body += logger.print_line(msg, self.config.loglevel)
else:
body.append(msg)
else:
if limit_upload_speed != -1:
msg = logger.insert_space(f"Limit UL Speed: {limit_upload_speed} kB/s", 1)
if do_print:
body += logger.print_line(msg, self.config.loglevel)
@ -515,7 +509,7 @@ class Qbt:
root_dir = self.config.root_dir
remote_dir = self.config.remote_dir
for category in nohardlinks:
torrent_list = self.get_torrents({"category": category, "filter": "completed"})
torrent_list = self.get_torrents({"category": category, "status_filter": "completed"})
if len(torrent_list) == 0:
e = (
"No torrents found in the category ("
@ -611,7 +605,7 @@ class Qbt:
self.config.send_notifications(attr)
# loop through torrent list again for cleanup purposes
if nohardlinks[category]["cleanup"]:
torrent_list = self.get_torrents({"category": category, "filter": "completed"})
torrent_list = self.get_torrents({"category": category, "status_filter": "completed"})
for torrent in torrent_list:
t_name = torrent.name
if t_name in tdel_dict.keys() and "noHL" in torrent.tags:

View file

@ -47,7 +47,7 @@ class check:
default_is_none=False,
req_default=False,
var_type="str",
default_int=0,
min_int=0,
throw=False,
save=True,
make_dirs=False,
@ -119,19 +119,21 @@ class check:
else:
message = f"{text} must be either true or false"
elif var_type == "int":
if isinstance(data[attribute], int) and data[attribute] >= default_int:
if isinstance(data[attribute], int) and data[attribute] >= min_int:
return data[attribute]
else:
message = f"{text} must an integer >= {default_int}"
message = f"{text} must an integer >= {min_int}"
throw = True
elif var_type == "float":
try:
data[attribute] = float(data[attribute])
except:
pass
if isinstance(data[attribute], float) and data[attribute] >= default_int:
if isinstance(data[attribute], float) and data[attribute] >= min_int:
return data[attribute]
else:
message = f"{text} must a float >= {float(default_int)}"
message = f"{text} must a float >= {float(min_int)}"
throw = True
elif var_type == "path":
if os.path.exists(os.path.abspath(data[attribute])):
return os.path.join(data[attribute], "")
@ -162,7 +164,7 @@ class check:
else:
message = f"no {text} found and the default path {default} could not be found"
default = None
if default is not None or default_is_none:
if (default is not None or default_is_none) and not message:
message = message + f" using {default} as default"
message = message + endline
if req_default and default is None: