Add --only-photo/--only-video filters, skip NAS thumbnail dirs

Verified against real files pulled from are-nas: confirmed the tool
correctly leaves already-correct EXIF-dated photos untouched and only
flags the ones actually missing real metadata (validates the earlier
manual fix was precisely targeted). Recursive --dir walk now prunes
@eaDir/#recycle/#snapshot/.SynologyWorkingDirectory instead of wasting
time on generated thumbnails. Fixed a misleading "no files given"
error when --dir was given but --only-photo/--only-video filtered
everything out.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 16:01:24 -04:00
co-authored by Claude Sonnet 5
parent cdf33fd777
commit 6fd83d2b1c
2 changed files with 44 additions and 11 deletions
+10 -3
View File
@@ -136,9 +136,11 @@ mtime instead of parsing embedded metadata.
```bash
./set_mtime_from_metadata.py video1.mov photo1.jpg ...
./set_mtime_from_metadata.py --dry-run *.mov # preview without changing anything or prompting
./set_mtime_from_metadata.py --dir /path/to/library # recursive batch mode, prompts before applying
./set_mtime_from_metadata.py --dir /path/to/library --yes # recursive batch mode, unattended
./set_mtime_from_metadata.py --dry-run *.mov # preview without changing anything or prompting
./set_mtime_from_metadata.py --dir /path/to/library # recursive batch mode, prompts before applying
./set_mtime_from_metadata.py --dir /path/to/library --yes # recursive batch mode, unattended
./set_mtime_from_metadata.py --dir /path/to/library --only-photo --dry-run
./set_mtime_from_metadata.py --dir /path/to/library --only-video --yes
```
Handles `.mov`/`.mp4`/`.m4v` (ffprobe container tags, preferring Apple's
@@ -151,6 +153,11 @@ interpreted as this machine's local time (DST-aware) — run it somewhere
with the same system timezone the footage was actually shot in. Placeholder
"clock never set" timestamps some cameras write (e.g. literal
`0000:00:00 00:00:00`) are treated as no metadata, not a real date.
`--only-photo`/`--only-video` (mutually exclusive) restrict which formats
are considered, for both explicit file args and `--dir`'s recursive walk.
The recursive walk skips known NAS/sync-tool housekeeping directories
(`@eaDir`, `#recycle`, `#snapshot`, `.SynologyWorkingDirectory`) so it
doesn't waste time on generated thumbnails.
Files with no usable timestamp, or that don't exist, are skipped with a
warning and a non-zero exit code; the rest of the batch still runs. Without