Ejemplo n.º 1
0
class RhythmboxSource(AppLeafContentMixin, Source):
    appleaf_content_id = "rhythmbox"

    def __init__(self):
        Source.__init__(self, _("Rhythmbox"))

    def get_items(self):
        # first try to load songs via dbus
        songs = list(_get_all_songs_via_dbus())
        if not songs:
            try:
                dbfile = config.get_data_file("rhythmdb.xml", "rhythmbox")
                songs = rhythmbox_support.get_rhythmbox_songs(dbfile=dbfile)
            except StandardError, e:
                self.output_error(e)
                songs = []
        albums = rhythmbox_support.parse_rhythmbox_albums(songs)
        artists = rhythmbox_support.parse_rhythmbox_artists(songs)
        yield Play()
        yield Pause()
        yield Next()
        yield Previous()
        yield ClearQueue()
        yield ShowPlaying()
        artist_source = RhythmboxArtistsSource(artists)
        album_source = RhythmboxAlbumsSource(albums)
        songs_source = RhythmboxSongsSource(artists)
        yield SourceLeaf(artist_source)
        yield SourceLeaf(album_source)
        yield SourceLeaf(songs_source)
        # we use get_leaves here to get sorting etc right
        if __kupfer_settings__["toplevel_artists"]:
            for leaf in artist_source.get_leaves():
                yield leaf
        if __kupfer_settings__["toplevel_albums"]:
            for leaf in album_source.get_leaves():
                yield leaf
        if __kupfer_settings__["toplevel_songs"]:
            for leaf in songs_source.get_leaves():
                yield leaf
Ejemplo n.º 2
0
 def get_items(self):
     # first try to load songs via dbus
     songs = list(_get_all_songs_via_dbus())
     albums = rhythmbox_support.parse_rhythmbox_albums(songs)
     artists = rhythmbox_support.parse_rhythmbox_artists(songs)
     yield ClearQueue()
     artist_source = RhythmboxArtistsSource(artists)
     album_source = RhythmboxAlbumsSource(albums)
     songs_source = RhythmboxSongsSource(artists)
     yield SourceLeaf(artist_source)
     yield SourceLeaf(album_source)
     yield SourceLeaf(songs_source)
     # we use get_leaves here to get sorting etc right
     if __kupfer_settings__["toplevel_artists"]:
         for leaf in artist_source.get_leaves():
             yield leaf
     if __kupfer_settings__["toplevel_albums"]:
         for leaf in album_source.get_leaves():
             yield leaf
     if __kupfer_settings__["toplevel_songs"]:
         for leaf in songs_source.get_leaves():
             yield leaf
Ejemplo n.º 3
0
 def get_items(self):
     # first try to load songs via dbus
     songs = list(_get_all_songs_via_dbus())
     self._songs = songs = songs or self._songs
     albums = rhythmbox_support.parse_rhythmbox_albums(songs)
     artists = rhythmbox_support.parse_rhythmbox_artists(songs)
     yield ClearQueue()
     artist_source = RhythmboxArtistsSource(artists)
     album_source = RhythmboxAlbumsSource(albums)
     songs_source = RhythmboxSongsSource(artists)
     yield SourceLeaf(artist_source)
     yield SourceLeaf(album_source)
     yield SourceLeaf(songs_source)
     # we use get_leaves here to get sorting etc right
     if __kupfer_settings__["toplevel_artists"]:
         for leaf in artist_source.get_leaves():
             yield leaf
     if __kupfer_settings__["toplevel_albums"]:
         for leaf in album_source.get_leaves():
             yield leaf
     if __kupfer_settings__["toplevel_songs"]:
         for leaf in songs_source.get_leaves():
             yield leaf