After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 712429 - Offer composite accessors for commonly-needed information
Offer composite accessors for commonly-needed information
Status: RESOLVED OBSOLETE
Product: gexiv2
Classification: Other
Component: implementation
unspecified
Other All
: Normal normal
: ---
Assigned To: Gexiv2 Maintainers
Gexiv2 Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-08 08:30 UTC by Jim Nelson
Modified: 2018-05-22 12:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Composite accessors for: Title, Creator, Copyright, Keywords (12.19 KB, patch)
2015-05-24 20:24 UTC, Alan Pater
needs-work Details | Review

Description Charles Lindsay 2013-11-16 14:44:24 UTC


---- Reported by jim@yorba.org 2013-08-08 13:30:00 -0700 ----

Original Redmine bug id: 7319
Original URL: http://redmine.yorba.org/issues/7319
Searchable id: yorba-bug-7319
Original author: Jim Nelson
Original description:

gexiv2's interface is primarily designed as a GObject wrapper around Exiv2. It
does that today reasonably well.

The interface also offers conversion functions which can take the metadata and
return it not as a string but as an appropriate data type. For example,
`gexiv2_metadata_get_tag_long()`.

It also offers specialized conversion functions for well-known Exiv2 tags. For
example, @gexiv2_metadata_get_fnumber(), which converts the string into a
rational then does the math to convert the rational into a double.

The further down the above list you go, the further gexiv2 veers from its
intended purpose. There is some value in all of the above.

It's worth considering adding a final set of functions to this list, something
called "composite" metadata in ExifTool. Composite accessors take metadata
from a number of locations and puts it together to form a single data object
representing some aspect of the photo. A good example would be

    
    
    GDateTime* gexiv2_metadata_get_creation_time(GExiv2Metadata* self);
    

Which could then assemble the best answer for this question from the available
metadata and return a single GDateTime as an answer. In EXIF, that would mean
including subsecond precision (#7316). For IPTC, that means taking the created
date and created time and putting them together. And so on.

The difference between these composite accessors and the above are that (a)
the user doesn't get to pick the Exiv2 tags used for the determination, (b)
they may use multiple tags as sources of information, and (c) the function
searches through all domains (EXIF, IPTC, XMP) for available information.

It might be worth considering performing this work in Vala, as this layer of
abstraction should have no need to touch Exiv2's C++ interface. In essence,
these calls use the basic library calls to assemble this information.

Related issues:
related to gexiv2 - Feature #7644: Offer previews/thumbnails as GdkPixbuf (Open)
related to gexiv2 - Feature #7316: Add milliseconds to get_date_time() in
GExiv2.py (Open)



--- Bug imported by chaz@yorba.org 2013-11-16 14:44 UTC  ---

This bug was previously known as _bug_ 7319 at http://redmine.yorba.org/show_bug.cgi?id=7319

Unknown version " in product gexiv2. 
   Setting version to "!unspecified".
Unknown milestone "unknown in product gexiv2. 
   Setting to default milestone for this product, "---".
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.
Resolution set on an open status.
   Dropping resolution 

Comment 1 Alan Pater 2014-10-28 16:53:00 UTC
Here is the documentation on exiftool's Metadata Working Group Composite Tags.

   http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/MWG.html
Comment 2 Alan Pater 2015-03-17 21:10:27 UTC
Is there scope for a composite hierarchical keywords function? 

Defacto standard is Adobe's xmp.lr.hierarchicalSubject format, but the following properties also exist out in the wild:

Xmp.digiKam.TagsList
Xmp.MicrosoftPhoto.LastKeywordXMP
Xmp.mwg-kw.Keywords
Xmp.acdsee.categories
Comment 3 Jim Nelson 2015-03-17 21:15:09 UTC
> Is there scope for a composite hierarchical keywords function? 

No.  I don't believe Exiv2 offers one either.

One problem is that those tags use different separators (some slashes, other pipes).  So that's something that would need to be accounted for.

You might look at how Shotwell solved this problem:

https://git.gnome.org/browse/shotwell/tree/src/photos/PhotoMetadata.vala#n864
Comment 4 Alan Pater 2015-03-17 21:22:05 UTC
Yes, I have seen that. It gets more complicated though. 

ACDSee uses a XML-like format: 
  <Category Assigned="0">6 Level<Category Assigned="1">6.2 Level ...

MWG-KW gets really funky (and this is just a simple example):

  Xmp.mwg-kw.Keywords/mwg-kw:Hierarchy[1]/mwg-kw:Children[1]/mwg-kw:Children[1]/mwg-kw:Children[1]/mwg-kw:Keyword 4thLevel


Anyway, the question is, SHOULD gexiv2 offer such a function? There is already one for straight simple tags.
Comment 5 Jim Nelson 2015-03-17 21:29:25 UTC
> Anyway, the question is, SHOULD gexiv2 offer such a function? There is
> already one for straight simple tags.

That's the USD$100,000 question.  The key for me is in the title, "commonly-needed information."  I don't know that heirarchical tags meet that bar, although the MWG makes a case that they do.

Maybe what this ticket should focus on is providing MWG support in gexiv2, as MWG seems to have thought this out more than I have.  However, since MWG is closer to a standard, you could also make the argument that this work should be performed in Exiv2 itself and exposed via gexiv2.  I lean toward the latter not just because I'm lazy, but because it really does seem like work that all Exiv2 users could take advantage of.
Comment 6 Alan Pater 2015-03-17 22:00:59 UTC
1st, we should make a distinction between core MWG guidelines and hierarchical keywords/tags.

Supporting the core MWG guidelines is, for me, a no brainer, under the "commonly-needed information" criteria.

  http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf

Adobe Lightroom hierarchical Subjects are in wide use, not only in Adobe applications but in many other applications. So are the Microsoft Photo and ACDSee hierarchies. They all fall under "commonly-needed information" in my view.


The MWG-keywords schema, on the other hand, does not seem to be in active use by any applications. Providing support for converting from and to those properties may be a purely academic exercise. 


Agreed that all exiv2 users could benefit from these composite tags. But my recent conversations with Robin Mills on the exiv2 forum indicates that converting between various tags is outside of the scope for exiv2.

   http://dev.exiv2.org/boards/3/topics/1912?r=1923#message-1923
Comment 7 Alan Pater 2015-04-07 19:02:44 UTC
It turns out that exiv2 has some available functions that, in effect, mirror MwG guidelines for mapping keys.

   http://www.exiv2.org/doc/convert_8hpp.html

I have just added support for XMP Dates to that: datetime original, datetime digitized, and datetime modified.
Comment 8 Alan Pater 2015-05-24 20:24:03 UTC
Created attachment 303889 [details] [review]
Composite accessors for: Title, Creator, Copyright, Keywords

Accessors for Hierarchical Keywords and Location Shown to follow. Those will need a bit more coding skill.
Comment 9 Jens Georg 2016-07-17 18:24:30 UTC
Review of attachment 303889 [details] [review]:

::: gexiv2/gexiv2-metadata.cpp
@@ +800,3 @@
+void gexiv2_metadata_clear_title (GExiv2Metadata *self) {
+    g_return_if_fail(GEXIV2_IS_METADATA (self));
+    g_return_if_fail(self->priv->image.get() != NULL);

Isn't there some implementation missing?
Comment 10 Alan Pater 2016-08-04 17:09:43 UTC
ok. I'll take another look and try to figure out what is missing. I'm a total amateur at coding, so hopefully it's pretty simple!
Comment 11 GNOME Infrastructure Team 2018-05-22 12:31:14 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gexiv2/issues/2.