Merge pull request #261 from StuffAnThings/develop

3.5.1
This commit is contained in:
bobokun 2023-04-10 08:16:14 -04:00 committed by GitHub
commit a544f9a3b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 30 deletions

View file

@ -1,15 +1,6 @@
# Requirements Updated
- Adds check for minimum python requirement of 3.8.1+ (Fixes #221)
- Updates qbitorrent api to 2023.3.44
# New Features
- Adds support for custom noHL tag (closes #210)
# Bug Fixes
- Fix wrapped JSON Decod error from requests (#245) - Thanks @USA-RedDragon
- Code Refactor / lint - Thanks @bakerboy448
- Adds docstrings - Thanks @bakerboy448
- Fixes #229 - Thanks @bakerboy448
- Fixes #218 - Thanks @bakerboy448
- Fixes #255
- Fixes #260
- Fixes #258
**Full Changelog**: https://github.com/StuffAnThings/qbit_manage/compare/v3.4.4...v3.5.0
**Full Changelog**: https://github.com/StuffAnThings/qbit_manage/compare/v3.5.0...v3.5.1

View file

@ -1 +1 @@
3.5.0
3.5.1

View file

@ -46,7 +46,7 @@ class MyLogger:
self.save_errors = False
self.saved_errors = []
self.config_handlers = {}
self.secrets = []
self.secrets = set()
self.spacing = 0
os.makedirs(self.log_dir, exist_ok=True)
self._logger = logging.getLogger(self.logger_name)
@ -220,7 +220,7 @@ class MyLogger:
def secret(self, text):
"""Add secret"""
if str(text) not in self.secrets and str(text):
self.secrets.append(str(text))
self.secrets.add(str(text))
def insert_space(self, display_title, space_length=0):
"""Insert space"""
@ -246,7 +246,7 @@ class MyLogger:
if isinstance(handler, RotatingFileHandler):
handler.setFormatter(logging.Formatter("[%(asctime)s] %(filename)-27s %(levelname)-10s | %(message)s"))
else:
for secret in self.secrets:
for secret in sorted(self.secrets, reverse=True):
if secret in msg:
msg = msg.replace(secret, "(redacted)")
if "HTTPConnectionPool" in msg:

View file

@ -546,37 +546,39 @@ class Qbt:
# If both tracker and nohardlinks category setting is set, use the larger of the two
# If neither set, use 0 (no limit)
min_seeding_time = 0
if (
tracker["min_seeding_time"]
and tracker["min_seeding_time"] >= nohardlinks[category]["min_seeding_time"]
):
min_seeding_time = tracker["min_seeding_time"]
if tracker["min_seeding_time"] is not None and nohardlinks[category]["min_seeding_time"] is not None:
if tracker["min_seeding_time"] >= nohardlinks[category]["min_seeding_time"]:
min_seeding_time = tracker["min_seeding_time"]
elif nohardlinks[category]["min_seeding_time"]:
min_seeding_time = nohardlinks[category]["min_seeding_time"]
elif tracker["min_seeding_time"]:
min_seeding_time = tracker["min_seeding_time"]
# Determine max_ratio.
# If only tracker setting is set, use tracker's max_ratio
# If only nohardlinks category setting is set, use nohardlinks category's max_ratio
# If both tracker and nohardlinks category setting is set, use the larger of the two
# If neither set, use -1 (no limit)
max_ratio = -1
if tracker["max_ratio"] and tracker["max_ratio"] >= nohardlinks[category]["max_ratio"]:
max_ratio = tracker["max_ratio"]
if tracker["max_ratio"] is not None and nohardlinks[category]["max_ratio"] is not None:
if tracker["max_ratio"] >= nohardlinks[category]["max_ratio"]:
max_ratio = tracker["max_ratio"]
elif nohardlinks[category]["max_ratio"]:
max_ratio = nohardlinks[category]["max_ratio"]
elif tracker["max_ratio"]:
max_ratio = tracker["max_ratio"]
# Determine max_seeding_time.
# If only tracker setting is set, use tracker's max_seeding_time
# If only nohardlinks category setting is set, use nohardlinks category's max_seeding_time
# If both tracker and nohardlinks category setting is set, use the larger of the two
# If neither set, use -1 (no limit)
max_seeding_time = -1
if (
tracker["max_seeding_time"]
and tracker["max_seeding_time"] >= nohardlinks[category]["max_seeding_time"]
):
max_seeding_time = tracker["max_seeding_time"]
if tracker["max_seeding_time"] is not None and nohardlinks[category]["max_seeding_time"] is not None:
if tracker["max_seeding_time"] >= nohardlinks[category]["max_seeding_time"]:
max_seeding_time = tracker["max_seeding_time"]
elif nohardlinks[category]["max_seeding_time"]:
max_seeding_time = nohardlinks[category]["max_seeding_time"]
elif tracker["max_seeding_time"]:
max_seeding_time = tracker["max_seeding_time"]
# Will only tag new torrents that don't have nohardlinks_tag tag
if self.config.nohardlinks_tag not in torrent.tags:
add_tag_no_hl(add_tag=True)
@ -1347,3 +1349,8 @@ class Qbt:
torrent.delete(delete_files=True)
else:
torrent.delete(delete_files=False)
try:
if torrent in self.torrent_list:
self.torrent_list.remove(torrent)
except ValueError:
logger.debug(f"Torrent {torrent.name} has already been deleted from torrent list.")