Skip to content

Instantly share code, notes, and snippets.

@dromer
Created June 11, 2014 17:19
Show Gist options
  • Save dromer/ed7b9375494daf401723 to your computer and use it in GitHub Desktop.
Save dromer/ed7b9375494daf401723 to your computer and use it in GitHub Desktop.
fix to display filename if tags are missing
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