All pastes #139853 Raw Edit

Unnamed

public text v1 · immutable
#139853 ·published 2006-08-20 04:26 UTC
rendered paste body
#!/bin/sh
#
# cmus-status-display
#
# Usage:
#   in cmus command ":set status_display_program=cmus-status-display"
#
# This scripts is executed by cmus when status changes:
#   cmus-status-display key1 val1 key2 val2 ...
#
# All keys contain only chars a-z. Values are UTF-8 strings.
#
# Keys: status file url artist album discnumber tracknumber title date
#   - status (stopped, playing, paused) is always given
#   - file or url is given only if track is 'loaded' in cmus
#   - other keys/values are given only if they are available
#  

output()
{
# Assign the currently playing song to a string
#CURRTRACK="$_artist - $_title"
#CURRARTIST="$_artist"
#CURRTITLE="$_title"
#echo $CURRTRACK > /tmp/currtrack
#echo $CURRARTIST > /tmp/currartist
#echo $CURRTITLE > /tmp/currtitle

# write status to /tmp/cmus-currsong (not very useful though)
         echo "$*" > /tmp/cmus-currsong 2>&1
#        cat /media/hda1/Program\ Files/EvilLyrics/lyrics/'$artist - $title'.txt > /tmp/currlyrics
#         cat /media/hda1/Program\ Files/EvilLyrics/lyrics/"$(cat /tmp/currtrack)".txt > /tmp/currlyrics
#         xterm -e nano /tmp/currlyrics

}

# WMI (http://wmi.modprobe.de/)
#wmiremote -t "$*" &> /dev/null


while test $# -ge 2 
#while $_status != stopped
do
	eval _$1='$2'
	shift
	shift
done

case $_status in
        stopped)
                statuss="."
                echo "Stopped" > /tmp/cmus-status
        ;;
        playing)
                statuss=">"
                echo "Playing" > /tmp/cmus-status
        ;;
        paused)
                statuss="|"
                echo "Paused" > /tmp/cmus-status
        ;;
esac

empty=''

if [ "$statuss" = "." ]
then
        output " Giving Rod a rest; Get your stalking fix elsewhere, kthx. :)"
elif [ "$statuss" = "|" ]
then
        output " '$_title' by $_artist (Paused)"
elif [ $_artist = $empty ]
then
        output "$_file"
elif test -n "$_file"
then
	output " '$_title' by $_artist"
elif test -n "$_url"
then
	output "[$_status] $_url - $_title"
fi