-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(server): motion photo asset linking & management #8512
Conversation
Tested this. Seems to be working as intended |
|
||
if (asset.livePhotoVideoId !== motionAsset.id) { | ||
await this.assetRepository.update({ id: asset.id, livePhotoVideoId: motionAsset.id }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be done after deleting the old live photo asset asset.livePhotoVideoId
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code was in this order (update livePhotoVideoId
before deleting old motion video assets)
I think this works because the livePhotoVideoId
update is not reflected in asset
immediately.
open to discussion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhh yeah is see the original has this order aswell. Perhaps I am missing something but I think its wrong. What if the update to livePhotoVideoId
happens before reaching the deletion part? It could delete the new livePhotoVideoId
that was just updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that's possible.
We don't re-fetch or update the existing asset
object from the database
Sorry for the back and forth between draft and PR but I think this PR is ready for review |
Man, this is kind of annoying. It deals with excluding external library quota stuff and also live motion linking changes. Those should be two separate, unrelated pull requests. |
I spent awhile looking at this pull request, but there are just too many different things going on here for me to feel comfortable merging it. This PR touches library scanning, quotas, live photo linking (several different scenarios here), as well as updates several queries that might have performance implications. I think most of the code is correct, but the way it is all lumped together makes it hard to review, at least for me personally. I'd be much more likely to merge and include it if you would submit separate pull requests for:
|
@jrasm91 Also: |
Will split into smaller RPs |
Awesome, thank you for being understanding. |
Description
checksum
andlibrary
matchingisVisible
false)getByChecksum
to takelibraryId
instead ofownerId
.isExternal
assets in external libraries during asset refreshHow Has This Been Tested?
Manually tested locally with MP, MVIMG and apple HEIF motion photo formats.
The video portion of each test photo was uploaded first before the image is uploaded.
The video asset is successfully hidden, and motion photo is linked properly.
Also tested with external library. The same motion photo is added to an external library and uploaded through the web gui. Immich correctly created 2 separate video assets.
Discussion
This PR introduces a nuanced approach regarding the handling of video assets from motion photos in external libraries, potentially raising discussion.
Specifically, I mark video assets derived from motion photos in external libraries
isExternal = false
, despite theirlibrary
beingEXTERNAL
. (what a mouthful)It only makes sense to keep these video assets in the same external
library
as their corresponding motion photo, even though they are physically stored in theencoded-video
folder internally.I'm interested to hear what your thoughts are