Image 01
profile-image

pisani

Ryan Pisani
amazstream

Amarok 1.x Scripts by bettercom 1 comment

Hello --
I thought I'd post a few modifications to your script that I found helpful. First off, I had to change the bash path as /usr/local/bin doesn't exist in my distro. Anyhow, I added in another "dirty" method for pause/resume by suspending the icecast server and continuing it on "playing" status change. I also added in a quick check that firesoff the icecast and ezstream processes. The paths for configuration may need to change based on the user's configuration. I don't believe the kill of the ezstream or icecast are working at this moment. I think a trap needs to be added to catch the kill signal from amarok so that i cleans up.

#!/bin/bash

if !(ps -ef | grep -q icecast | grep -v grep); then

/usr/bin/icecast -c /etc/icecast.xml &

fi

if !(ps -ef | grep -q ezstream | grep -v grep); then

/usr/bin/ezstream -c ~/ezstream/amazstream.xml &

fi
ICEPID=$(/sbin/pidof icecast)
EZPID=$(/sbin/pidof ezstream)

while read stdin; do
if [ "${stdin}" == "trackChange" ]; then
dcop amarok player path > ~/ezstream/amazstream.txt
killall -USR1 ezstream 2 > /dev/null
sleep 1
elif [ "${stdin}" == "engineStateChange: paused" ]; then

kill -19 $ICEPID

elif [ "${stdin}" == "engineStateChange: playing" ]; then

kill -18 $ICEPID

fi

done <&0

kill $EZPID $ICEPID
- Jun 16 2008