Re: [Rhythmbox-devel] rhythmdb entries



On Thu, Dec 31, 2009 at 12:27 PM, Ron Croonenberg <ronc depauw edu> wrote:
> I am trying to access the rhythmdb, I checked the "plugin writing guide"
>
> but the only thing I can find is the following snippet:
>
> %<
> for row in mysource.props.query_model:
>        entry = row[0]
>        print db.entry_get(entry, rhythmdb.PROP_TITLE)
> %<
>
> is there a document that shows how to use the rhythmdb?

Not really. The C documentation
(http://library.gnome.org/devel/rhythmbox/unstable/ch04.html) is
incomplete but it might help a bit for the parts that translate
directly to python.

> For accessing all rows in the db, do I just loop through it and than get
> data out of an entry by using something like:
> 'db.entry_get(entry, rhythmdb.PROP_TITLE)'  , like in the above snippet?
>
> I see there is a rhythmdb.PROP_TITLE, is there also a rhythmdb.PROP_ARTIST,
> rhythmdb.PROP_ALBUM, etc etc  (is there a list of these?)

The available properties are defined in rhythmdb.h:
http://git.gnome.org/browse/rhythmbox/tree/rhythmdb/rhythmdb.h#n150
When accessing these in python, you remove the 'RHYTHMDB_' prefix,
since they're already in the 'rhythmdb' module.
Alternatively, run 'filter(lambda x: x.startswith("PROP_"),
dir(rhythmdb))' in the python console.


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