Oh My MPC is a MPD client module that simply wraps the MPD protocol. OMMPC can be used to control your MPD server with python.
For no reason actually. I wanted to learn a thing or two about MPD, and I was like: "what the hell".
OMMPC is simply one module. You can install it manually or via setup.py.
$ git clone https://github.com/moyiz/ommpc.git
$ cd ommpc
$ python2 setup.py install
A simple playback toggle.
from ommpc import OMMPClient
client = OMMPClient()
client.connect()
status = client.commands.status()[0]
if status['state'] == 'play':
client.commands.pause()
else:
client.commands.play()
client.disconnect()
For more examples, look in the repository.
Watching the command list:
from ommpc import Commands
print Commands.commands_dict
Arguments for a specific command can be found using the commands_dict, or help() on the specific command. Example:
from ommpc import OMMPClient
client = OMMPClient()
help(client.commands.playlistinfo)
Or using ?
(in ipython)
from ommpc import OMMPClient
client = OMMPClient()
client.commands.playlistinfo?
0.1
BSD