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

Support time zone information in the createDate attribute in the index #67

Draft
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

RKrahl
Copy link
Owner

@RKrahl RKrahl commented Dec 24, 2024

Add time zone information in the createDate when creating the index. The time zone is derived from the offset between the createDate and gpsDateTime as recorded in the exif data, if gpsDateTime is available. As a fall back, the local time zone is assumed.

Still to do:

  • wait for Extend the index file format to store attributes of the index itself #68 to be implemented.
  • make sure that the index is always consistent with the TimeZone attribute: if the attributes is None, all createDate values should be naive, if the attribute is set to a time zone offset, all createDate values should be aware, the time zone offset is taken as fallback if the time zone for an item cannot otherwise be determined.
  • make sure all internal operations behave consistently in either case, aware and naive, of the index. E.g. filtering the index by date needs to add time zone to the filter condition if the index if aware.
  • add a command line flag in the photo-idx create command to set the TimeZone attribute of the index, the default should be the local time zone.
  • update the test suite and fix failing tests.
  • consider to get time zone and daylight saving time information from vendor specific exif data.
  • add specific tests for the new feature.

Close #7.

@RKrahl RKrahl added the enhancement New feature or request label Dec 24, 2024
@RKrahl RKrahl added this to the 0.11 milestone Dec 24, 2024
@RKrahl
Copy link
Owner Author

RKrahl commented Dec 25, 2024

While working on this, it reveals a challenge: if we determine the time zone for each image individually, based on the exif metadata, it may happen that some images, e.g. index items, end up having a time zone set and some don't. But we need to compare the creates date between the items in the index and the datetime standard library does not support comparing naive and aware dates.

There are essentially two options to deal with this:

  1. enforce a homogeneous index, having either all index items a naive create date or all of them an aware one.
  2. enhance the internal comparing methods for the index items to allow aware and naive create dates to coexist in one index.

It is not clear, how the second option could be done. We will implement the first option. But this requires a larger change than anticipated: we need to manage attributes of the index. We need to store in the index, whether the create dates are meant to be aware or naive and we need to store a default time zone as fallback in the index. And we need to store these attributes, e.g. we need to change the index file format, see #68.

@RKrahl RKrahl removed the blocked Another issue needs to solved before working on this one label Jan 1, 2025
RKrahl added 7 commits January 1, 2025 01:40
twice, once with an offset-naive and once with an offset-aware index
- IdxFilter takes the index as additional argument,
- the timeZone attribute of the index is used in the date filter,
- the filter() method does not take the index argument any more.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support time zone information in the createdate attribute in the index
1 participant