def get_nexid(mpd): status = mpd.status() for text in status: if text == "nextsongid": nexid = int(status.get(text)) print "Next SongID: %d" % nexid return (nexid)
def get_current_song(mpd): status = mpd.status() for text in status: if text == "volume": curvol = int(status.get(text)) print "Current Volume: %d" % curvol volume = curvol
def previous_five_songs(mpd): with mpd_lock: status = mpd.status() playlist = mpd.playlistinfo() i = int(status['nextsong']) - 5 if int(status['nextsong']) >= 5 else 0 j = i + 5 if i < int(status['playlistlength']) - 5 else int( status['playlistlength']) return map(lambda x: track_from_mpd(x), playlist[i:j])
def mpd_songs_remaining(mpd): ''' Calculates the number of songs remanining on current playlist ''' with mpd_lock: status = mpd.status() i = int(status['song']) if 'song' in status.keys() else 0 return int(status['playlistlength']) - i
def lower_volume(mpd): status = mpd.status() for text in status: if text == "volume": curvol = int(status.get(text)) print "Current Volume: %d" % curvol volume = curvol print "Decreasing Volume" while TRUE: volume = volume - 10 if volume < 0: volume = 0 mpd.setvol(volume) print "Volume ist NULL" break mpd.setvol(volume) time.sleep(1.5) return (curvol)