Implement and document mpd_command method.

This commit is contained in:
ncoop 2016-12-28 01:15:13 -08:00
parent 7fb73bb9c0
commit 713c93c3ff

View File

@ -36,6 +36,21 @@ Emulates ``mpc toggle``.
next``.
* ``previous_song`` Goes to previous track in the playlist. Emulates \
``mpc prev``.
* ``mpd_command`` Send a command directly to MPD's socket. The command \
is the second element of the list. Documentation for available commands can \
be found at https://www.musicpd.org/doc/protocol/command_reference.html
Example module registration with callbacks:
::
status.register("mpd",
on_leftclick="switch_playpause",
on_rightclick=["mpd_command", "stop"],
on_middleclick=["mpd_command", "shuffle"],
on_upscroll=["mpd_command", "seekcur -10"],
on_downscroll=["mpd_command", "seekcur +10"])
"""
interval = 1
@ -187,3 +202,9 @@ cleartext to the server.)"),
self._mpd_command(self.s, "previous")
except Exception as e:
pass
def mpd_command(self, command):
try:
self._mpd_command(self.s, command)
except Exception as e:
pass