Created
June 11, 2014 17:19
-
-
Save dromer/ed7b9375494daf401723 to your computer and use it in GitHub Desktop.
fix to display filename if tags are missing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ((mpdcommand == 'playing') or (mpdcommand == 'state')) : | |
currentsong = client.currentsong() | |
currentstatus = client.status() | |
if 'artist' in currentsong and 'title' in currentsong: | |
nowplaying = currentsong['artist'] + ' - ' + currentsong['title'] | |
elif 'artist' in currentsong: | |
nowplaying = currentsong['artist'] | |
elif 'title' in currentsong: | |
nowplaying = currentsong['title'] | |
else: | |
nowplaying = currentsong['file'] | |
if currentstatus['state'] == 'play': | |
bot.say('Now playing: ' + nowplaying) | |
elif currentstatus['state'] == 'pause': | |
bot.say('Music is currently paused (' + nowplaying + ')') | |
elif currentstatus['state'] == 'stop': | |
bot.say('No music is playing') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment