Skip to content

Instantly share code, notes, and snippets.

@G10DRAS
Created August 11, 2016 00:01
Show Gist options
  • Save G10DRAS/2eb9ec63821850b19af8a241735ff599 to your computer and use it in GitHub Desktop.
Save G10DRAS/2eb9ec63821850b19af8a241735ff599 to your computer and use it in GitHub Desktop.
Python Script to Volume control MPD
import mpd
client = mpd.MPDClient()
client.timeout = None
client.idletimeout = None
client.connect('localhost', 6600)
client.listplaylists()
client.load("RADIO")
client.playlist()
client.status()['volume']
client.status()['state']
level = int(client.status()['volume']) + 10
level = max(min(level, 100), 0)
client.setvol(level)
client.status()['volume']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment