This commit is contained in:
bobokun 2024-10-05 13:53:55 -04:00
parent aa82ba8db3
commit 6e2fc39e5e
No known key found for this signature in database
GPG key ID: B73932169607D927
3 changed files with 14 additions and 6 deletions

View file

@ -1 +1 @@
4.1.11-develop5
4.1.11-develop6

View file

@ -87,7 +87,7 @@ class TagNoHardLinks:
"""Tag torrents with no hardlinks"""
logger.separator("Tagging Torrents with No Hardlinks", space=False, border=False)
nohardlinks = self.nohardlinks
check_hardlinks = util.CheckHardLinks(self.root_dir, self.remote_dir)
check_hardlinks = util.CheckHardLinks(self.config)
for category in nohardlinks:
torrent_list = self.qbt.get_torrents({"category": category, "status_filter": self.status_filter})
if len(torrent_list) == 0:

View file

@ -525,10 +525,16 @@ class CheckHardLinks:
Class to check for hardlinks
"""
def __init__(self, root_dir, remote_dir):
self.root_dir = root_dir
self.remote_dir = remote_dir
self.root_files = set(get_root_files(self.root_dir, self.remote_dir))
def __init__(self, config):
self.root_dir = config.root_dir
self.remote_dir = config.remote_dir
self.orphaned_dir = config.orphaned_dir if config.orphaned_dir else ""
self.recycle_dir = config.recycle_dir if config.recycle_dir else ""
self.root_files = set(
get_root_files(self.root_dir, self.remote_dir)
+ get_root_files(self.orphaned_dir, "")
+ get_root_files(self.recycle_dir, "")
)
self.get_inode_count()
def get_inode_count(self):
@ -641,6 +647,8 @@ class CheckHardLinks:
def get_root_files(root_dir, remote_dir, exclude_dir=None):
local_exclude_dir = exclude_dir.replace(remote_dir, root_dir) if exclude_dir and remote_dir != root_dir else exclude_dir
# if not root_dir:
# return []
root_files = [
os.path.join(path.replace(remote_dir, root_dir) if remote_dir != root_dir else path, name)
for path, subdirs, files in os.walk(remote_dir if remote_dir != root_dir else root_dir)