Skip to content

Commit 979b3cf

Browse files
committed
improve detection of directory modification times
1 parent 5ba1acc commit 979b3cf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

comiclib/scan.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def scan(paths):
6464
if not prev_scanners:
6565
continue
6666
if not any(tag.startswith("date_added:") for tag in metadata["tags"]):
67-
metadata["tags"].add(f"date_added:{int(real_path.stat().st_mtime)}")
67+
# Directory modification times are often difficult to synchronize.
68+
mtime_path = next(real_path.iterdir()) if real_path.is_dir() else real_path
69+
metadata["tags"].add(f"date_added:{int(mtime_path.stat().st_mtime)}")
6870
logging.debug(pformat(metadata))
6971
a.title = metadata["title"]
7072
a.subtitle = metadata["subtitle"]

0 commit comments

Comments
 (0)