示例#1
0
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)
示例#2
0
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
示例#3
0
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])
示例#4
0
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
示例#5
0
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)