%
% anyremote configuration file for kscd management. (Server-mode Bemused emulation)
% Prerequisites: Bemused client installed on cell phone
%

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

GuiAppName=Kscd
GuiAppBinary=kscd
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=Bemused
GuiAppDesc=KsCD is a small, fast, CDDB enabled audio CD player for UNIX platforms. This configuration file is for KsCD/KDE3.
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

[Protocol]=Bemused

(Init)=Include($(CfgDir)/Utils/aliases-bemused.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)=Exec(kscd)

EXIT=Exec(dcop kscd MainApplication-Interface quit()  
FADE=Exec(dcop kscd CDPlayer setVolume 0 > /dev/null) 
FFWD=Exec(echo 'POS=`dcop kscd CDPlayer currentPosition`;NEWPOS=`expr $POS + 5000`;dcop kscd CDPlayer jumpTo $NEWPOS' | bash -f -s) 
INF2=Send(string,INF2ACK);Send(bytes,128,0,0,0,128,0,0,0,1,0,0);ExecAndSend(string,dcop kscd CDPlayer currentTrackTitle);Send(bytes,0,0)
INFO=Send(string,INFOACK);Send(bytes,128,0,0,0,128,0,0,0,1,0,0);ExecAndSend(string,dcop kscd CDPlayer currentTrackTitle)
NEXT=Exec(dcop kscd CDPlayer next) 
PLAY=Exec(dcop kscd CDPlayer play) 
PREV=Exec(dcop kscd CDPlayer previous) 
RWND=Exec(echo 'POS=`dcop kscd CDPlayer currentPosition`;NEWPOS=`expr $POS - 5000`;dcop kscd CDPlayer jumpTo $NEWPOS' | bash -f -s) 
STOP=Exec(dcop kscd CDPlayer stop) 
VOLM($$)=Exec(dcop kscd CDPlayer setVolume $(Param) > /dev/null)
REPT=Exec(dcop kscd CDPlayer toggleLoop)
SHFL=Exec(dcop kscd CDPlayer toggleShuffle)

%GVOL=Send(string,GVOLNAK)
GVOL=Send(string,GVOLACK);Make(var,ks_volume,echo 'V=`dcop kscd CDPlayer getVolume`;echo "$V*255/100"|bc'|bash -f -s);Send(bytes,$(ks_volume))

PLEN=ExecAndSend(bytes,dcop kscd CDPlayer trackList|wc -l|awk '{if($0>255) {b=int($0/256);a=$0-b;} else {b=$0;a=0};s=sprintf("%s,%s",a,b);print s;}');
PLST=Send(string,PLSTACK);\
	ExecAndSend(bytes,dcop kscd CDPlayer currentTrack|awk '{if($0>255) {b=int($0/256);a=$0-b;} else {b=$0;a=0};s=sprintf("%s,%s",a,b);print s;}');\
	ExecAndSend(string,dcop kscd CDPlayer trackList);\
	Send(bytes,0);
SLCT($$)=Exec(dcop kscd CDPlayer setTrack `echo "$(Param)+1"|bc`);

%PAUS= 

% The following is a trick. Replays are not real, just to satisfy client.
CHCK=Send(string,Y);
DINF=Send(string,DINFACK);Send(bytes,0,0,0,244,0,0,32,0,0,0,0,2);
DLST=Send(bytes,255,0)
DOWN=Send(bytes,0,100);Send(string,NoName)
FINF=Send(string,FINFACK);Send(bytes,0,0,0,100);
LIST=Send(bytes,255,0)
%SEEK=
VERS=Send(string,VERSACK);Send(bytes,1,73);
[End]
