mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2024-09-20 23:36:13 +08:00
commit
1fa74bff68
10
CHANGELOG
10
CHANGELOG
|
@ -1,8 +1,6 @@
|
|||
# Requirements Updated
|
||||
- Updates qbitorrent api to 2023.4.47
|
||||
|
||||
# Bug Fixes
|
||||
- Fixes bug in not removing empty directories (Thanks to @buthed010203 #266)
|
||||
- Speed up remove_orphan by using multiprocessing (Thanks to @buthed010203 #266)
|
||||
- Fixes bug in cross_seed (Fixes #270)
|
||||
- Bug causing RecycleBin not to be created when full path is defined. (Fixes #271)
|
||||
- Fixes Uncaught exception while emptying recycle bin (Fixes #272)
|
||||
|
||||
**Full Changelog**: https://github.com/StuffAnThings/qbit_manage/compare/v3.6.0...v3.6.1
|
||||
**Full Changelog**: https://github.com/StuffAnThings/qbit_manage/compare/v3.6.1...v3.6.2
|
||||
|
|
|
@ -96,8 +96,6 @@ class Config:
|
|||
self.data["cat_change"] = self.data.pop("cat_change")
|
||||
if "tracker" in self.data:
|
||||
self.data["tracker"] = self.data.pop("tracker")
|
||||
elif "tags" in self.data:
|
||||
self.data["tracker"] = self.data.pop("tags")
|
||||
else:
|
||||
self.data["tracker"] = {}
|
||||
if "nohardlinks" in self.data:
|
||||
|
@ -521,6 +519,7 @@ class Config:
|
|||
for name in files
|
||||
]
|
||||
location_files = sorted(location_files)
|
||||
logger.trace(f"location_files: {location_files}")
|
||||
if location_files:
|
||||
body = []
|
||||
logger.separator(f"Emptying {location} (Files > {empty_after_x_days} days)", space=True, border=True)
|
||||
|
@ -529,9 +528,16 @@ class Config:
|
|||
folder = re.search(f".*{os.path.basename(location_path.rstrip(os.sep))}", file).group(0)
|
||||
if folder != prevfolder:
|
||||
body += logger.separator(f"Searching: {folder}", space=False, border=False)
|
||||
fileStats = os.stat(file)
|
||||
filename = os.path.basename(file)
|
||||
last_modified = fileStats[stat.ST_MTIME] # in seconds (last modified time)
|
||||
try:
|
||||
fileStats = os.stat(file)
|
||||
filename = os.path.basename(file)
|
||||
last_modified = fileStats[stat.ST_MTIME] # in seconds (last modified time)
|
||||
except FileNotFoundError:
|
||||
ex = logger.print_line(
|
||||
f"{location} Warning - FileNotFound: No such file or directory: {file} ", "WARNING"
|
||||
)
|
||||
self.config.notify(ex, "Cleanup Dirs", False)
|
||||
continue
|
||||
now = time.time() # in seconds
|
||||
days = (now - last_modified) / (60 * 60 * 24)
|
||||
if empty_after_x_days <= days:
|
||||
|
|
|
@ -39,7 +39,7 @@ class CrossSeed:
|
|||
dest = os.path.join(self.qbt.torrentinfo[t_name]["save_path"], "")
|
||||
src = os.path.join(dir_cs, file)
|
||||
dir_cs_out = os.path.join(dir_cs, "qbit_manage_added", file)
|
||||
category = self.qbt.global_max_ratioget_category(dest)
|
||||
category = self.qbt.get_category(dest)
|
||||
# Only add cross-seed torrent if original torrent is complete
|
||||
if self.qbt.torrentinfo[t_name]["is_complete"]:
|
||||
categories.append(category)
|
||||
|
|
|
@ -364,102 +364,92 @@ class Qbt:
|
|||
except IndexError as e:
|
||||
logger.debug(f"Tracker Url:{url}")
|
||||
logger.debug(e)
|
||||
# Tracker Format 1 deprecated.
|
||||
if isinstance(tag_details, str):
|
||||
e = (
|
||||
"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."
|
||||
tracker["tag"] = self.config.util.check_for_attribute(
|
||||
self.config.data, "tag", parent="tracker", subparent=tag_url, default=tag_url, var_type="list"
|
||||
)
|
||||
if tracker["tag"] == [tag_url]:
|
||||
self.config.data["tracker"][tag_url]["tag"] = [tag_url]
|
||||
if isinstance(tracker["tag"], str):
|
||||
tracker["tag"] = [tracker["tag"]]
|
||||
is_max_ratio_defined = self.config.data["tracker"].get("max_ratio")
|
||||
is_max_seeding_time_defined = self.config.data["tracker"].get("max_seeding_time")
|
||||
if is_max_ratio_defined or is_max_seeding_time_defined:
|
||||
tracker["max_ratio"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"max_ratio",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="float",
|
||||
min_int=-2,
|
||||
do_print=False,
|
||||
default=-1,
|
||||
save=False,
|
||||
)
|
||||
tracker["max_seeding_time"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"max_seeding_time",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="int",
|
||||
min_int=-2,
|
||||
do_print=False,
|
||||
default=-1,
|
||||
save=False,
|
||||
)
|
||||
self.config.notify(e, "Config")
|
||||
raise Failed(e)
|
||||
# Using new Format
|
||||
else:
|
||||
tracker["tag"] = self.config.util.check_for_attribute(
|
||||
self.config.data, "tag", parent="tracker", subparent=tag_url, default=tag_url, var_type="list"
|
||||
)
|
||||
if tracker["tag"] == [tag_url]:
|
||||
self.config.data["tracker"][tag_url]["tag"] = [tag_url]
|
||||
if isinstance(tracker["tag"], str):
|
||||
tracker["tag"] = [tracker["tag"]]
|
||||
is_max_ratio_defined = self.config.data["tracker"].get("max_ratio")
|
||||
is_max_seeding_time_defined = self.config.data["tracker"].get("max_seeding_time")
|
||||
if is_max_ratio_defined or is_max_seeding_time_defined:
|
||||
tracker["max_ratio"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"max_ratio",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="float",
|
||||
min_int=-2,
|
||||
do_print=False,
|
||||
default=-1,
|
||||
save=False,
|
||||
)
|
||||
tracker["max_seeding_time"] = self.config.util.check_for_attribute(
|
||||
self.config.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.config.util.check_for_attribute(
|
||||
self.config.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.config.util.check_for_attribute(
|
||||
self.config.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.config.util.check_for_attribute(
|
||||
tracker["max_ratio"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"min_seeding_time",
|
||||
"max_ratio",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="int",
|
||||
min_int=0,
|
||||
var_type="float",
|
||||
min_int=-2,
|
||||
do_print=False,
|
||||
default=0,
|
||||
save=False,
|
||||
)
|
||||
tracker["limit_upload_speed"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"limit_upload_speed",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="int",
|
||||
min_int=-1,
|
||||
do_print=False,
|
||||
default=0,
|
||||
save=False,
|
||||
)
|
||||
tracker["notifiarr"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"notifiarr",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
default_is_none=True,
|
||||
do_print=False,
|
||||
save=False,
|
||||
)
|
||||
tracker["max_seeding_time"] = self.config.util.check_for_attribute(
|
||||
self.config.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.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"min_seeding_time",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="int",
|
||||
min_int=0,
|
||||
do_print=False,
|
||||
default=0,
|
||||
save=False,
|
||||
)
|
||||
tracker["limit_upload_speed"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"limit_upload_speed",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
var_type="int",
|
||||
min_int=-1,
|
||||
do_print=False,
|
||||
default=0,
|
||||
save=False,
|
||||
)
|
||||
tracker["notifiarr"] = self.config.util.check_for_attribute(
|
||||
self.config.data,
|
||||
"notifiarr",
|
||||
parent="tracker",
|
||||
subparent=tag_url,
|
||||
default_is_none=True,
|
||||
do_print=False,
|
||||
save=False,
|
||||
)
|
||||
return tracker
|
||||
if tracker_other_tag:
|
||||
tracker["tag"] = tracker_other_tag
|
||||
|
|
|
@ -182,7 +182,14 @@ class check:
|
|||
if os.path.exists(os.path.abspath(data[attribute])):
|
||||
return os.path.join(data[attribute], "")
|
||||
else:
|
||||
message = f"Path {os.path.abspath(data[attribute])} does not exist"
|
||||
if make_dirs:
|
||||
try:
|
||||
os.makedirs(data[attribute], exist_ok=True)
|
||||
return os.path.join(data[attribute], "")
|
||||
except OSError:
|
||||
message = f"Path {os.path.abspath(data[attribute])} does not exist and can't be created"
|
||||
else:
|
||||
message = f"Path {os.path.abspath(data[attribute])} does not exist"
|
||||
elif var_type == "list":
|
||||
return get_list(data[attribute], split=False)
|
||||
elif var_type == "list_path":
|
||||
|
@ -197,11 +204,13 @@ class check:
|
|||
return data[attribute]
|
||||
else:
|
||||
message = f"{text}: {data[attribute]} is an invalid input"
|
||||
if var_type == "path" and default and os.path.exists(os.path.abspath(default)):
|
||||
return os.path.join(default, "")
|
||||
elif var_type == "path" and default and make_dirs:
|
||||
os.makedirs(default, exist_ok=True)
|
||||
return os.path.join(default, "")
|
||||
if var_type == "path" and default:
|
||||
default_path = os.path.abspath(default)
|
||||
if make_dirs and not os.path.exists(default_path):
|
||||
os.makedirs(default, exist_ok=True)
|
||||
if os.path.exists(default_path):
|
||||
default = os.path.join(default, "")
|
||||
message = message + f", using {default} as default"
|
||||
elif var_type == "path" and default:
|
||||
if data and attribute in data and data[attribute]:
|
||||
message = f"neither {data[attribute]} or the default path {default} could be found"
|
||||
|
|
Loading…
Reference in a new issue