Accessing Playlist Data

Gayan Weerakutti <[email protected]> Mon, 25 Apr 2016 17:29:34 +0000
Newsgroups gmane.comp.gnome.apps.rhythmbox.devel
Message-ID <1544e7819c3.1021b5a7a37934.2080766775366955423@linuxdeveloper.space>
--===============6144283856082343421==
Content-Type: multipart/alternative; 
	boundary="----=_Part_112139_1823524781.1461605374406"

------=_Part_112139_1823524781.1461605374406
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit



Hi there, 

I'm writing a plugin that enable users to export music files of the selected playlist which is quite similar to the sendto plugin but let you save files directly to the disk.

But I can't find a way to get a reference to the currently selected playlist item.

I did get the reference to the playlist header item as:

display_page_model = shell.props.display_page_model.props.child_model

playlist = [x for x in display_page_model if x[1].props.id == "playlists"][0]

        playlist_iter = playlist.iterchildren()

        for i in playlist_iter:

            playlist_source = i[1]

Here I see AutoPlaylistSource, StaticPlaylistSource objects which seems to be not iterable. I think I'd need to get an array of playback URIs of songs in the selected playlist.

I'm quite new to Gtk and think this as an great opportunity for me learn and contribute. Any help is highly appreciated!

Code: https://github.com/reversiblean/export-playlist/blob/master/export-playlist.py

Thanks,

Gayan








------=_Part_112139_1823524781.1461605374406
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style='font-size:10pt;font-family:Verdana,Arial,Helvetica,sans-serif;'><p><br></p><div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;"><p>Hi there, <br></p><div>I'm
 writing a plugin that enable users to export music files of the 
selected playlist which is quite similar to the sendto plugin but let 
you save files directly to the disk.<br></div><p>But I can't find a way to get a reference to the currently selected playlist item.<br></p><p>I did get the reference to the playlist header item as:<br></p><p>display_page_model = shell.props.display_page_model.props.child_model<br></p><div>playlist = [x for x in display_page_model if x[1].props.id == "playlists"][0]<br></div><div>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;playlist_iter = playlist.iterchildren()<br></div><div>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for i in playlist_iter:<br></div><div>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;playlist_source = i[1]<br></div><p>Here
 I see AutoPlaylistSource, StaticPlaylistSource objects which seems to 
be not iterable. I think I'd need to get an array of playback URIs of 
songs in the selected playlist.<br></p><p>I'm quite new to Gtk and think this as an great opportunity for me learn and contribute. Any help is highly appreciated!<br></p><p>Code: <a title="Ctrl+Click or tap to follow the link" id="LPlnk117690" href="https://github.com/reversiblean/export-playlist/blob/master/export-playlist.py">https://github.com/reversiblean/export-playlist/blob/master/export-playlist.py</a><br></p><p>Thanks,<br></p><p>Gayan<br></p></div><p><br></p><div><br></div></div></body></html>
------=_Part_112139_1823524781.1461605374406--


--===============6144283856082343421==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
rhythmbox-devel mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/rhythmbox-devel

--===============6144283856082343421==--