mirror of
https://github.com/photoprism/photoprism.git
synced 2026-03-02 22:57:18 -05:00
Metadata: Improve XMP parser to support more tags #1409
Labels
No labels
ai
android
api
auth
awesome
bug
bug
ci
cli
config
database
declined
deprecated
docker
docs 📚
documents
duplicate
easy
enhancement
enhancement
enhancement
epic
faces
feedback wanted
frontend
hacktoberfest
help wanted
idea
in-progress
incomplete
index
invalid
ios
labels
live
live
low-priority
macos
member-feature
metadata
mobile
nas
needs-analysis
no-coding-required
no-coding-required
observability
performance
places
please-test
plus-feature
priority
pro-feature
question
raspberry-pi
raw
released
released
released
research
resolved
security
sharing
tested
tests
third-party-issue
thumbnails
upgrade
upstream-issue
ux
vector
video
waiting
won't fix
won't fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/photoprism#1409
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lastzero on GitHub (Apr 17, 2022).
Originally assigned to: @lastzero on GitHub.
As a user with a lot of metadata in XMP sidecar files, I want PhotoPrism to index more of that information so I can easily view and search it.
yq is a portable YAML, JSON and XML command line processor that should make reading XMP much easier than the current implementation: https://github.com/mikefarah/yq
Developer Guide > XMP:
Related Issues:
@jmalm commented on GitHub (Apr 18, 2022):
Have you considered using ExifTool in some way for reading / writing image metadata (both from the images and to/from XMP sidecar files)? For example using https://github.com/barasher/go-exiftool? (go-exiftool has a GPL 3 license, which might not be compatible with the licensing strategy of Photoprism. ExifTool, on the other hand, looks like it has a very permissive license.)
My impression is that ExifTool has become something of a standard reference tool when it comes to image metadata, so it may help even more than yq.
For reference, Librephotos does it this way. (I implemented writing to XMP sidecar files and made some smaller changes to the reading as well in that project, but the choice of ExifTool was made earlier.)
@lastzero commented on GitHub (Apr 18, 2022):
We already use Exiftool, but it's an external Perl script and XML isn't hard to parse as such. It's just that the built-in XML support in Go is pretty bad, at least last time I checked. See my notes in the Developer Guide.
@jmalm commented on GitHub (Apr 20, 2022):
(The following is some testing and reasoning...)
I guess one of the nice things with using ExifTool is that you don't have to care as much about the structure of the tags? I.e. you can read rating by
exiftool -Rating FILENAMEand write it byexiftool -Rating=4 FILENAMEin an XMP sidecar like the following:With yq command line, reading would be something like
yq -p=xml ".xmpmeta.RDF.Description[] | select(.Rating) | .Rating" FILENAME.Writing could be accomplished by
yq -p=xml -o=xml "(.xmpmeta.RDF.Description[] | select(.Rating) | .Rating) = 4" FILENAME, but it seems the entire file is rewritten (I guess that is probably the case with exiftool too), without namespaces:I haven't found a way to not have to specify (and know!) the "absolute" path to the tag. This may be ok and perhaps even desired, but I think the missing namespaces might be a problem.
On the other hand, two nice things with using
yqwould beyqlib)@lastzero commented on GitHub (Jul 23, 2023):
An alternative library to take a look at is https://github.com/beevik/etree
XMP-related issues that may depend on this: