Re: [Tracker] Tracker API for music player



Ok I have looked at
http://git.gnome.org/cgit/tracker/tree/data/db/sqlite-stored-procs.sql

in order to learn how to build Queries and now I came up with the following query

this query selects the (Path, Title, Artist, Album) Tuple for all Files below by music directory and orders them by mtime.

What still bothers me is that I have to use a subquery for each field and I am not sure whether one could achieve the same with less JOINs.

SELECT DISTINCT S.Path || "/" || S.Name,
(SELECT MetadataDisplay FROM ServiceMetadata WHERE S.ID = ServiceID AND MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='Audio:Title')), (SELECT MetadataDisplay FROM ServiceMetadata WHERE S.ID = ServiceID AND MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='Audio:Artist')), (SELECT MetadataDisplay FROM ServiceMetadata WHERE S.ID = ServiceID AND MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='Audio:Album'))
FROM Services S
INNER JOIN ServiceNumericMetaData NM ON S.ID = NM.ServiceID
INNER JOIN ServiceMetaData M ON S.ID = M.ServiceID
WHERE S.ServiceTypeID = (SELECT TypeId FROM ServiceTypes WHERE TypeName = "Music") AND NM.MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='File:Modified')
AND S.Path LIKE "/home/pavel/music/%"
ORDER BY NM.MetaDataValue;

could someone who knows the db layout better than me tell me whether this makes sense?

Regards,

Pavel

On 15.04.2009 14:18, Pavel Rojtberg wrote:
thanks for your reply. Yes YouAmp is a player for maemo :)

Looking at the API exposed by D-Feet, the most promising method for my
needs seems to be Tracker.Search.SqlQuery.

Is this executed directly on Trackers internal SQLite db? And if so is
there some documentation about the available tables and fields available?

As for the album art thing; it seems like I just have to build the
location string myself, which is not a big deal.
Now I am curious if Tracker will also be able do automatically fetch the
album art from internet or whether I have to do it myself?

Regards

Pavel

On 14.04.2009 17:15, Ivan Frade wrote:
Hi Pavel,

El mar, 14-04-2009 a las 16:09 +0200, ext Pavel Rojtberg escribiÃ:
I am the author of the unknown music player "YouAmp" and I am evaluation
whether it is possible to replace my self written indexer with tracker.

Great! It should be possible (and recommendable). BTW, I think i saw
"YouAmp" in maemo...

I already read that the best way to use tracker is calling it over D-bus
- but is there at least some D-Bus API documentation somewhere?

Not much documentation for the API :/ If YouAmp is written in C, take a
look to libtracker. If it is written in Python, use directly dbus
(exploring the API with d-feet, for instance).

The XML description of the DBus API is here:
http://svn.gnome.org/svn/tracker/trunk/data/dbus/

Particularly I need methods for:
* getting all music files below a certain directory

Uhm... we have a method for that... but why to use directories? now you
have the great and wonderful metadata available!

Some hints:
* In Tracker.Files "GetByServiceType" you can get "all music files"
* With an RDF query you can filter "path starting with"


* filtering by artist, album, title

* GetUniqueValue for Audio:Artist, Audio:Album or Audio:Title will
return the list of different values on each property

* sorting by artist, album, title AND mtime

There is a "sort" parameter in the API, where you can choose how to
sort the results.

* storing playlists

It is extremely complicated in tracker (though you can use directly
totem-pl-parser). Tracker only recognize the duration of the playlist
and the number of tracks.


I also read Tracker supports Cover albumart fetching - does it work
already? If so is there some documentation how to get the albumart?

Tracker is able to extract the embedded album art from the files. There
is a specification about how to find it later:

http://live.gnome.org/MediaArtStorageSpec

(Philip can answer more in detail about this)


I am using Tracker in Ubuntu Jaunty (currently 0.6.93)

That is the current stable version (and what you will find in
maemo/Fremantle and desktop distributions). Maybe you should also take a
look to the MAFW. It has been released as open source recently and
offers a higher level API for media applications (including UPNP
abstraction!).

Regards,

Ivan



_______________________________________________
tracker-list mailing list
tracker-list gnome org
http://mail.gnome.org/mailman/listinfo/tracker-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]