feat(photorenamer): hold a Live Photo video when its image is not renamed #13
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/photorenamer-live-hold"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A Live Photo is an image and a MOV with the same stem. The MOV followed
the new stem of its image only when the image was renamed, and was
held on its name only when the image was moved back. Every other
refusal of the image (sidecar clash, more than one sidecar, target
exists, no target name, a failed -testname or -filename, a plan_rename
skip, unreadable metadata) let the MOV be renamed on its own date, so
the pair lost its shared stem and a later run could not pair them.
Rule: the MOV follows its image only when the image is renamed. An
image that is skipped, failed or unreadable records an empty stem, and
the MOV keeps its name. An ignored file (not a JPEG, HEIC or HEIF to
exiftool) holds nothing, so a JPEG still leads its video when the HEIC
with the same stem is ignored, for example when it is not a real HEIC.
An unreadable file has no MIME type, so its extension decides.
The hold is recorded once, in process_file, after the outcome is set,
so a new refusal path holds the video without more code. paired_stem
already reads the first line per image, so an image that is renamed
but keeps its sidecar behind still leads its video. HEIC wins over
JPEG as before, so a HEIC that is not renamed now holds the video even
when a JPEG with the same stem is renamed; before, the video followed
the JPEG.
A held video logs at the level of its image: a plan_rename skip keeps
its level (debug for Lightroom, PhotoLab, no date or a 0000 date; info
otherwise), and a failed or unreadable image logs at err. PAIRFILE
gets the level as a third field. So a deliberate skip stays quiet on
every later run, as the video was before, when it was renamed once.
A held video whose image was skipped, and whose own name with its
extension lower-cased is a processed name, sits beside its processed
image (for example ..._15p.heic and ..._15p.MOV). It logs info
"Already been processed" and keeps its name: a case-only rename to
.mov gets a -1 counter on a case-insensitive disk. The check runs only
for a skip: when the image failed or was unreadable (for example
..._15p.HEIC with a sidecar clash), the video logs the hold at err, so
a processed-looking name cannot hide the failure.
A path with a TAB or newline cannot be recorded in PAIRFILE, so its
video is not paired and keeps its own date, as before; a test pins it.
The hold works the same in a dry run, so the dry-run report matches
write mode, except for a -filename write failure, which only write mode
can see. Videos are still processed after all other files, so find
order does not matter; a reversed-find shim tests that. The
two-sidecar hold test runs only on a case-sensitive volume (see the
hdiutil note in the suite); it skips on default APFS.
Message change: "rename skipped, its Live Photo image was moved back"
becomes "rename skipped, its Live Photo image was not renamed", and now
covers every hold. The video is counted as skipped, not failed. The
test "a skipped image leaves the video on its own date" is replaced by
the opposite rule.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com