Merge pull request #273 from StuffAnThings/develop

3.6.2
This commit is contained in:
bobokun 2023-04-24 20:18:44 -04:00 committed by GitHub
commit 1fa74bff68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 106 deletions

View file

@ -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

View file

@ -1 +1 @@
3.6.1
3.6.2

View file

@ -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)
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:

View file

@ -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)

View file

@ -364,16 +364,6 @@ 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."
)
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"
)

View file

@ -181,6 +181,13 @@ class check:
elif var_type == "path":
if os.path.exists(os.path.abspath(data[attribute])):
return os.path.join(data[attribute], "")
else:
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":
@ -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:
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)
return os.path.join(default, "")
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"