mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-04 20:29:09 +01:00
audio/pithos: Include pithosctl remote control script
Thanks to Phillip Warner. Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
parent
001f5e5662
commit
b699c6d90f
2 changed files with 101 additions and 1 deletions
97
audio/pithos/contrib/pithosctl
Normal file
97
audio/pithos/contrib/pithosctl
Normal file
|
@ -0,0 +1,97 @@
|
|||
#!/bin/sh
|
||||
|
||||
# pithosctl - remote control helper script for Pithos (via DBus interface)
|
||||
|
||||
# Copyright 2014 Phillip Warner <pc_warner@yahoo.com>, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
|
||||
|
||||
# Thanks goes out to Kevin Mehall for creating Pithos and providing the DBus
|
||||
# interface (/usr/lib/python2.7/site-packages/pithos/dbus_service.py)
|
||||
# Kevin's helpful post regarding this interface:
|
||||
# https://answers.launchpad.net/pithos/+question/166326
|
||||
|
||||
# Note, the DBus interface works regardless if media keys are enabled.
|
||||
# In particular, if you would normally get the message
|
||||
# "ERROR:root:Could not bind media keys" you can edit your
|
||||
# ~/.config/pithos.ini file and set "enable_mediakeys" to " False" to
|
||||
# prevent that error and still use the DBus interface successfully.
|
||||
|
||||
VERSION=0.1
|
||||
|
||||
# Control Functions
|
||||
NEXT="SkipSong"
|
||||
PLAYPAUSE="PlayPause"
|
||||
LOVE="LoveCurrentSong"
|
||||
BAN="BanCurrentSong"
|
||||
TIRED="TiredCurrentSong"
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "$(basename $0) $VERSION - by Phillip Warner"
|
||||
echo "Usage:"
|
||||
echo " $0 [OPTION]"
|
||||
echo "Only one parameter can be used at a time."
|
||||
echo "The script's parameters are:"
|
||||
echo " -h, --help Help"
|
||||
echo " -n, --next Play Next"
|
||||
echo " -p, --pause Toggle Play / Pause"
|
||||
echo " -l, --love Love Song"
|
||||
echo " -b, --ban Ban Song"
|
||||
echo " -t, --tired Tired of Song"
|
||||
echo " -q, --quit Quit Program (Send Pithos HUP)"
|
||||
echo
|
||||
echo "Current pithos PIDs (euid=$(id -u)):"
|
||||
pgrep -u $(id -u) pithos$
|
||||
}
|
||||
|
||||
# Make sure pithos is running and that there is no more than one arg
|
||||
if ! (pgrep -u $(id -u) pithos$ &> /dev/null) || [ $2 ]
|
||||
then
|
||||
usage
|
||||
elif [ $1 ]
|
||||
then
|
||||
case $1 in
|
||||
-h|--help ) usage ; exit
|
||||
;;
|
||||
-n|--next ) command=$NEXT
|
||||
;;
|
||||
-p|--pause ) command=$PLAYPAUSE
|
||||
;;
|
||||
-l|--love ) command=$LOVE
|
||||
;;
|
||||
-b|--ban ) command=$BAN
|
||||
;;
|
||||
-t|--tired ) command=$TIRED
|
||||
;;
|
||||
-q|--quit ) pkill -HUP -u $(id -u) pithos$ ; exit
|
||||
;;
|
||||
* ) usage ; exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# access DBus interface using $command
|
||||
dbus-send --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.$command &> /dev/null
|
||||
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
||||
exit
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
PRGNAM=pithos
|
||||
VERSION=${VERSION:-git_ed501485}
|
||||
BUILD=${BUILD:-1}
|
||||
BUILD=${BUILD:-2}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
|
@ -71,6 +71,9 @@ find -L . \
|
|||
|
||||
python setup.py install --root=$PKG
|
||||
|
||||
cat $CWD/contrib/pithosctl > $PKG/usr/bin/pithosctl
|
||||
chmod 0755 $PKG/usr/bin/pithosctl
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
|
|
Loading…
Reference in a new issue