commit
d344b3b177
@ -36,6 +36,24 @@ Emulates ``mpc toggle``.
|
|||||||
next``.
|
next``.
|
||||||
* ``previous_song`` — Goes to previous track in the playlist. Emulates \
|
* ``previous_song`` — Goes to previous track in the playlist. Emulates \
|
||||||
``mpc prev``.
|
``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"])
|
||||||
|
|
||||||
|
Note that ``next_song`` and ``previous_song``, and their ``mpd_command`` \
|
||||||
|
equivalents, are ignored while mpd is stopped.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
interval = 1
|
interval = 1
|
||||||
@ -166,7 +184,7 @@ cleartext to the server.)"),
|
|||||||
try:
|
try:
|
||||||
self._mpd_command(self.s, "play"
|
self._mpd_command(self.s, "play"
|
||||||
if self._mpd_command(self.s, "status")["state"]
|
if self._mpd_command(self.s, "status")["state"]
|
||||||
in ["pause", "stop"] else "pause")
|
in ["pause", "stop"] else "pause 1")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -187,3 +205,9 @@ cleartext to the server.)"),
|
|||||||
self._mpd_command(self.s, "previous")
|
self._mpd_command(self.s, "previous")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def mpd_command(self, command):
|
||||||
|
try:
|
||||||
|
self._mpd_command(self.s, command)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user