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

Metadata: Fault-tolerant parsing of timestamps from Exif and JSON sidecar files #625

Closed
jean-louis67 opened this issue Nov 19, 2020 · 12 comments
Assignees
Labels
idea Feedback wanted / feature request released Available in the stable release

Comments

@jean-louis67
Copy link
Contributor

I will probably reset the database and reindex all of my photos. I expect to lose some metadata. I would like if possible not to re-enter a number of dates.
In many scanned photos, I have defined the Date/Time Original field with exiftool. When the date is complete, it is taken into account by PhotoPrism. On the other hand, if there is only part of the date (year, or year + month for example), it is totally ignored, whereas we would like the year to be taken into account and the month and / or the day is declared Unknown
I tried with this one for example:

  • "1993"
  • "1993 12:00:00"
  • "1993-00-00 12:00:00"

but without success.
Behind this subject, there is a significant time saving because with exiftool I can put a date, even incomplete, in dozens of photos at a time, while with PhotoPrism, you have to manually go through each of them, and operate 3 changes (year / month / day)
Well, at least as long as there isn't a way to apply the same change to several photos.

@graciousgrey graciousgrey added the idea Feedback wanted / feature request label Nov 19, 2020
@graciousgrey graciousgrey changed the title Working with incomplete dates Working with incomplete dates from exif Nov 19, 2020
@graciousgrey graciousgrey changed the title Working with incomplete dates from exif Metadata / Working with incomplete dates from exif Nov 26, 2020
@lastzero
Copy link
Member

You can enter "1993-00-00 12:00:00" with Exiftool and that works in all software? 00 is not a valid month, so typical date parsers will report an error. We would also have to set it to 01 internally as the database will not store it otherwise.

@jean-louis67
Copy link
Contributor Author

Hello
I only tried with PhotoPrism. My goal is not to test exiftool, but to find out how to get PhotoPrism to recognize an incomplete date. For example "1993" and "1993-12" seem correct, but when indexed, year, month and day are all unknown. Maybe this is an unmanageable requirement. I am looking to use exiftool mainly because I can apply to many photos at once. If I could set the year and/ or month for multiple photos at once via PhotoPrism (issue 271 for example, batch editing), that would be fine for me.

@lastzero
Copy link
Member

Batch edit will be implemented for sure, after our release so that users don't have to wait any longer :)

@graciousgrey graciousgrey changed the title Metadata / Working with incomplete dates from exif Metadata: Working with incomplete dates from exif Jan 5, 2021
@tootbrute
Copy link

Batch edit will be implemented for sure, after our release so that users don't have to wait any longer :)

Nice! Can't wait.

@maxammann
Copy link

maxammann commented Nov 22, 2021

I like the idea of incomplete dates. Currently this function is used to check for a valid exif datetime. It is missing checks for partial datetimes:

func ValidDateTime(s string) bool {

In fact this could be a good be a good beginner task, so I might find some time to implement this.

@lastzero lastzero added the please-test Ready for acceptance test label Mar 25, 2022
@lastzero lastzero self-assigned this Mar 25, 2022
@lastzero lastzero changed the title Metadata: Working with incomplete dates from exif Metadata: Improve parsing of (incomplete) timestamps Mar 25, 2022
@lastzero
Copy link
Member

With these improvements, PhotoPrism should be able to parse any timestamps matching the following patterns regardless of the delimiters or missing values (as long as they make sense, e.g. 2006-05- T : : : for May 1, 2006):

  • 2006:05:11:01:02:03
  • 2006:05:11:01:02:03Z
  • 2006:05:11:01:02:03+0130
  • 2006:05:11:01:02:03-0130
  • 2006:05:11:01:02:03+01:30
  • 2006:05:11:01:02:03-01:30

Help with testing would be greatly appreciated! A new development preview build has been started...

@jean-louis67
Copy link
Contributor Author

Hello
It's nice to work on this subject!
I didn't manage to pass my favourite test case, but maybe I'm doing it wrong.
Here are the detaiis:

  • I updated my PhotoPrism instance with docker pull photoprism/photoprism:preview to Build 220302-0059f429-Linux-AMD64

  • I put two files in originals/test

  • I used exiftool according to point 5 of this FAQ: https://exiftool.org/faq.html

exiftool -overwrite_original -xmp:DateTimeOriginal="1906" lf1.jpg
exiftool -overwrite_original -xmp:DateTimeOriginal="1906:05" lf2.jpg
  • I controlled as follow the two files:
exiftool . | grep 'Date/Time Original'
Date/Time Original              : 1906
Date/Time Original              : 1906:05
  • I launched an indexation
  • The 2 files are added in photoprism and all date fields are Unknown, except for the hour

@lastzero
Copy link
Member

Just pulling the preview image is not enough, you also need to change the image name in your docker-compose.yml (or Portainer/NAS if you're using a Web UI for running Docker containers).

Stable Version (default in our config example):

services:
  photoprism:
    ## Use photoprism/photoprism:preview for testing preview builds:
    image: photoprism/photoprism:latest

Development Preview:

services:
  photoprism:
    ## Use photoprism/photoprism:preview for testing preview builds:
    image: photoprism/photoprism:preview

After you have changed the tag name, be sure to properly restart your instance as described in our docs:
https://docs.photoprism.app/getting-started/updates/#docker-compose

docker-compose pull
docker-compose stop
docker-compose up -d

@jean-louis67
Copy link
Contributor Author

Oops, I feel stupid. Thank you very much for kindly correcting me.

So it's going much better now with Build 220325-e77a029f-Linux-AMD64

Here are the results for 1906-05 and 1906 respectively
image
So, it is exactly what I expected!

Leaving the time at zero is perfectly fine.
image

Thank you very much for covering this topic!

@lastzero
Copy link
Member

Would it be better to assume 12:00 (lunchtime) when there is no specific time provided?

@jean-louis67
Copy link
Contributor Author

For me personally, this is not very important. I don't know if there are more or less universal conventions.
Would it be too rich to have a parameter to choose between these 2 values, or even any value?

@maxammann
Copy link

Would it be better to assume 12:00 (lunchtime) when there is no specific time provided?

I would say 00:00 is fine. That way it is obvious that the image did not contain a hour.

@lastzero lastzero changed the title Metadata: Improve parsing of (incomplete) timestamps Metadata: Fault-tolerant parsing of timestamps from Exif and JSON sidecar files Apr 1, 2022
@graciousgrey graciousgrey added released Available in the stable release and removed please-test Ready for acceptance test labels May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Feedback wanted / feature request released Available in the stable release
Projects
Status: Release 🌈
Development

No branches or pull requests

5 participants