Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 43 lines (36 sloc) 893 Bytes
#!/bin/sh
#
# A script to control Pithos. This is simply a wrapper around dbus-send.
#
# Copyright 2018 Mark Lodato <lodato@google.com>
# Released under the MIT license; see LICENSE for details.
usage() {
cat >&2 <<EOF
USAGE: $0 <command>
Control Pithos via D-Bus.
Available Commands:
Control:
play
pause
play/pause
skip
EOF
exit 1
}
send_command() {
dbus-send \
--print-reply \
--dest=org.mpris.MediaPlayer2.pithos \
/org/mpris/MediaPlayer2 \
org.mpris.MediaPlayer2.Player."$1" \
|| exit $?
}
test $# -eq 1 || usage
case "$1" in
play) send_command Play ;;
pause) send_command Pause ;;
play/pause) send_command PlayPause ;;
skip) send_command Next ;;
# See https://github.com/pithos/pithos/wiki/DBus-Interfaces for more.
*) usage ;;
esac