%
% anyremote configuration file for kscd/KDE3 management. (Server-mode)
%

% STATUS stable
% XTEST no
% SOUND app
% ENV no

GuiAppName=Kscd
GuiAppBinary=kscd
GuiAppVersion=echo 'V=`kscd -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`; if [ "x$V" == "x3" ]; then echo OK; else echo NOK; fi'|bash -f -s
GuiAppRun=echo 'A=`dcop 2> /dev/null|grep kscd`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s
GuiAppIcon=kscd.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=KsCD is a small, fast, CDDB enabled audio CD player for UNIX platforms. This configuration file is for KsCD/KDE3.

[Protocol]=Server

(Init)=Include($(CfgDir)/Utils/aliases-server.cfg);\
	Exec(echo 'V=`kscd -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`;if [ "x$V" == "x4" ]; then $(CfgDir)/Utils/message.sh "ERROR: this configuration file is for KDE3"; fi'|bash -f -s);\

(Connect)=Make(mode,kscd);

kscd_t1=ExecAndSet(title,dcop kscd CDPlayer currentTrackTitle)

[Mode]=kscd

(EnterMode)=Make(var,kscd_volume,by_value,-1);\
	Exec(echo 'A=`dcop|grep kscd`; if [ "x$A" == "x" ]; then kscd; fi'|bash -f -s);\
	Set(layout,default);\
	Set(icons,KsCD,1,vol_down,2,mute,3,vol_up,4,rewind,5,play,6,forward,7,prev,8,stop,9,next,*,question,0,default,#,no);\
	Set(menu,add,Playlist);\
	Macro(ALLIN1MENU);

Cancel=Exec(dcop kscd MainApplication-Interface quit);

Back=Set(text,close);\
	Set(menu,add,Playlist);\
	Macro(ALLIN1MENU)
Playlist=Make(mode,kscd_playlist);

1=Exec(dcop kscd CDPlayer volumeDown)
2=Make(var,kscd_volume,echo 'if [ "x$(kscd_volume)" == "x-1" ]; then dcop kscd CDPlayer getVolume; dcop kscd CDPlayer setVolume 0; else dcop kscd CDPlayer setVolume $(kscd_volume);echo "-1"; fi;'|bash -f -s)
3=Exec(dcop kscd CDPlayer volumeUp)

4=Exec(echo 'POS=`dcop kscd CDPlayer currentPosition`;NEWPOS=`expr $POS - 5000`;dcop kscd CDPlayer jumpTo $NEWPOS'|bash -f -s);
5=Exec(dcop kscd CDPlayer play);Macro(kscd_t1);Timer(kscd_t1,10,0);
6=Exec(echo 'POS=`dcop kscd CDPlayer currentPosition`;NEWPOS=`expr $POS + 5000`;dcop kscd CDPlayer jumpTo $NEWPOS'|bash -f -s);

7=Exec(dcop kscd CDPlayer previous);ExecAndSet(title,dcop kscd CDPlayer currentTrackTitle);
8=Exec(dcop kscd CDPlayer stop);Timer(kscd_t1,cancel);
9=Exec(dcop kscd CDPlayer next);ExecAndSet(title,dcop kscd CDPlayer currentTrackTitle);

* *=Set(text,replace,Help,1 - Vol-\n2 - Mute\n3 - Vol+\n4 - Rew\n5 - Play\n6 - FF\n7 - Prew\n8 - Stop\n9 - Next\n* * - Help\n# - Quit\n* # - Run/Quit)
* #=Timer(kscd_t1,cancel);Exec(echo 'P=`dcop|grep kscd`; if [ "x$P" == "x" ]; then kscd; else dcop kscd MainApplication-Interface quit; fi;' |bash -f -s)
#=Exec(dcop kscd MainApplication-Interface quit)  

[ModeEnd]

[Mode]=kscd_playlist
(EnterMode)=Set(list,font,medium);\
	Timer(kscd_t1,cancel);\
	ExecAndSet(list,replace,Playlist,dcop kscd CDPlayer trackList|sed 's/,/ /g;s/$/,/');\
	Set(menu,replace,Choose);
	
(ExitMode)=Set(list,close);\
	Macro(kscd_t1);\
	Timer(kscd_t1,10,0);

Back($$)=Make(mode,kscd);
Choose($$)=Exec(dcop kscd CDPlayer setTrack $(Index));

[ModeEnd]
[End]
