About retrieving tags from digikam and tags properties

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

About retrieving tags from digikam and tags properties

Gabriel Voicu
Hello everyone,

I've almost completed the part where I retrieve data (country, city... for photos with given coordinates) from Geonames and OSM. Now, the next part would be to integrate in gpssync2 UI, a tree view containing tags for every image. This would make the user select where will the new resulted data be added in digikams tag hierarchy. Michael Hansen told me that the kipi interface should be extended. 

Can you give me some directions on how to extend kipi interface to retrieve tags from digikam?

I would also need some information about properties tags. What properties from here [0] will be integrated in tags? 

Gabriel




_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: About retrieving tags from digikam and tags properties

Gilles Caulier-4
2010/6/14 Gabriel Voicu <[hidden email]>:
> Hello everyone,
> I've almost completed the part where I retrieve data (country, city... for
> photos with given coordinates) from Geonames and OSM. Now, the next part
> would be to integrate in gpssync2 UI, a tree view containing tags for every
> image. This would make the user select where will the new resulted data be
> added in digikams tag hierarchy. Michael Hansen told me that the kipi
> interface should be extended.
> Can you give me some directions on how to extend kipi interface to retrieve
> tags from digikam?

To retrieve digiKam tags with a kipi-plugin, just use this way :

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/flickrexport/flickrwindow.cpp#561

You checkout KIPI::ImageInfo from an item using url :

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/flickrexport/flickrwindow.cpp#536

There are attribute list for it. "tags" are digiKam tags as well :

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/flickrexport/flickrwindow.cpp#567

How it work :

digiKam kipi interface include a simple mechanism which can be
extended without to touch libkipi. You can get special attribute from
database here :

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/kipiiface/kipiimageinfo.cpp#125

or set attribute there :

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/kipiiface/kipiimageinfo.cpp#165

To delete an attribute :

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/kipiiface/kipiimageinfo.cpp#236

or clear all :

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/kipiiface/kipiimageinfo.cpp#271

In fact, use the right attribute names to manage it in these methods.
To extend attribute management, it's easy.

No need to touch libkipi.

Gilles Caulier
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: About retrieving tags from digikam and tags properties

Gabriel Voicu
Thank you Gilles for fast answering, but this code is about how to retrieve tags from one image and I need to retrieve the tag tree containing all tags from digikam. 

For example, let's say we have two photos in gpssync2 and we want that reverse geocoding tags country name as childs for "Places" tag. We select Places tag.

root Tag---Friends
             \--Places

And after applying reverse geocoding process, the tag tree will look like this:

root Tag---Friends
             \--Places---France
                           \--Germany

That's why I need digikam tag tree in kipi interface; to give the user the possibility to select where he wants to integrate new resulted tags in tag hierarchy.  

Best regards,

Gabriel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: About retrieving tags from digikam and tags properties

Gilles Caulier-4
The first solution is to know the tags hierarchy for each item, using
tagspath properties :

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/kipiiface/kipiimageinfo.cpp#133

... and create a delegate widget in your plugin to display it. Of
course, it can be complicated and long to do

Alternatively, a better way is  to delegate the tags view to kipi host
application..

libkipi has already a template class which must be re-implemented in
kipi host interface. This widget is dedicated to show album tree view
(physical and virtual) to a kipi plugin and to propose to user to set
a selection of an album. Look in HTML export or Flash Export plugins
for example. The dialog show a tab widget where you can select the
right albums to export.

Code is there :

http://lxr.kde.org/source/KDE/kdegraphics/libs/libkipi/libkipi/uploadwidget.h

and re-implemented here :

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/kipiiface/kipiuploadwidget.h

and used there :

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/flashexport/selectionpage.cpp#58

For your needs in GPSSync2 plugin, a similar template widget need to
be declared in libkipi, and re-implemented to Digikam::Kipiinterface.

What do you think about ?

Gilles


2010/6/14 Gabriel Voicu <[hidden email]>:

> Thank you Gilles for fast answering, but this code is about how to retrieve
> tags from one image and I need to retrieve the tag tree containing all tags
> from digikam.
> For example, let's say we have two photos in gpssync2 and we want that
> reverse geocoding tags country name as childs for "Places" tag. We select
> Places tag.
> root Tag---Friends
>              \--Places
> And after applying reverse geocoding process, the tag tree will look like
> this:
> root Tag---Friends
>              \--Places---France
>                            \--Germany
> That's why I need digikam tag tree in kipi interface; to give the user the
> possibility to select where he wants to integrate new resulted tags in tag
> hierarchy.
> Best regards,
> Gabriel
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: About retrieving tags from digikam and tags properties

Marcel Wiesweg
In reply to this post by Gabriel Voicu

> Thank you Gilles for fast answering, but this code is about how to retrieve
> tags from one image and I need to retrieve the tag tree containing all tags
> from digikam.
>
> For example, let's say we have two photos in gpssync2 and we want that
> reverse geocoding tags country name as childs for "Places" tag. We select
> Places tag.
>
> root Tag---Friends
>              \--Places
>
> And after applying reverse geocoding process, the tag tree will look like
> this:
>
> root Tag---Friends
>              \--Places---France
>                            \--Germany
>
> That's why I need digikam tag tree in kipi interface; to give the user the
> possibility to select where he wants to integrate new resulted tags in tag
> hierarchy.

Ok you only need to select one parent tag, for creation of a new tag
hierarchy? For this, you really should use the tree views provided by the host
application. I am no expert in the kipi API, Gilles gave you pointers. If
there is no method yet, we need to add one, really.
Just that you dont start implementing your own model and view; that's not
trivial.

As to the database changes: The suggested changes are fine for you?

Gilles:
We will then have two new sets of attributes:
1) Attributes for tags (not related to any individual image)
2) Attributes for a tag-image association
The problem is number 1), it seems there is no such global attributes method
yet in libkipi?
Gabriel, do you need number 2) at all?
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: About retrieving tags from digikam and tags properties

Gabriel Voicu
Thank you, Gilles and Marcel, for answering. 

The tag tree will be used to select the parent tag and to add the new resulted tags in digikam tag hierarchy. Some other uses (although not primary I think), could be adding, deleting or renaming the tags from digikam tag tree directly in gpssync2. 

From what I've seen in the code pointed by Gilles, I can use the tag tree view to retrieve tag hierarchy from digikam and that's very useful. What I haven't found, are some functions that manipulate them(delete, create new tags). Maybe I can solve this problem by using the code that Gilles pointed in the first mail to manipulate tags for each image.

As for tags attributes, the ones suggested are fine for me. From what I can think of, I don't need point 2).  

Gabriel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: About retrieving tags from digikam and tags properties

Gilles Caulier-4
In reply to this post by Marcel Wiesweg
2010/6/14 Marcel Wiesweg <[hidden email]>:

>
>> Thank you Gilles for fast answering, but this code is about how to retrieve
>> tags from one image and I need to retrieve the tag tree containing all tags
>> from digikam.
>>
>> For example, let's say we have two photos in gpssync2 and we want that
>> reverse geocoding tags country name as childs for "Places" tag. We select
>> Places tag.
>>
>> root Tag---Friends
>>              \--Places
>>
>> And after applying reverse geocoding process, the tag tree will look like
>> this:
>>
>> root Tag---Friends
>>              \--Places---France
>>                            \--Germany
>>
>> That's why I need digikam tag tree in kipi interface; to give the user the
>> possibility to select where he wants to integrate new resulted tags in tag
>> hierarchy.
>
> Ok you only need to select one parent tag, for creation of a new tag
> hierarchy? For this, you really should use the tree views provided by the host
> application. I am no expert in the kipi API, Gilles gave you pointers. If
> there is no method yet, we need to add one, really.
> Just that you dont start implementing your own model and view; that's not
> trivial.
>
> As to the database changes: The suggested changes are fine for you?
>
> Gilles:
> We will then have two new sets of attributes:
> 1) Attributes for tags (not related to any individual image)
> 2) Attributes for a tag-image association
> The problem is number 1), it seems there is no such global attributes method
> yet in libkipi?

Yes, there is no such attribute like this for the moment.

This can be extended of course...

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel