zipseq ignore Thumbs.db
This commit is contained in:
@@ -521,6 +521,9 @@ def iter_sequence_files(seq_dir: Path) -> Iterator[Path]:
|
||||
if is_archive_path(path):
|
||||
continue
|
||||
for filename in filenames:
|
||||
# Ignore Thumbs.db files completely
|
||||
if filename.lower() == "thumbs.db":
|
||||
continue
|
||||
yield path / filename
|
||||
|
||||
|
||||
@@ -563,6 +566,12 @@ def load_state(state_path: Path) -> dict | None:
|
||||
return None
|
||||
try:
|
||||
state = json.loads(state_path.read_text())
|
||||
# Remove Thumbs.db entries from loaded state
|
||||
if "files" in state:
|
||||
state["files"] = [
|
||||
entry for entry in state.get("files", [])
|
||||
if Path(entry.get("path", "")).name.lower() != "thumbs.db"
|
||||
]
|
||||
# Normalize timestamps in loaded state to ensure consistency
|
||||
# This handles state files created before normalization was added
|
||||
is_windows = platform.system() == "Windows"
|
||||
@@ -587,9 +596,12 @@ def state_changed(seq_state: dict, stored_state: dict | None, *, verbose: bool =
|
||||
is_windows = platform.system() == "Windows"
|
||||
|
||||
def normalize_state(state: dict) -> dict:
|
||||
"""Normalize timestamps in state to filesystem precision."""
|
||||
"""Normalize timestamps in state to filesystem precision and filter out Thumbs.db."""
|
||||
normalized = {"files": []}
|
||||
for entry in state.get("files", []):
|
||||
# Ignore Thumbs.db files in state comparison
|
||||
if Path(entry.get("path", "")).name.lower() == "thumbs.db":
|
||||
continue
|
||||
mtime_ns = entry["mtime_ns"]
|
||||
if is_windows:
|
||||
mtime_ns = (mtime_ns // 100) * 100
|
||||
@@ -600,7 +612,7 @@ def state_changed(seq_state: dict, stored_state: dict | None, *, verbose: bool =
|
||||
})
|
||||
return normalized
|
||||
|
||||
# Compare normalized states
|
||||
# Compare normalized states (Thumbs.db already filtered out)
|
||||
normalized_seq = normalize_state(seq_state)
|
||||
normalized_stored = normalize_state(stored_state)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user