maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   Accessing tags database in Harmattan (https://talk.maemo.org/showthread.php?t=81999)

jaywink 2012-01-30 19:36

Accessing tags database in Harmattan
 
Hi all,

I have a little sharing app in development for the N9 Harmattan. I'd like to add hashtag support (twitter, diaspora, etc) and would like to enable the user to choose from the same tags as the Gallery. I would need to not only read the tags, but save new tags as well.

Any pointers to code relating to the tag chooser in the Nokia N9 Gallery app? Or at least what API could be used to access the tags?

Looked around various places for hours and cannot find anything :confused:

Thanks!

Br,
Jason

quipper8 2012-01-31 16:45

Re: Accessing tags database in Harmattan
 
the tags are stored in the image itself

See xmp standard
http://ns.adobe.com/xap/1.0/

what you are looking for is stored in

dc:subject


tracker might also keep a list of tag data for photos, idk, would make things like filter by tag easier

here is the data in a photo I tagged using N9 with 'food' and 'tedt'

Code:


<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Exempi + XMP Core 4.4.0">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:exif="http://ns.adobe.com/exif/1.0/"
    xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:xmp="http://ns.adobe.com/xap/1.0/"
  exif:NativeDigest="36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;96064CBBB982FC9EF78639C495C194E3"
  exif:ExposureBiasValue="0/1"
  exif:DateTimeOriginal="2012-01-29T10:28:24.268000-04:58"
  exif:ExposureTime="31/1000"
  exif:FNumber="11/5"
  exif:ExposureProgram="0"
  exif:ShutterSpeedValue="467760638/93335813"
  exif:ApertureValue="122425887/53813410"
  exif:MeteringMode="1"
  exif:FocalLength="28/1"
  exif:ExposureMode="0"
  exif:WhiteBalance="0"
  exif:DigitalZoomRatio="1/1"
  exif:SceneCaptureType="0"
  exif:GainControl="3"
  exif:Contrast="0"
  exif:Saturation="0"
  exif:Sharpness="0"
  exif:ExifVersion="0230"
  exif:FlashpixVersion="0100"
  exif:FileSource="3"
  exif:Date="2012-01-29T15:28:24Z"
  exif:Title="20120129 001"
  exif:Orientation="top - left"
  tiff:NativeDigest="256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;006EF1F055196E10731219DB0CE0FC0C"
  tiff:Orientation="1"
  tiff:Make="Nokia"
  tiff:Model="N9"
  dc:format="image/jpeg"
  dc:date="2012-01-29T15:28:24Z"
  dc:title="20120129 001"
  dc:contributor="myname"
  dc:creator="myname"
  dc:subject="Food, Tedt"
  xmp:ModifyDate="2012-01-29T10:28:24"
  xmp:CreateDate="2012-01-29T10:28:24.268000-04:58">
  <exif:ISOSpeedRatings>
    <rdf:Seq>
    <rdf:li>151</rdf:li>
    </rdf:Seq>
  </exif:ISOSpeedRatings>
  <exif:Flash
    exif:Fired="True"
    exif:Return="0"
    exif:Mode="3"
    exif:Function="False"
    exif:RedEyeMode="False"/>
  </rdf:Description>
 </rdf:RDF>
</x:xmpmeta>


jaywink 2012-01-31 19:04

Re: Accessing tags database in Harmattan
 
Quote:

Originally Posted by quipper8 (Post 1158488)
the tags are stored in the image itself

See xmp standard
http://ns.adobe.com/xap/1.0/

what you are looking for is stored in

dc:subject


tracker might also keep a list of tag data for photos, idk, would make things like filter by tag easier

I'm quite sure there must be some sort of tag database since the same tags are always available even when not adding them to images. If I go to Share UI and choose to share my image to Picasa/Flickr for example, I can choose tags from a tag cloud that has all the tags I've previously added. So tags are stored somewhere centrally where the gallery and Share UI get to use them.

Tracker might be an answer but doesn't it just index files and file metadata?

But thanks anyway for your reply :)

nicolai 2012-01-31 20:17

Re: Accessing tags database in Harmattan
 
They are saved in the tracker database, even when they aren't used
in the image tags anymore.

tracker-sparql -q "select nao:prefLabel(?d) where { ?d a nao:Tag}"

jaywink 2012-02-01 20:23

Re: Accessing tags database in Harmattan
 
Cool thanks nicolai, exactly what I was looking for! Need to look at how to use the QtSparql from my app.

jaywink 2012-02-03 22:13

Re: Accessing tags database in Harmattan
 
Any idea why this QML fails in QtCreator and device (N9 PR1.1)?

Quote:

import QtSparql 1.0
http://harmattan-dev.nokia.com/docs/...del.html?tab=1

Got a hint to try 0.1, which works on device, but 'SparqlListModel' is not recognized.

Something related to PR1.2 which is in the docs already?

jaywink 2012-02-05 21:18

Re: Accessing tags database in Harmattan
 
Started working with Python-QtSparql.

Got access denied to tracker DB and set up Aegis permissions to read/write. However, query returns this error:

Quote:

QTrackerDirectSyncResult: QSparqlError(9, "GDBus.Error:org.freedesktop.DBus.Error.AccessDeni ed: Rejected send message, 2 matched rules; type="method_call", sender=":1.404" (uid=29999 pid=17355 comm="/usr/bin/python /opt/sharetus/sharetus.py http://w") interface="org.freedesktop.Tracker1.Steroids" member="Query" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1327 comm="/usr/lib/tracker/tracker-store "))", 4) "select nao:prefLabel(?d) where { ?d a nao:Tag}"
I checked permissions for the PID and they seem ok:

Quote:

~ $ accli -p 1327 -I
Credentials:
UID::user
GID::metadata-users
SRC::com.nokia.maemo
AID::com.nokia.maemo.tracker.
TrackerReadAccess
TrackerWriteAccess
tracker::tracker
tracker::tracker-extract-access
tracker::tracker-miner-fs-access
So it looks ok to me. Ideas, anyone?

radiofree 2012-02-06 08:17

Re: Accessing tags database in Harmattan
 
Quote:

Originally Posted by jaywink (Post 1160158)
Any idea why this QML fails in QtCreator and device (N9 PR1.1)?



http://harmattan-dev.nokia.com/docs/...del.html?tab=1

Got a hint to try 0.1, which works on device, but 'SparqlListModel' is not recognized.

Something related to PR1.2 which is in the docs already?

You need the PR1.2 SDK/Update to use the SparqlListModel, I assume it's in the documentation already because of the N950 update.

radiofree 2012-02-06 08:18

Re: Accessing tags database in Harmattan
 
Quote:

Originally Posted by jaywink (Post 1160997)
So it looks ok to me. Ideas, anyone?

Does it work with GRP::metadata-users?

jaywink 2012-02-06 20:02

Re: Accessing tags database in Harmattan
 
Quote:

Originally Posted by radiofree (Post 1161127)
Does it work with GRP::metadata-users?

Actually it seems it was my mistake in looking at the wrong PID. But also it seems launching python via the command line and launching it via the Share UI get different permissions. The latter seems to work correctly.

See this post:
http://www.developer.nokia.com/Commu...l=1#post881097

But thanks anyway!


All times are GMT. The time now is 12:03.

vBulletin® Version 3.8.8