Re: [Rhythmbox-devel] Access to entries of a playlist/source from a python plugin



On Wed, 2007-03-28 at 21:16 +0200, Christian wrote:
> I am developing a Rhythmbox plugin (in Python) which needs access to the
> songs in the selected playlist and in the queue (I need a list of URIs).
> 
> Looking at the code (especially of the existent plugins) I could not see
> how to do this.

In Rhythmbox the data structure that stores a "track list" is called
rhythmdb.QueryModel (which implements gtk.TreeModel). You can get it
from the source with "source.props.query_model"

If for example you want to iterate over the entries in a source, you can
do:

    for row in source.props.query_model:
        entry = row[0]
        print db.entry_get(entry, rhythmdb.PROP_TITLE)


Feel free to ask more detailed questions if you can't get what you want
to do working.


Cheers,

James "Doc" Livingston
-- 
"type in (cast) must be scalar; ANSI 3.3.4; page 39, lines 10-11
(I know you don't care, I'm just trying to annoy you)"
    -- MPW C error message



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