Bug 332665 - digiKam should use Baloo interface
Summary: digiKam should use Baloo interface
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Baloo (show other bugs)
Version: 4.0.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-27 01:54 UTC by nucleo
Modified: 2017-07-19 04:03 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12.0


Attachments
attachment-15435-0.html (1.73 KB, text/html)
2014-08-09 20:13 UTC, Vishesh Handa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nucleo 2014-03-27 01:54:00 UTC
Baloo used instead of Nepomuk in KDE 4.13.
Digikam should be ported to Baloo for KDE 4.13.

Reproducible: Always
Comment 1 nucleo 2014-03-27 02:28:10 UTC
Nepomuk libraries not found even if nepomuk-core-devel-4.12.95 installed.
Comment 2 caulier.gilles 2014-03-27 07:14:18 UTC
to comment #1 : this is a system install problem, not digiKam...

Gilles Caulier
Comment 3 Veaceslav Munteanu 2014-03-27 08:58:27 UTC
I disabled Nepomuk Support in this commit:

http://quickgit.kde.org/?p=digikam.git&a=commitdiff&h=d049efab4869a6d521e7670ad0aeb749b2b46e11&hp=3486e3ed6ac8bfc88d05d8da0ad81ceda2d59580

I think Ballo, will use a different approach and current Nepomuk implementation, can't be patched to work with Ballo. It's basically dead code.
Comment 4 Sebastian Niemeyer 2014-05-18 15:25:43 UTC
Hello!

I just tryed to install Digikam 4.0 on openSUSE 13.1 with KDE 4.13.1. Unfortunnatelly it's comming with nepomuk dependency. I do not want Nepomuk and try to avoid it at all cost.

So I hope nepomuk dependency will die in further release because it is an absolute showstopper to me!

It is a little bit sad because Nepomuk support is reintegrated at exactly the moment Nepomuk is dead, bud let us be honestly, the dead of Nepomuk is not sad it is a reason to feel happy!
Comment 5 caulier.gilles 2014-05-18 15:47:21 UTC
There is a digiKam Cmake option to turn on/off Nepomuk support :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/CMakeLists.txt#L12

By default it's disabled !

Gilles Caulier
Comment 6 Sebastian Niemeyer 2014-05-18 16:06:15 UTC
So the problem is, that the openSUSE packagers have switched nepomuk on. Hmmmm... okay I will compile it from source.

Thank You!
Comment 7 Konrad Renner 2014-06-18 07:26:01 UTC
Hi!

Are there any plans to integrate baloo into digikam?
It would be really cool if Tags and Ratings are shared system wide (digikam, dolphin, searching,  etc.). 

Thanks!
Comment 8 Marcel Wiesweg 2014-06-18 16:18:16 UTC
Help is welcome...
We invested considerably in Nepomuk over the years. Motivation to work on Baloo is low from my side.
Comment 9 caulier.gilles 2014-06-18 16:24:27 UTC
Marcel,

Veaceslav is in copy of this file, and he maintained Nepomuk code last summer through GSoC 2013.

As he know well current implementation, perhaps he can spare some free time to port code to Baloo interface. As i can see in Baloo wiki page, it's not too difficult :

http://community.kde.org/Baloo#Porting_your_Application_to_use_Baloo

Gilles
Comment 10 Veaceslav Munteanu 2014-06-19 07:56:37 UTC
Hmm... still a lot to take care, lots of users do not like integration, must make it compile with and without Baloo support, probably on my long term TODO list...
Comment 11 Konrad Renner 2014-06-19 08:28:02 UTC
Thanks for your reply! Is the baloo API so different to the Nepomuk API, that it is so hard to replace it?

I think a good system integration is always a killer feature for an application.
Comment 12 caulier.gilles 2014-06-19 08:33:52 UTC
Hi Konrad

Good question. If you look at 

http://community.kde.org/Baloo#Porting_your_Application_to_use_Baloo

... it said :

"Baloo is not a drop in replacement for Nepomuk. Applications relying on Nepomuk will have to port to Baloo. The majority of Nepomuk applications just rely on its tags, ratings and comments features. Baloo offers a simple asynchronous API for modifying that file metadata. This metadata is now stored with the extended attributes of the file instead of storing it in a separate database. Baloo also offers a search API which is similar to that of Nepomuk in some ways."

My response : it difficult to estimate time to port current digiKam code based on Nepomuk

At least a small guide/tutorial need to be written by Baloo team to make transition more easy.

Gilles Caulier
Comment 13 Veaceslav Munteanu 2014-06-19 08:59:10 UTC
My only guess is that, everything related to Nepomuk should be dropped. And ballo sync to be implemented alongside with metadata sync(another option to sync to baloo)
Comment 14 caulier.gilles 2014-06-19 09:02:28 UTC
By dropping Nepomuk, you want mean to port current code to Baloo. If i understand well Baloo wiki page, no need to drop all interface in digiKam, just to change Nepomuk calls to Baloo calls
Comment 15 Veaceslav Munteanu 2014-06-19 09:07:38 UTC
No, it is not changing Nepomuk calls with Baloo, as far as I understand, it only offer an async api to set and retrieve tags, ratings etc... No more services, no more 2 way syncronization...

So, when we write or read image metadata, we can sync and Ballo also... this how I see port to Baloo.
Comment 16 Konrad Renner 2014-06-19 09:49:09 UTC
(In reply to comment #12)
> 
> At least a small guide/tutorial need to be written by Baloo team to make
> transition more easy.
> 
> Gilles Caulier

I have put Vishesh Handa on the CC list, I think he is the maintainer of baloo and I hope he reads this and can help ;-)
Comment 17 caulier.gilles 2014-06-19 11:48:35 UTC
Hi Vishesh Handa,

Can you give us a simple estimation of work to do about to port current digiKAm Nepomuk interface to use Baloo instead.

All code relevant is here :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/show/utilities/nepomuk

Also, please take a look of analysis from Veaceslav in comments #13 and #15 to see if all is fine...

Thanks in advance

Gilles Caulier
Comment 18 Konrad Renner 2014-07-05 20:00:36 UTC
(In reply to comment #17)
> Hi Vishesh Handa,
> 
> Can you give us a simple estimation of work to do about to port current
> digiKAm Nepomuk interface to use Baloo instead.
> 
> All code relevant is here :
> 
> https://projects.kde.org/projects/extragear/graphics/digikam/repository/
> revisions/master/show/utilities/nepomuk
> 
> Also, please take a look of analysis from Veaceslav in comments #13 and #15
> to see if all is fine...
> 
> Thanks in advance
> 
> Gilles Caulier

Hi,

Vishesh has posted about tagging and baloo: http://vhanda.in/blog/2014/07/tagging-your-files/ , does this help?
Comment 19 Vishesh Handa 2014-07-10 12:13:43 UTC
Sorry about the delay. I finally looked at the code.

With Baloo, we have tried to keep Baloo just as a file indexer for searching. Everything else which Nepomuk used to do have either been thrown away or put in other places. In the case of tags, ratings and comments, they are stored in the extended attributes.

So, if you guys want, you can skip depending on Baloo completely. Lets talk about the code -

dknepomukwrap.cpp - This can be converted into reading and writing the extended attributes.
dknepomukquery.cpp - This is something you can use Baloo for if you want. Or you can scan the files yourself. If you want to use Baloo, I can help with the query. Baloo would just be giving you a list of files which have the xattrs set.
dknepomukwatcher.cpp - Baloo can inform you when a file changes. Or you can use KDirWatch and listen for changes yourself. It's up to you.

On a separate note, one of the things I hated about Nepomuk was the need for these "synchornization agents" to be always running. We had those in PIM and in digikam. Perhaps, now would be a good time to revise that? I'm not aware of the digikam code base, but it might be simpler to just read and write tags from the file system directly.
Comment 20 Marcel Wiesweg 2014-07-10 18:13:04 UTC
We have our own database so the demon is needed to sync to the digikam database when digikam is not running, and a file is changed.
Hm, is the modification date touched when the xattr is edited?
Comment 21 Konrad Renner 2014-07-10 19:35:48 UTC
(In reply to comment #20)
> We have our own database so the demon is needed to sync to the digikam
> database when digikam is not running, and a file is changed.
> Hm, is the modification date touched when the xattr is edited?

Hi, I edited xattr (user.xdg.comment and user.baloo.rating) with the setfattr command and with a little java app. Result: The modification date is not touched.
Comment 22 Vishesh Handa 2014-07-11 11:27:56 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > We have our own database so the demon is needed to sync to the digikam
> > database when digikam is not running, and a file is changed.
> > Hm, is the modification date touched when the xattr is edited?
> 
> Hi, I edited xattr (user.xdg.comment and user.baloo.rating) with the
> setfattr command and with a little java app. Result: The modification date
> is not touched.

The mtime does not change, but the ctime does -

vlap:~ $ touch fook
vlap:~ $ stat fook
  File: ‘fook’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 12h/18d Inode: 13395683    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ vishesh)   Gid: ( 1000/ vishesh)
Access: 2014-07-11 13:36:24.339823962 +0200
Modify: 2014-07-11 13:36:24.339823962 +0200
Change: 2014-07-11 13:36:24.339823962 +0200
 Birth: -
vlap:~ $
vlap:~ $ setfattr -n "user.baloo.rating" -v "4" fook
vlap:~ $ stat fook
  File: ‘fook’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 12h/18d Inode: 13395683    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ vishesh)   Gid: ( 1000/ vishesh)
Access: 2014-07-11 13:36:24.339823962 +0200
Modify: 2014-07-11 13:36:24.339823962 +0200
Change: 2014-07-11 13:36:41.619823391 +0200
 Birth: -

I think you can use QFileInfo::created() to access it.
Comment 23 Veaceslav Munteanu 2014-07-30 16:04:29 UTC
I decided to simplify a little the entire nepomuk/baloo thing.

Since digiKam database and metadata can be out of sync, I suggest to extend read/write metadata options to also read and write using Baloo.

This will reduce the need of having a Nepomuk service and would be much easier to maintain.

But currently I have 2 problems:
1. digiKam image scanner do not detect changes when I add tag with Dolphin
2. I'm still looking for a tutorial for get/set with Ballo, CMake rules and API (I don't know, google does not return relevant searches for Baloo API or tutorial)
Comment 24 caulier.gilles 2014-07-31 06:54:37 UTC
Veaceslav,

>digiKam image scanner do not detect changes when I add tag with Dolphin

Image scanner must be triggered by media change notifier at least. Do you see this kind of information printed on the console when you tag file with Dolphin.

If yes, image scanner must be not able yet to see Baloo event. But are you sure that Dolphin write tags in image metadata when Baloo info are changed ?

>I'm still looking for a tutorial for get/set with Ballo, CMake rules and API (I >don't know, google does not return relevant searches for Baloo API or tutorial)

If Dolphin is already ported to Baloo, you can find probably all relevant info in Dolphin code :

https://projects.kde.org/projects/kde/applications/kde-baseapps/repository/revisions/5707e1e92c9c6ad320dbce5f9eeecb637f3e3312

Gilles Caulier
Comment 25 Konrad Renner 2014-08-05 07:01:10 UTC
(In reply to Veaceslav Munteanu from comment #23)

> 2. I'm still looking for a tutorial for get/set with Ballo, CMake rules and
> API (I don't know, google does not return relevant searches for Baloo API or
> tutorial)

Hi,

you don't need baloo for setting or getting the attributes from a file. The important part is, that the attributes are stored in a namespace as defined here: http://www.freedesktop.org/wiki/CommonExtendedAttributes/

baloo uses the following namespaces for attributes:
 - user.xdg.comment
 - user.xdg.tags => tags are separated with , 
 - user.baloo.ratig => rating range is from 0 to 10 (9 is displayed as 4.5 Stars in dolphin)

In "the near future" baloo will detect changes on this attributes on its own, see Bug 337602 for more information.

I think the real cool part is, that every application which uses the freedesktop defined namespaces will be able to interpret those attributes and is not depened to another software or library.

I don't know how to set the attributes with C/C++ but I have found these:
 - http://stackoverflow.com/questions/9979864/system-file-read-write-o-create-custom-metadata-or-attributes-extended
 - http://www.lesbonscomptes.com/pxattr/
Comment 26 Vishesh Handa 2014-08-09 15:39:11 UTC
I have to agree with Konrad Renner. As a previously said, it might be best NOT to use Baloo. Diadvantages -

* Using Baloo introduces a large number of dependencies
* The API still does not guarantee source compatibility in KF5

The whole point of moving to xattr was also so that other applications can use tags/ratings/comments without having to use Baloo. The primary AIM of Baloo is just to be a good file indexer + searching frameworking.
Comment 27 Veaceslav Munteanu 2014-08-09 18:28:16 UTC
wait... what?

I already ported both sync digiKam->Baloo and Baloo -> digiKam for tags/comment/rating

This means I must one more time drop everything to trash?

Do Baloo have any signals which tells if an image is updated?(I need this to tell digiKam to rescan metadata...)
Comment 28 Vishesh Handa 2014-08-09 20:13:55 UTC
Created attachment 88192 [details]
attachment-15435-0.html

On Sat, Aug 9, 2014 at 8:28 PM, Veaceslav Munteanu <
veaceslav.munteanu90@gmail.com> wrote:

>   *Comment # 27 <https://bugs.kde.org/show_bug.cgi?id=332665#c27> on bug
> 332665 <https://bugs.kde.org/show_bug.cgi?id=332665> from Veaceslav
> Munteanu <veaceslav.munteanu90@gmail.com> *
>
> wait... what?
>
> I already ported both sync digiKam->Baloo and Baloo -> digiKam for
> tags/comment/rating
>
> This means I must one more time drop everything to trash?
>
>
No. Definitely not. I just meant that there may be some *minor* changes to
the API. Minor.


> Do Baloo have any signals which tells if an image is updated?(I need this to
> tell digiKam to rescan metadata...)
>
> When someone changes the tag/rating/comment? We have a file monitor.
Comment 29 Veaceslav Munteanu 2014-08-11 13:53:05 UTC
File monitor is not quite flexible. In old nepomuk implementation we could register a listener for tags, comments and rating and images.

Adding few thousand of urls in filemonitor at each digiKam start-up will not scale at all...

Marcel, Gilles, I sucessfully integrated read/write with metadatahub and imagescanner, but I don't know how to keep baloo <-> digiKam in sync when is off... even when It is on, might be a problem if I don't find a way to get an universal signal...

Should I let the user to sync manually through read/write metadata?
Comment 30 Veaceslav Munteanu 2014-08-19 08:52:48 UTC
I already implemented read/write and all necessary switches in digiKam.

But extended atributes are very volatile. If I disable write support, each metadata update simply destroy all existing extended attributes...
Comment 31 Vishesh Handa 2014-08-19 13:37:03 UTC
(In reply to Veaceslav Munteanu from comment #30)
> I already implemented read/write and all necessary switches in digiKam.
> 
> But extended atributes are very volatile. If I disable write support, each
> metadata update simply destroy all existing extended attributes...

Could you please elaborate? The metadata update destroys all existing extended attributes?
Comment 32 Veaceslav Munteanu 2014-08-19 13:58:27 UTC
yes, when I enable write to baloo, tags, comments and rating is updated. If I disable it, and trigger write metadata, the image is empty: no rating, no comment, no tags..
Comment 33 caulier.gilles 2014-09-08 11:49:29 UTC
Vishesh,

Any progress here to help Veaceslav to complete Baloo digiKam interface ?

Thanks in advance

Gilles Caulier
Comment 34 Vishesh Handa 2014-09-09 12:15:18 UTC
@Veaceslav: Could you give me a specific test case for me to reproduce it and fix it. Perhaps it would be simpler to just look at the code? The code is in baloo/src/file/lib/filemodifyjobtest.cpp. The code is *quite* simple. I'll be happy to answer any questions.

Is there anything else you require? We do not plan to add more facilities in the file monitor for informing clients about what exactly changed. It's too expensive.
Comment 35 nucleo 2014-09-16 15:05:03 UTC
Is this bug figed in 4.3.0?
Comment 36 nucleo 2014-09-16 15:06:56 UTC
Here message when compiling 4.3.0:

--  Baloo libraries found.................... YES (optional)
Comment 37 caulier.gilles 2014-09-16 15:07:43 UTC
Partially.

See Veaceslav comments for details. It still some work to do i think...

Gilles Caulier
Comment 38 nucleo 2014-09-16 15:13:52 UTC
So, can it be already enabled at comile time or better to disable baloo in 4.3.0?
Comment 39 Veaceslav Munteanu 2014-09-16 15:26:59 UTC
@Vishesh, in older Nepomuk Api, I was able to register in ResourceMonitor which type of resource I want to monitor. 

I used to register: comments, tags, ratings and images.

what I really need from Baloo is signalFileMetadatachanged(Kurl file), so I can also trigger it in digiKam.

At least, if filemodifyjob could register a folder path, that would be much better.

If it's to expensive to fire a signal when Baloo register a change.... well there is nothing more I can do to integrate better with digiKam except basic read/write on request.
Comment 40 Veaceslav Munteanu 2014-09-16 15:33:17 UTC
@nucleo, I don't really understand how packaging with optional dependencies work, but baloo support, even if it's only basic, must be good enough for shipping now. This apply for KDE users. 

Non-KDE users won't be happy with Baloo support enabled :)
Comment 41 Vishesh Handa 2014-09-16 17:02:47 UTC
(In reply to Veaceslav Munteanu from comment #39)
> @Vishesh, in older Nepomuk Api, I was able to register in ResourceMonitor
> which type of resource I want to monitor. 
> 
> I used to register: comments, tags, ratings and images.
> 
> what I really need from Baloo is signalFileMetadatachanged(Kurl file), so I
> can also trigger it in digiKam.
> 
> At least, if filemodifyjob could register a folder path, that would be much
> better.
> 
> If it's to expensive to fire a signal when Baloo register a change.... well
> there is nothing more I can do to integrate better with digiKam except basic
> read/write on request.

We do fire a change when the file metadata is modified. There is the FileMonitor, but I think I understand what you mean - there is no way to globally watch everything. You could just listen to the dbus code (look at the implementation of the FileMonitor), but that's hackish. Either way, Baloo in Qt4 is now frozen, so the API isn't going to change.
Comment 42 Konrad Renner 2015-02-03 17:07:55 UTC
will the kf5 port of digiKam make use of baloo and/or xattr?
Comment 43 caulier.gilles 2015-02-03 17:20:54 UTC
The code is unchanged in frameworks implementation. It's just ported to compile under KF5.

Veaceslav, do you have some plan to improve Baloo interface ?

Gilles
Comment 44 Vishesh Handa 2015-02-03 17:29:56 UTC
(In reply to Gilles Caulier from comment #43)
> The code is unchanged in frameworks implementation. It's just ported to
> compile under KF5.
> 
> Veaceslav, do you have some plan to improve Baloo interface ?
> Gilles

If he doesn't have plans, then please contact me. I can spend the required 30 minutes to port it.
Comment 45 Veaceslav Munteanu 2015-02-03 17:53:44 UTC
Gilles, what exactly must be done?
Comment 46 caulier.gilles 2015-02-03 19:05:04 UTC
Veaceslav,

I don't know exactly. Ask to Vishesh (:=)))...

Gilles
Comment 47 Vishesh Handa 2015-02-04 14:54:11 UTC
You need to get it to compile with the Qt5 version. Have a look at KFileMetaData UserMetaData. It's a trivial change.
Comment 48 Veaceslav Munteanu 2015-02-04 16:01:34 UTC
Ok, I will look into it.
Comment 49 Veaceslav Munteanu 2015-03-01 12:08:02 UTC
Vishesh, how do I commit changes to file?

I am able to retrieve data with KFileMetadata Usermetadata, but when I set them, changes are not reflected to files(Dolphin panel do not show anything...)
Comment 50 Vishesh Handa 2015-03-02 09:41:02 UTC
(In reply to Veaceslav Munteanu from comment #49)
> Vishesh, how do I commit changes to file?
> 
> I am able to retrieve data with KFileMetadata Usermetadata, but when I set
> them, changes are not reflected to files(Dolphin panel do not show
> anything...)

Check if the xattr have been set via `getfattr -d`.
Comment 51 Veaceslav Munteanu 2015-03-02 10:24:36 UTC
Thank you, problem was somewhere else. 

Everything is fixed, digiKam successfully ported to baloo.
Comment 52 Vishesh Handa 2015-03-02 10:49:21 UTC
(In reply to Veaceslav Munteanu from comment #51)
> Thank you, problem was somewhere else. 
> 
> Everything is fixed, digiKam successfully ported to baloo.

Could you possibly not call it the Baloo backend? You're mostly only using KFileMetaData (a soon to be framework). I'm trying to make Baloo to just be a file indexer.
Comment 53 Vishesh Handa 2015-03-02 11:03:38 UTC
(In reply to Veaceslav Munteanu from comment #51)
> Thank you, problem was somewhere else. 
> 
> Everything is fixed, digiKam successfully ported to baloo.

I just had a look at the code, you're appending "BalooTags/" to each tag. Do you think the user should be aware of Baloo? In Plasma, we have tried our best to remove technology names from the end user.

line 158: Q_FOREACH -> Maybe converting the list to a set in unnecasary?

The old Baloo code is still in comments. Perhaps we can remove that? It's always there in git, if we want it.

The Baloo dependency can be dropped.

If you want to get the list of tags, you can use Baloo::TagListJob, however, please remember that this will NOT give you the list of all tags. Only the tags from the files that are indexed.
Comment 54 caulier.gilles 2015-03-02 11:13:19 UTC
>The Baloo dependency can be dropped.

I don't understand why exactly ?

Gilles Caulier
Comment 55 Vishesh Handa 2015-03-02 11:35:19 UTC
(In reply to Gilles Caulier from comment #54)
> >The Baloo dependency can be dropped.
> 
> I don't understand why exactly ?
> 

Baloo in KF5 is just a file indexer. It goes through your file and creates an index optimized for searching. It also indexes tags, ratings and comments. These tags, ratings and comments are obtained from the extended attributes of the file via KFileMetaData::UserMetadata. This is a os independent wrapper on top of xattr.

Digikam is currently only using KFileMetaData. It is not using Baloo. Therefore, the dependency can be dropped.

You only need to use Baloo is you want to perform some kind of queries on the index.
Comment 56 caulier.gilles 2015-03-04 09:57:56 UTC
Veaceslav,

What do you think about to remove Baloo dependency and to let's only KFileMetadata ?

Gilles Caulier
Comment 57 Veaceslav Munteanu 2015-03-11 23:25:21 UTC
Gilles,  yes we do not use anything except KFileMetadata.

A clean-up will follow next days...

Indeed BalooTags need to remain, due to digiKam storing tags in hierarchical structures, while KFileMetadata is better with simple tags...
Comment 58 Vishesh Handa 2015-03-11 23:37:30 UTC
(In reply to Veaceslav Munteanu from comment #57)
> Gilles,  yes we do not use anything except KFileMetadata.
> 
> A clean-up will follow next days...
> 
> Indeed BalooTags need to remain, due to digiKam storing tags in hierarchical
> structures, while KFileMetadata is better with simple tags...

I'm not sure I understand. Could you please elaborate on why "BalooTags" needs to remain.
Comment 59 Veaceslav Munteanu 2015-03-15 12:38:34 UTC
Git commit c07b1e032e1afb65a5a12c5e73a5d6d2f7cef716 by Veaceslav Munteanu.
Committed on 15/03/2015 at 12:38.
Pushed by munteanu into branch 'frameworks'.

M  +13   -16   CMakeLists.txt
M  +1    -1    app/CMakeLists.txt
M  +4    -4    app/main/digikamapp.cpp
M  +2    -2    app/utils/componentsinfo.h
M  +1    -1    app/utils/digikam_config.h.cmake.in
M  +3    -3    libs/database/item/imagescanner.cpp
M  +2    -2    libs/fileactionmanager/metadatahub.cpp
M  +6    -6    libs/settings/applicationsettings.cpp
M  +1    -1    utilities/CMakeLists.txt
M  +1    -5    utilities/baloo/CMakeLists.txt
M  +1    -122  utilities/baloo/baloowrap.cpp
M  +0    -18   utilities/baloo/baloowrap.h
M  +4    -4    utilities/setup/setupmetadata.cpp

http://commits.kde.org/digikam/c07b1e032e1afb65a5a12c5e73a5d6d2f7cef716
Comment 60 Veaceslav Munteanu 2015-03-15 12:41:50 UTC
Vishesh, because we store only "TagName" in baloo and not the full path "/parent/TagName". If we reread without appending a parent for it, it will polute root tag.

So we assign a special "BalooTags" and who will need tags from now KFileMetadata will find them there... Of course I will think about replacing BalooTags with something else, or maybe to let user choose the prefix through an option in the menu....
Comment 61 Marko Käning 2015-03-15 13:41:30 UTC
Git commit 08162a7e1a19bb1e278bc29b8b4e46f8a252392c by Marko Käning.
Committed on 15/03/2015 at 13:38.
Pushed by kaning into branch 'master'.

Remove baloo dependency and use only KFileMetadata
FIXED-IN: c07b1e032e1afb65a5a12c5e73a5d6d2f7cef716
CCMAIL: veaceslav.munteanu90@gmail.com

M  +0    -1    dependency-data-kf5-qt5

http://commits.kde.org/kde-build-metadata/08162a7e1a19bb1e278bc29b8b4e46f8a252392c
Comment 62 Jeff Dooley 2015-03-29 20:27:24 UTC
Sorry, I know this bug is now closed, but from a user perspective, I was hoping the developers could clarify the interoperability with Dolphin (which is the tool that I use, presumably with baloo integrated). Below are my assumptions based on this bugzilla thread; please let me know whether or not I correctly understood.

Digikam interoperability with Dolphin: 
* Tags and ratings that are originally generated using Digikam, assuming the user uses the option to save metadata stored in file, will now make use of linux filesystem extended attributes. Consquently, the tags and ratings originally generated in Digikam will be reflected in Dolphin's information panel, and detailed view. Right?
* Will tags, ratings, and comments be allowed to be generated or modified from Dolphin, and then reflected in Digikam?
* Will the list of available tags in Dolphin be synchronized with the list of tags in Digikam?
* If a tag, rating, or comment is applied to a file using Dolphin, when Digikam is started/loaded, will it check the file metadata/ extended attributes against the database and prompt the user to confirm the changes? Corrollary: I can imagine a use-case, or configuration option, where attributes generated outside of Digikam are automatically dropped/ ignored by Digikam.

Thank you very much!
Comment 63 Veaceslav Munteanu 2015-04-28 10:26:43 UTC
Here are some answers to your questions, Jeff:
1. digiKam has options in settings menu to enable/disable read/write
2. If you change data from digikam and write is enabled, tags, ratings and comments are automatically syncronized
3. If you have read enabled, data from baloo is read when any read metadata operation is triggered
4. There is no way for digiKam to know if data was changed from outside. At least at this moment.
5. If digikam has a tag structure like, aaa/bb/cc/dd, digikam store tags with KFileMetadata as "dd" without it's full path. We can store the full path, but tag itself will be unreadable in Dolphin. Also, because of read after write, we could end up with a lot of duplicate tags in digiKam tag tree. Thats why we store them under a special branch, which is now called "BalooTags" so it won't pollute the whole tag tree.

There is a lot of shortcomings on current implementation, I know, but if someone can come up with better design, please write your suggestions here :)
Comment 64 Vishesh Handa 2015-04-28 11:14:29 UTC
(In reply to Veaceslav Munteanu from comment #63)
> Here are some answers to your questions, Jeff:
> 1. digiKam has options in settings menu to enable/disable read/write
> 2. If you change data from digikam and write is enabled, tags, ratings and
> comments are automatically syncronized
> 3. If you have read enabled, data from baloo is read when any read metadata
> operation is triggered

"data from xattr is read ..."

> 4. There is no way for digiKam to know if data was changed from outside. At
> least at this moment.

file system monitoring? inotify provides signals on when a file's attributes have been changed. Or rather do a full scan on startup or when the user requests it and check the ctime of the files?

> 5. If digikam has a tag structure like, aaa/bb/cc/dd, digikam store tags
> with KFileMetadata as "dd" without it's full path. We can store the full
> path, but tag itself will be unreadable in Dolphin. Also, because of read
> after write, we could end up with a lot of duplicate tags in digiKam tag
> tree. Thats why we store them under a special branch, which is now called
> "BalooTags" so it won't pollute the whole tag tree.
> 

I've said this before, I really really disapprove of using the name "BalooTags". If you must use something, use "Digikam". At least the user will then know which application these tags come from. Adding the name Baloo gives them nothing of value and in-fact would confuse them even know since I keep telling everyone that Baloo no longer handles tags.

Maybe I should just submit a patch.
Comment 65 Veaceslav Munteanu 2015-04-28 11:23:07 UTC
Yes, you can commit a patch. The prefix is in the baloowrap.cpp. Set it for the more appropiate value.

Also, when digiKam is running, it might see that through it's file scanner. Scanner must be extended a little to see that changes. But this is only when digiKam is running, complete syncronization is not possible without an additional service.