amarok und kopete awaymessage

Also, da mir Gaim vor einiger Zeit meine halbe kontaktliste gelösch hat ohne dass ich gleube etwas getan zu haben habe ich nach alternativen gesucht. Da ich nichts gefunden hab was mich wirklich überzeugt hat und ich den ganzen KDE-Krams eh schon für amaroK (das mich überzeugt hat) auf dem rechner hatte habe ich mir dann auchmal kopete angeguckt und muss sagen, dass es garnicht so schlimm ist wie ich es mir vorgestellt habe =)
Dann habe ich als altes Spielkind nach so unnützen sachen wie np-scripts gegoogled und dann nen teil gefunden, das ich für eine ebenso unnütze wie nette idee halte: der np in der awaymessage. Jedenfalls habe ich mir das mal angeguckt und hab dann nen bisschen damit rumgespielt... Am Ende ist ein in meinen augen ganz nettes script entstanden, dass ich dann gerne anderen zur verfügung stelle, da ich ohne es zu merken doch einige zeit damit verbracht habe es zusammenzubasteln. Jedenfalls kann ich jetzt aus meinem kopete chatfenster recfht schnell mein amarok bedienen und natürlich wird ein haufen nutzloses zeugs in die awaymessage geschrieben XD

Die Funktionen:

skip/next springt zum nächsten track
play/pause pausiert/startet die wiedergabe
prev springt zum vorigen track
mute stellt stumm
osd zeigt das OSD
- verringert die lautstärke um denin amarok eingestellten wert
+ erhöht die lautstärke um denin amarok eingestellten wert
vol/volume X setzt die lautstärke auf X%
alles andere - zeigt die np: info an

Code:
 #!/bin/sh
curtime=`dcop amarok player trackCurrentTime`
tottime=`dcop amarok player trackTotalTime`
curtitle=`dcop amarok player nowPlaying`
curvolume=`dcop amarok player getVolume`
curscore=`dcop amarok player score`
curcounter=`dcop amarok player trackPlayCounter`
curalbum=`dcop amarok player album`
curbitrate=`dcop amarok player bitrate`

param=$1
param2=$2
case "$param" in
	skip)
		dcop amarok player next
		echo "Skipping track..."
		curtime=`dcop amarok player trackCurrentTime`
		tottime=`dcop amarok player trackTotalTime`
		curtitle=`dcop amarok player nowPlaying`
		curvolume=`dcop amarok player getVolume`
		curscore=`dcop amarok player score`
		curcounter=`dcop amarok player trackPlayCounter`
		curalbum=`dcop amarok player album`
		curbitrate=`dcop amarok player bitrate`
	;;
	next)
		dcop amarok player next
		echo "Skipping track..."
		curtime=`dcop amarok player trackCurrentTime`
		tottime=`dcop amarok player trackTotalTime`
		curtitle=`dcop amarok player nowPlaying`
		curvolume=`dcop amarok player getVolume`
		curscore=`dcop amarok player score`
		curcounter=`dcop amarok player trackPlayCounter`
		curalbum=`dcop amarok player album`
		curbitrate=`dcop amarok player bitrate`
	;;
	play)
		dcop amarok player playPause
		echo "Play/Pause"
	;;
	pause)
		dcop amarok player playPause
		echo"Play/Pause"
	;;
	prev)
		dcop amarok player prev
		"One step back..."
		curtime=`dcop amarok player trackCurrentTime`
		tottime=`dcop amarok player trackTotalTime`
		curtitle=`dcop amarok player nowPlaying`
		curvolume=`dcop amarok player getVolume`
		curscore=`dcop amarok player score`
		curcounter=`dcop amarok player trackPlayCounter`
		curalbum=`dcop amarok player album`
		curbitrate=`dcop amarok player bitrate`
	;;
	mute)
		dcop amarok player mute
		echo "Mute/Unmute"
	;;
	osd)
		dcop amarok player showOSD
	;;
	-)
		dcop amarok player volumeDown
		curvolume=`dcop amarok player getVolume`
		echo "Volume reduced to:$curvolume%"
	;;
	+)
		dcop amarok player volumeUp
		curvolume=`dcop amarok player getVolume`
		echo "Volume increased to:$curvolume%"
	;;
	volume)
		dcop amarok player setVolume $param2
		curvolume=`dcop amarok player getVolume`
		echo "Volume set to:$curvolume%"
	;;
	vol)
		dcop amarok player setVolume $param2
		curvolume=`dcop amarok player getVolume`
		echo "Volume set to:$curvolume%"
	;;
	*)
	echo "set status to: \"np: $curtitle from the album $curalbum ($curmin:$cursec/$totmin:$totsec) Volume:$curvolume%, current rating:$curscore, track played allready $curcounter times @ $curbitrate kb/s\""
	;;
esac


curmin="$(($curtime/60))"
cursec="$(($curtime%60))"
totmin="$(($tottime/60))"
totsec="$(($tottime%60))"

if [ $curmin -lt 10 ]
then
	curmin=`echo "0$curmin"`
fi

if [ $cursec -lt 10 ]
then
	cursec=`echo "0$cursec"`
fi

if [ $totmin -lt 10 ]
then
	totmin=`echo "0$totmin"`
fi

if [ $totsec -lt 10 ]
then
	totsec=`echo "0$totsec"`
fi

dcop kopete KopeteIface setAway "np: $curtitle from the album $curalbum ($curmin:$cursec/$totmin:$totsec) Volume:$curvolume%, current rating:$curscore, track played allready $curcounter times @ $curbitrate kb/s"

das ganze packt man n eine datei namens a, macht es ausführbar und packt es in einen ordner der in $PATH steht. In Kopete kann man jetzt

/exec watch -n20 a > /dev/null

machen, das aktualisiert die awaymessage alle 20 sekunden. Alle anderen befehle kann man mit /exec a <befehl> ausführen, also z.B.

/exec a pause
/exec a vol 50

usw.

So, denn noch nen schönen abend, macht mich auf gravierende fehler aufmerksam, wenn noch jemand gefallen an dem teil findet freut es mich, schönen abend noch...
 
Zurück
Oben