I had some free time at work today so I decided to get a little practice with my shell scripts (I'm pretty new to the whole UNIX thing).
I'm sure I'm not the only college student here so maybe this code will come in handy for future weekends.
#!/bin/sh
if [ -z "$1" ]
then
echo "No playlist splecified"
exit 1
fi
if [ -n "$2" ]
then
echo "Too many arguments"
exit 2
fi
tracks=`osascript -e tell\ application\ \"iTunes\"\ to\ get\ number\ of\ tracks\ in\ playlist\ \"$1\"`
osascript -e tell\ application\ \"iTunes\"\ to\ play\ playlist\ \""$1"\"
for ((i=1; i<="$tracks"; i++ ))
do
echo and $i\!
osascript -e 'tell application "iTunes"
set player position to ((duration of current track)/2-30)
end tell'
sleep 60
osascript -e 'tell application "iTunes" to next track'
done
echo Now you\'re drunk\!