mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-11-10 00:10:46 +08:00
refactor noHL
This commit is contained in:
parent
f3b747a0f2
commit
0785d5efca
2 changed files with 4 additions and 3 deletions
|
|
@ -518,12 +518,13 @@ class Qbt:
|
||||||
continue
|
continue
|
||||||
for torrent in torrent_list:
|
for torrent in torrent_list:
|
||||||
tracker = self.config.get_tags(torrent.trackers)
|
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"]):
|
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
|
# Skip to the next torrent if we find any torrents that are in the exclude tag
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# Checks for any hard links and not already tagged
|
# 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
|
# Will only tag new torrents that don't have noHL tag
|
||||||
if "noHL" not in torrent.tags:
|
if "noHL" not in torrent.tags:
|
||||||
add_tag_noHL(add_tag=True)
|
add_tag_noHL(add_tag=True)
|
||||||
|
|
@ -559,7 +560,7 @@ class Qbt:
|
||||||
# Checks to see if previously noHL share limits have changed.
|
# Checks to see if previously noHL share limits have changed.
|
||||||
add_tag_noHL(add_tag=False)
|
add_tag_noHL(add_tag=False)
|
||||||
# Checks to see if previous noHL tagged torrents now have hard links.
|
# 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
|
num_untag += 1
|
||||||
body = []
|
body = []
|
||||||
body += logger.print_line(
|
body += logger.print_line(
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ def nohardlink(file):
|
||||||
threshold = 0.5
|
threshold = 0.5
|
||||||
if not sorted_files:
|
if not sorted_files:
|
||||||
msg = (
|
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."
|
"Please make sure qbit_manage has access to this directory."
|
||||||
)
|
)
|
||||||
raise Failed(msg)
|
raise Failed(msg)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue