refactor noHL

This commit is contained in:
bobokun 2022-12-09 10:29:57 -05:00
parent f3b747a0f2
commit 0785d5efca
No known key found for this signature in database
GPG key ID: B73932169607D927
2 changed files with 4 additions and 3 deletions

View file

@ -518,12 +518,13 @@ class Qbt:
continue
for torrent in torrent_list:
tracker = self.config.get_tags(torrent.trackers)
has_nohardlinks = util.nohardlink(torrent["content_path"].replace(root_dir, remote_dir))
if any(tag in torrent.tags for tag in nohardlinks[category]["exclude_tags"]):
# Skip to the next torrent if we find any torrents that are in the exclude tag
continue
else:
# Checks for any hard links and not already tagged
if util.nohardlink(torrent["content_path"].replace(root_dir, remote_dir)):
if has_nohardlinks:
# Will only tag new torrents that don't have noHL tag
if "noHL" not in torrent.tags:
add_tag_noHL(add_tag=True)
@ -559,7 +560,7 @@ class Qbt:
# Checks to see if previously noHL share limits have changed.
add_tag_noHL(add_tag=False)
# Checks to see if previous noHL tagged torrents now have hard links.
if not (util.nohardlink(torrent["content_path"].replace(root_dir, remote_dir))) and ("noHL" in torrent.tags):
if not (has_nohardlinks) and ("noHL" in torrent.tags):
num_untag += 1
body = []
body += logger.print_line(

View file

@ -283,7 +283,7 @@ def nohardlink(file):
threshold = 0.5
if not sorted_files:
msg = (
f"Nohardlink Error: Unable to open the folder {file}."
f"Nohardlink Error: Unable to open the folder {file}. "
"Please make sure qbit_manage has access to this directory."
)
raise Failed(msg)