Skip to content

Commit

Permalink
made scanning hardlinks optional to preserve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDoee committed Mar 11, 2024
1 parent 70b5137 commit a1b48fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/autotorrent/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def parse_config_file(path, utf8_compat_mode=False):
db,
ignore_file_patterns=parsed_config["ignore_file_patterns"],
ignore_directory_patterns=parsed_config["ignore_directory_patterns"],
include_inodes=parsed_config["scan_hardlinks"],
)
parsed_config["rewriter"] = rewriter = PathRewriter(parsed_config["same_paths"])
parsed_config["matcher"] = matcher = Matcher(
Expand Down
7 changes: 6 additions & 1 deletion src/autotorrent/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ def __init__(
db,
ignore_file_patterns=None,
ignore_directory_patterns=None,
include_inodes=False,
):
self.db = db
self.ignore_file_patterns = ignore_file_patterns or []
self.ignore_directory_patterns = ignore_directory_patterns or []
self.include_inodes = include_inodes

def scan_paths(self, paths, full_scan=True):
paths = [Path(p) for p in paths]
Expand Down Expand Up @@ -193,7 +195,10 @@ def _scan_client(self, client_name, client, fast_scan):
insert_queue = []

def get_file_inode(path):
return path.stat().st_ino
if self.include_inodes:
return path.stat().st_ino
else:
return -1

for torrent in torrents:
_, current_download_path = self.db.get_torrent_file_info(
Expand Down

0 comments on commit a1b48fa

Please sign in to comment.