mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-09-13 16:45:23 +08:00
send notification on nohardlink warning and remove
force failure
This commit is contained in:
parent
3533cfb2f5
commit
99c00e3bbc
2 changed files with 5 additions and 4 deletions
|
@ -518,7 +518,7 @@ 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))
|
||||
has_nohardlinks = util.nohardlink(torrent["content_path"].replace(root_dir, remote_dir), self.config.notify)
|
||||
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
|
||||
|
|
|
@ -270,7 +270,7 @@ def remove_empty_directories(pathlib_root_dir, pattern):
|
|||
# If a folder is passed, it will take the largest file in that folder and only check for hardlinks
|
||||
# of the remaining files where the file is greater size a percentage of the largest file
|
||||
# This fixes the bug in #192
|
||||
def nohardlink(file):
|
||||
def nohardlink(file, notify):
|
||||
check = True
|
||||
if os.path.isfile(file):
|
||||
logger.trace(f"Checking file: {file}")
|
||||
|
@ -284,9 +284,10 @@ def nohardlink(file):
|
|||
if not sorted_files:
|
||||
msg = (
|
||||
f"Nohardlink Error: Unable to open the folder {file}. "
|
||||
"Please make sure qbit_manage has access to this directory."
|
||||
"Please make sure folder exists and qbit_manage has access to this directory."
|
||||
)
|
||||
raise Failed(msg)
|
||||
notify(msg, "nohardlink")
|
||||
logger.warning(msg)
|
||||
largest_file_size = os.stat(sorted_files[0]).st_size
|
||||
logger.trace(f"Largest file: {sorted_files[0]}")
|
||||
logger.trace(f"Largest file size: {largest_file_size}")
|
||||
|
|
Loading…
Add table
Reference in a new issue