Wednesday, July 19, 2006

Alarm script fixed!

I've been having problems with the alarm script. Specifically, it doesn't work. Sometimes amarok simply doesn't start playing. Sometimes amarok crashes. Well, I fixed the script to check and see if things were playing at the end. If amarok isn't running or isn't playing, then it goes back and tries to get it going again! Here's the script:

DISPLAY=:0.0
export DISPLAY
killall -9 skype
echo "It's time to wake Kyle up..."
echo "Enabling Randomness..."
dcop amarok player enableRandomMode true
echo "Clearing the previous playlist..."
dcop amarok playlist clearPlaylist
echo "Stopping amaroK..."
dcop amarok player stop
echo "Loading the Awaken playlist..."
dcop amarok playlist addMedia file:///home/paithan/.kde/share/apps/amarok/playlists/Awaken.m3u
echo "Setting volumes..."
aumix -v 32
dcop amarok player setVolume 68
while [ "$(dcop amarok player isPlaying)" != "true" ]
do
if [ "$(dcop amarok player isPlaying)" != "false" ]
then
echo "amaroK appears to not be running! Let's start it!"
amarok
fi
echo "AmaroK will play in 3..."
sleep 1
echo "2..."
sleep 1
echo "1..."
sleep 1
echo "Now."
dcop amarok player play
sleep 5
if [ "$(dcop amarok player isPlaying)" = "false" -o "$(dcop amarok player isPlaying)" = "call failed" ]
then
echo "Playing failed! Trying again..."
fi
done
echo "Here's the weather"
firefox http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Boston%2C+MA

This should work just perfectly now!

0 Comments:

Post a Comment

<< Home