diff options
-rw-r--r-- | audio/pithos/contrib/pithosctl | 97 | ||||
-rw-r--r-- | audio/pithos/pithos.SlackBuild | 5 |
2 files changed, 101 insertions, 1 deletions
diff --git a/audio/pithos/contrib/pithosctl b/audio/pithos/contrib/pithosctl new file mode 100644 index 0000000000..7fb3e34f4e --- /dev/null +++ b/audio/pithos/contrib/pithosctl @@ -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 diff --git a/audio/pithos/pithos.SlackBuild b/audio/pithos/pithos.SlackBuild index 21bc1523dc..32579cffe5 100644 --- a/audio/pithos/pithos.SlackBuild +++ b/audio/pithos/pithos.SlackBuild @@ -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 |