Skip to content
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

Feature/clear date time tag priority #891

Merged
merged 14 commits into from
Apr 19, 2024

Conversation

grasdk
Copy link
Contributor

@grasdk grasdk commented Apr 18, 2024

Rewrite of metadata date handling. Since there are over 150 different date/timestamp tags, some new requirements will probably pop up over time.

In the effort of keeping MetadataLoader relatively simple, this PR adds a simple list of tags (in the notation of the exifr library) in a stand-alone file

src/backend/model/fileaccess/MetadataCreationDate.ts

The list is a prioritized list of tags that MetadataLoader is using to lookup creationDate and creationDateOffset. The first one found is used. If it does not contain offset, offset will be searched for in other tags under the conditions that these timestamps are close enough to the first.

The new solution allows any contributer to add more tags to the list or change the priority of the tags (if there is a good reason). The priority currently used, puts standardised exif first and has photoshop shortly after and leaves various modification dates at the bottom, since modification can be done long time after creation.

As before side car metadata are loaded last, which means that sidecar data will "overwrite" embedded data in Pigallery2's metadata (not in the real photos).

  • This new solution identified a date calculation error in the test for flatxmp.xmp, which has now been fixed.

Also added some more test data

@grasdk grasdk marked this pull request as draft April 18, 2024 20:06
@grasdk grasdk marked this pull request as ready for review April 18, 2024 20:38
//This is the PRIORITIZED LIST of tags which Pigallery2 uses to determine the date of creation of pictures.
//The list is used for embedded picture metadata and xmp-sidecar files for both pictures and vidoes.

export const DateTags: [string, string, string][] = [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add documentation or better typing about the DateTag type here.
I would just probably declare a type timesptamp = string, typeoffset= string, etc..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I made a commit with something that looks a bit like that. Can be changed of course. Let me know ;)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, its way easier to understand.

@bpatrik
Copy link
Owner

bpatrik commented Apr 18, 2024

Thank you! This is a very nice addition!

@bpatrik bpatrik added this to the Next (probably v2.5) milestone Apr 18, 2024
@bpatrik bpatrik added the bug label Apr 18, 2024
@bpatrik bpatrik merged commit c82abf0 into bpatrik:master Apr 19, 2024
5 of 9 checks passed
@grasdk grasdk deleted the feature/Clear-DateTime-Tag-Priority branch April 21, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants