Beispiel #1
0
    def addNextSong(self):
        if self.currentStation is None:
            returnValue("No current station; nothing to add. ")

        status = ""
        if not self.upcomingSongs:
            msg = "Getting more songs from pandora. "
            logging.info(msg)
            status += msg
            more = yield deferredCallWithReconnects(self.pandora, self.currentStation.get_playlist)
            self.upcomingSongs.extend(more)
            status += "Now we have %s. " % len(self.upcomingSongs)

        song = self.upcomingSongs.pop(0)
        self.playedSongs.append(song)
        status += "Adding a pandora song to mpd. "
        logging.info("Adding to mpd: %s %s" % (song.title, song.audioUrl))
        yield self.addStream(song.audioUrl, song.album, song.title)
        returnValue(status)
Beispiel #2
0
 def pandoraCall(self, method, *args):
     m = getattr(self.pandora(), method)
     return deferredCallWithReconnects(self.pandora(), m, *args)