Re: [Rhythmbox-devel] how to get a list of all sources



Thank you very much, this was the piece of information I needed :)

Christian

On Sun, 2008-01-27 at 20:40 -0200, Alexandre wrote:
> Hi,
> 
> The sourcelist_model is a Gtk.TreeModel (you can find out by using
> "print shell.props.sourcelist_model.__doc__" and checking the
> properties inherited from its parents. There are other ways to find it
> out). You can then use the Gtk documentation in:
> http://www.pygtk.org/pygtk2reference/class-gtktreemodel.html
> Or better yet, use the tutorial:
> http://www.pygtk.org/pygtk2tutorial/sec-TreeModelInterface.html
> 
> About Rhythmbox sources, the sourcelist_model is separated in groups.
> So the rows you'll get are the groups, the first one for Library and
> the second for Playlists. And the children of these rows are actual
> sources (the source object is the fourth in the row) . This code make
> it more clear:
> 
> for group in shell.props.sourcelist_model:
>     print 'Group name: ', group[2]
>     for source in group.iterchildren():
>         for props in source:
>             print props
> 
> There are other ways to access this information, using the
> sourcelist_model directly, instead of iterating, it all depends on
> what you want to do.
> 
> I hope this helped, having more questions, just ask.
> 
> On Jan 27, 2008 7:19 PM, Christian Bünnig <masala web de> wrote:
>         Hey,
>         
>         I am writing an RB plugin in Python and want to get a list of
>         all
>         playlists/sources .. but I have no idea how to do this. I
>         tried to get
>         them via the source list model (shell.props.sourcelist_model)
>         but it is
>         not obvious how to proceed from this point .. any ideas?
>         
>         I know I could use the file returned by
>         shell.props.playlist_manager.props.playlists_file
>         but the returned file only contains playlists, not the store,
>         radio or
>         other library sources. Also I do not like the idea to parse an
>         xml file
>         if I can talk with RB directly.
>         
>         Thanks in advance for some help!
>         
>         Christian
>         
>         _______________________________________________
>         rhythmbox-devel mailing list
>         rhythmbox-devel gnome org
>         http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
> 
> 
> 
> -- 
> Alexandre Rosenfeld 
> 
> -----------------------------------
> EC06 - USP São Carlos
> ----------------------------------- 
> _______________________________________________
> rhythmbox-devel mailing list
> rhythmbox-devel gnome org
> http://mail.gnome.org/mailman/listinfo/rhythmbox-devel



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