Conversation
…sidecar Google Takeout writes one supplemental-metadata JSON per Live Photo pair, named after the still image. The video half never gets a sidecar of its own, so it fails every existing matcher and comes out as missing metadata. Most visible on duplicate-indexed pairs, e.g. IMG_1234(1).HEIC / IMG_1234(1).MP4, where the JSON is IMG_1234.HEIC.supplemental-metadata(1).json. Reported in simulot#1321 with the same file layout. Add matchLivePhotoVideo: it only fires for a video file matched against a JSON that reduces to an image extension, with a matching duplicate index. It has to run right after matchFastTrack/matchNormal, ahead of matchForgottenDuplicates and matchEditedName. Both of those use loose prefix matching, and matchEditedName in particular will claim a plain video/image pair with no edit suffix and no index if it gets there first, since nothing in its check requires an actual "-edited" marker on the filename. Tests cover the base pair, duplicate-indexed pairs, a wrong-index negative case, a video that keeps using its own dedicated sidecar instead of falling through to this matcher, and the case where the duplicate index is part of the original filename rather than an actual duplicate marker.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The video half of a Live Photo pair comes out as missing metadata:
Fixes #1321
Cause
Every matcher requires the target file's own extension to show up somewhere in the reduced JSON name.
matchNormalstrips.jsonand collapsessupplemental-metadata, but what's left still carries the still image's extension (e.g.IMG_1234.HEIC), and a.MP4file will never equal that.matchFastTrack,matchForgottenDuplicatesandmatchEditedNamehave the same gap for a different reason: none of them account for a still-image-only sidecar being the correct match for a video file.Fix
matchLivePhotoVideochecks that the target file is a video and that the JSON, once reduced, belongs to an image, with the duplicate index matched between the two. It sits right aftermatchNormalin the matcher list rather than at the end, sincematchForgottenDuplicates/matchEditedNameuse loose prefix matching that can misfire on a plain video/image pair with no index and no edit suffix.Verified against a real ~90 GB Takeout export (~17,000 assets):
matchLivePhotoVideocorrectly matched around 4,700 video files that no other matcher touched, all with the expected index-matched JSON. Also reproduced the exact file layout from #1321 directly against the matcher and confirmed the reported file fails without this change and matches viamatchLivePhotoVideowith it.Notes
Based on
mainrather thandevelop, since testing this against a live Immich v3 server needs the v3 support that only landed onmain.