Bug 433653 - Please Add xattr support for metadata
Summary: Please Add xattr support for metadata
Status: RESOLVED NOT A BUG
Alias: None
Product: digikam
Classification: Applications
Component: Database-Baloo (show other bugs)
Version: 7.2.0
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-26 11:55 UTC by Bravo Baavo
Modified: 2021-04-10 13:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bravo Baavo 2021-02-26 11:55:42 UTC
SUMMARY
I think it would be really useful if I could choose to write metadata into Extended Filesystem Attributes instead of editing file headers, as well as preserving the hash of my images it would be an easy interface to add tags to the image from other programs that DigiKam can read.

I've seen the namespace 'user.xdg.tags' used for storing image tags before
Comment 1 Maik Qualmann 2021-02-26 12:26:39 UTC
I don't see where it can be beneficial to have tags in extended file attributes. I don't know of any program that would read this information. In addition, Qt does not currently support reading and writing of xattr. The native system code that we would have to write would only work on Linux. Windows and MacOS use their own interfaces.

Maik
Comment 2 Bravo Baavo 2021-02-26 12:45:56 UTC
(In reply to Maik Qualmann from comment #1)
> I don't see where it can be beneficial to have tags in extended file
> attributes. I don't know of any program that would read this information. In
> addition, Qt does not currently support reading and writing of xattr. The
> native system code that we would have to write would only work on Linux.
> Windows and MacOS use their own interfaces.
> 
> Maik

Hi Maik,
I think KDE/Gweview uses xattr to store metadata, it's also supported by the KDE/kfilemetadata library: https://github.com/KDE/kfilemetadata/blob/master/src/usermetadata.cpp#L46
maybe it's worth implementing for compatibility with this?

Kind regards,
Baa.
Comment 3 caulier.gilles 2021-02-26 12:51:38 UTC
digiKam has already a kfilemetadata compatibility layer, disabled by default. Look in Setup Metadata tab named "Baloo". Note that section is optional and can be disabled at compile time.

Gilles Caulier
Comment 4 Bravo Baavo 2021-02-26 13:34:52 UTC
(In reply to caulier.gilles from comment #3)
> digiKam has already a kfilemetadata compatibility layer, disabled by
> default. Look in Setup Metadata tab named "Baloo". Note that section is
> optional and can be disabled at compile time.
> 
> Gilles Caulier

This works great, thanks!

Kind regards,
Baa
Comment 5 tagwerk19 2021-02-26 23:04:58 UTC
So, something like this would be possible?

I've enabled the "Settings / Configure digiKam / Metadata / Baloo" options:

    Store metadata from digiKam in Baloo
    Read metadata from Baloo 

and selected, under "Behaviour / Write this information to the Metadata":

    Image Tags
    Captions and title
    Rating 

Then if I have an image with extended attributes, as listed by getfattr:

    getfattr -d testfile.jpg

    # file: testfile.jpg
    user.baloo.rating="6"
    user.xdg.comment="A comment"
    user.xdg.tags="A Tag" 

and run digiKam, I should be able to see these?

Also, if I add a tag and change the rating within digiKam, I should see these new values appear in the filesystem?
Comment 6 tagwerk19 2021-03-01 21:55:26 UTC
See also Bug 433822