Amarok-Now-Playing for Kopete

I got fed up with the downloadable plugins that post on Kopete what Amarok is currently playing. So I wrote my own that uses dbus (The upgrade of DCOP) to do the postings. Uses Amarok 1.4 and Kopete 0.70.2. The Script can also work with Pidgin (look at the commented out sections for more detail). I am/was working on that until my pidgin started misbehaving. Pidgin gets called via the purple-remote interface. Improve it and share. *DISCLAIMER: This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.* Regards, Arthur

For the sake of them that cannot download the script, here it goes in plain text format: ##BEGIN #!/bin/bash #=================================================================================== # # FILE: amarok_now_playing # # USAGE: amarok_now_playing [ > logfile] # # DESCRIPTION: Changes your status message in pidgin and/or # Kopete to the song you are currently listening to in Amarok. # # OPTIONS: see function ’usage’ below # REQUIREMENTS: --- Amarok 1.4.10, purple-remote, Pidgin 2.5.2 or Kopete 0.70.2 # BUGS: --- # NOTES: --- # AUTHOR: Arthur Buliva, arthurbuliva@gmail.com # COMPANY: Mobile Planet Limited # VERSION: 1.0 # CREATED: 26.05.2009 - 16:17:51 # REVISION: 26.05.2009 #=================================================================================== STARTUP="dcop amarok player version" ALLOWED_AMAROK_VERSION="1.4" ALLOWED_KOPETE_VERSION="0.70" PIDGIN="`kopete --version`" #Test for Amarok a=`$STARTUP` if [[ "$a" =~ "${ALLOWED_AMAROK_VERSION}" ]] then echo "Amarok $a [ OK ] " else echo " [ FAILED ] Make sure that you are running Amarok 1.4 `date +%b-%d-%Y\ %T` " exit; fi #Test for Kopete if [[ "$PIDGIN" =~ "${ALLOWED_KOPETE_VERSION}" ]] then echo "Kopete $PIDGIN [ OK ] " else echo "SEVERE: This script has been tested on Kopete 0.70 only `date +%b-%d-%Y\ %T` " exit fi updateStatus() { if [[ "`$STARTUP`" != "" ]] then SONG_TITLE="dcop amarok player title" ARTIST="dcop amarok player artist" KOPETE_STATUS='qdbus org.kde.kopete /Kopete' if [[ "`$KOPETE_STATUS`" == "" ]] then echo "SEVERE: Kopete is not running. This script will terminate `date +%b-%d-%Y\ %T` " exit fi if [[ "`$SONG_TITLE`" != "" ]] then TITLE="♫ `$SONG_TITLE` by `$ARTIST`"; echo "INFO: Now listening to ♫ `$SONG_TITLE` by `$ARTIST` `date +%b-%d-%Y`"; #Pidgin #`/usr/bin/purple-remote "setstatus?status=available&message=$TITLE"` #Kopete qdbus org.kde.kopete /Kopete org.kde.Kopete.setIdentityOnlineStatus "Online" "$TITLE" sleep 5; updateStatus else echo "INFO: Amarok is quiet `date +%b-%d-%Y`"; TITLE="Amarok is quiet"; #Pidgin #`/usr/bin/purple-remote "setstatus?status=available&message=$TITLE"` #Kopete qdbus org.kde.kopete /Kopete org.kde.Kopete.setIdentityOnlineStatus "Online" "$TITLE" sleep 5; updateStatus fi else echo "SEVERE: Could not connect to DCOP Server `date +%b-%d-%Y` " exit fi } updateStatus ##END

Great work Arthur .. now for a workaround of pidgin and rhythm-box ;) -- Δαβίδ Dan Quayle <http://www.brainyquote.com/quotes/authors/d/dan_quayle.html> - "This President is going to lead us out of this recovery."
participants (2)
-
Arthur Buliva
-
David Njuki