-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
refactor: metadata extraction #12359
Conversation
// make sure dates comes from sidecar | ||
const sidecarDate = firstDateTime(sidecarTags as Tags, EXIF_DATE_TAGS); | ||
if (sidecarDate) { | ||
for (const tag of EXIF_DATE_TAGS) { | ||
delete mediaTags[tag]; | ||
} |
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.
It doesn't seem desirable that it'll use a lower-priority date-time tag from the sidecar over a higher-priority one in the original.
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.
This is actually very much on purpose. We allow changing the date time in immich and we write that to a sidecar file. We always write DateTimeOriginal
. Images with higher priority fields, like SubSecDateTimeOriginal
would be impossible to overwrite.
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 see, but there are also tags below DateTimeOriginal that would get used instead of it. It's confusing behavior.
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.
An interesting option would be to write both DateTimeOriginal
and a custom tag like ImmichDateTimeOriginal
. That tag would be the highest priority during metadata extraction if it exists. Probably out of scope for this PR, though.
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.
Nah, I think tags are confusing enough and the point is to be interoperable. We could potentially only remove tags from the sidecar is we find DateTimeOriginal
in the sidecar. At the moment the only tag with higher priority than that is the sub-second one.
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.
For me at least, if you have a reliable date time tag in the xmp file we should use that always. I agree that maybe we should potentially ignore the low quality ones like CreateDate
though.
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.
Yeah, I like that.
return null; | ||
}) as Promise<ImmichTags | null>; | ||
return {}; |
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.
Not sure how to feel about this. An empty object implies that it read the file successfully and there was just nothing there. If there was an issue reading it (permissions, etc.), it's not the same as it having no metadata.
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 confusing part is probably the service should catch and ignore the error, not the repository. We don't actually ever differentiate or do anything in the failure case anyways, so it doesn't matter much if it is here or in the service.
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.
Yeah, it'd be nicer for the empty object fallback to live in the service.
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 have a list of things I am working through with regards to the metadata service file. I can make a note to move the try/catch/suppression to the service and write some additional tests for those scenarios in another PR.
ef8e88c
to
2f5519f
Compare
2f5519f
to
ad5d735
Compare
ImmichTags
andReverseGeocodeResult
from the repositories