Shell skrip dipakai tampilkan lagu yang lagi diputar di Amarok jadi message status Pidgin.
#!/bin/bash
# pidgin-amarok-status v0.1
# License: GPL version 2
# script by yoen (jendral_hxr[at]eml.cc),
# based on code by Cory Burgett (Groovebot),
# which is based on AppleGrew's,
# which is based form http://gentoo-wiki.com/TIP_Gaim_Autoprofile_plugin
# adjust the timer
sleep_time=30
# Some ornamentation :)
leader='♫'
trailer='♪'
# checking if pidgin is alive or not (for initializing)
if `pgrep -x pidgin >/dev/null`
then
echo "Pidgin already running"
else
pidgin &
fi
while [ 1 ]; do
# checking the original IM's status message
currstatus_msg=`purple-remote getstatusmessage`
# checking whether Amarok is alive and playing
if `dcop | grep amarok > /dev/null` && [ `dcop amarok player isPlaying` == "true" ];
then
player_artist=`dcop amarok player artist`
player_song=`dcop amarok player title`
player_msg="$player_artist - $player_song"
fi
# change the status only if status is either avail or away
if [ "`purple-remote getstatus`" == "available" ] || [ "`purple-remote getstatus`" == "away" ]; then
#shape the message just as you like, I like to cat it with my IM status message
purple-remote "setstatus?status=available&message=$currstatus_msg $leader$player_msg$trailer"
sleep $sleep_time
fi
#change to original message so it won't change
purple-remote "setstatus?status=available&message=$currstatus_msg"
# checking wheter both pidgin and amarok are still alive or not (for quitting)
if ! `pgrep -x pidgin >/dev/null` && ! `dcop | grep amarok > /dev/null`
then
exit 0
fi
done
Proyek selanjutnya: tulis skrip serupa buat Exaile.
0 rants:
Posting Komentar