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

#310 Read/write metadata from/to disk #342

Merged
merged 15 commits into from
Sep 12, 2021

Conversation

jmalm
Copy link
Contributor

@jmalm jmalm commented Sep 3, 2021

  1. Extract rating when scanning media.
  2. Read metadata tags from XMP sidecar files if present (priority order: .xmp, ..xmp, .ext).
  3. Write metadata to XMP sidecar whenever it is changed on a media file (currently only Rating, when the user marks / unmarks as favorite).
  4. New CLI command "save_metadata" that saves the metadata for all media files (currently only Rating).
  5. Add user setting in db for configuring if / how to save metadata to disk.

How to test:

  1. Choose a photo in your collection that is not favorited. Copy the path on the file system.
  2. Create an XMP sidecar file with a Rating=5:
    exiftool path/to/the-chosen-photo.xmp -Rating=5
  3. Scan your photos (filesystem)
  4. Check that the chosen photo now shows as favorited (refresh page if needed)
  5. Edit "save_metadata_to_disk" in the database for your test user to "SIDECAR_FILE"
  6. Mark a photo as favorite
  7. Check that a .xmp file has been added with Rating=4 (or whatever your favorite_min_rating is set to)
  8. Edit "save_metadata_to_disk" in the database for your test user to "MEDIA_FILE"
  9. Mark another photo as favorite
  10. Check that the tag has been added to the image file (if you used "MEDIA_FILE")

Part of #310 .

@jmalm jmalm changed the title Write metadata to sidecar Read/write metadata from/to disk Sep 4, 2021
@jmalm jmalm changed the title Read/write metadata from/to disk #310 Read/write metadata from/to disk Sep 4, 2021
@sonarcloud
Copy link

sonarcloud bot commented Sep 10, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@derneuere
Copy link
Member

I tested it and all the different settings worked! The code looks good to me 👍

@jmalm
Copy link
Contributor Author

jmalm commented Sep 12, 2021

Sounds great! Any chance of having this and LibrePhotos/librephotos-frontend#26 merged? I would love to start using it in my semi-stable environment (where I pull dev images). ;)

@derneuere derneuere merged commit 9212b14 into LibrePhotos:dev Sep 12, 2021
@derneuere
Copy link
Member

Alright 👍 Should I open up a new issue for "Add backend support for setting save_metadata_to_disk from frontend."?

@jmalm
Copy link
Contributor Author

jmalm commented Sep 12, 2021

Ouch. That was already part of the PR. I had just forgotten to remove the note. 😬

@jmalm
Copy link
Contributor Author

jmalm commented Sep 12, 2021

This merge fixes #335, which can be be closed.

AnkurPrabhu pushed a commit to AnkurPrabhu/librephotos that referenced this pull request Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants