#!/bin/sh -e #teK sucks hard # author..: Thomas 'teK' Penteker [2005/2007] # comment.: usable for # mp3blaster ( use -f ${npfile} ) # xmms ( song_change Plugin: action: echo "%s" > "${npfile}", # the output format can be changed, but leave the defaults # for this script. Activate the Plugin. # cmus (no changes needed) # # output format is: ``np: $Artist - $Title'' # if there are any bugs / problems, don't shoot the messenger. # NOTE: mp3blaster puts filename as current title if no ID3 Tag was # found. np.sh will return ' - ' in this case! # point to the status file npfile=${HOME}/.nowplaying if pgrep -u ${LOGNAME} cmus 1>/dev/null;then if [ -s ${TMP}/cmus-status ];then if [[ $1 != '-m' ]];then cat ${TMP}/cmus-status else sed -e 's/^np: //1' ${TMP}/cmus-status fi exit 0 else echo '${TMP}/cmus-status unavailable.' exit 1 fi fi if pgrep -u ${LOGNAME} xmms 1>/dev/null;then if [ -s ${npfile} ];then if [[ $1 != '-m' ]];then echo -n "np: " fi head -n 1 ${npfile} exit 0 else echo '${npfile} unavailable.' exit 1 fi fi if pgrep -u ${LOGNAME} mp3blaster 1>/dev/null;then if [ -s ${npfile} ];then if [[ $1 != '-m' ]];then echo -n `sed -n -e '/artist/ s/artist//gp' ${npfile}` else echo -n `sed -n -e '/artist/ s/artist//gp' -e 's/^np: //1' ${npfile}` fi echo \ \- `sed -n -e '/title/ s/title//gp' ${npfile} | sed -e 's/ *-*[0-9][0-9] *-*//g'` exit 0 else echo '${npfile} unavailable.' exit 1 fi fi