%
% anyremote configuration file for xmms management. (Server-mode Bemused emulation)
% prerequisites: xmms, Bemused client installed on cell phone
% tested with Jam SE 1.3 RC1
%

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

GuiAppName=Xmms
GuiAppBinary=xmms
GuiAppRun=echo 'P=`ps -ef|grep xmms|grep -v xmms2|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" == "x" ]; then echo NOK; else echo OK; fi' | bash -f -s
GuiAppIcon=xmms.png
GuiAppType=Application
GuiAppProtocols=Bemused
GuiAppDesc=XMMS is a multimedia player for unix systems. XMMS stands for X MultiMedia System and can play media files such as MP3, MOD's, WAV and others with the use of Input plugins.

[Protocol]=Bemused

(Init)=Include($(CfgDir)/Utils/aliases-bemused.cfg);\
	Exec(echo 'P=`which xmmsctrl|grep xmmsctrl|grep -v no|wc -l|tr -d " "`; if [ "x$P" == "x1" ]; then true; else kdialog --msgbox "ERROR: xmmsctrl package is not installed"; fi'|bash -f -s);
(Connect)=Exec(sh -c "if xmmsctrl running;then true;else xmmsctrl launch; fi")

EXIT=Exec(xmmsctrl quit)
FADE=Exec(xmmsctrl vol 0)
FFWD=Exec(xmmsctrl time +10)
INF2=Send(string,INF2ACK);Send(bytes,128,0,0,0,128,0,0,0,1,0,0);ExecAndSend(string,basename "`xmmsctrl cur`");Send(bytes,0,0)
INFO=Send(string,INFOACK);Send(bytes,128,0,0,0,128,0,0,0,1,0,0);ExecAndSend(string,basename "`xmmsctrl cur`")
NEXT=Exec(xmmsctrl next)
PAUS=Exec(xmmsctrl pause)
PLAY=Exec(sh -c "if xmmsctrl playing;then xmmsctrl stop;else xmmsctrl play; fi")
PREV=Exec(xmmsctrl prev)
REPT=Exec(xmmsctrl repeat)
RWND=Exec(xmmsctrl time -10)
SHFL=Exec(xmmsctrl shuffle)
STOP=Exec(xmmsctrl stop)
VOLM($$)=Exec(xmmsctrl vol $(Param));

GVOL=Send(string,GVOLACK);Make(var,xm_volume,echo 'V=`xmmsctrl print "%v"`;echo "$V*255/100"|bc'|bash -f -s);Send(bytes,$(xm_volume))
%GVOL=Send(string,GVOLNAK)

PLEN=ExecAndSend(bytes,xmmsctrl print "%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,xmmsctrl print "%P"|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,xmmsctrl playlist|tr -d ','|tr -s ' '|tr -s '\t'|cut -f2,3,4,5,6,7 -d ' '|sed 's/%20/ /g;s/(/-/g;s/)/-/g');\
	Send(bytes,0);

%ExecAndSend(string,xmmsctrl playfiles|tr -d '\t'|xargs -i basename {}|sed 's/^/-\n/');

SLCT($$)=Exec(xmmsctrl track `echo "$(Param)+1"|bc`);
	

% 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,1);Send(string,Root);Send(bytes,0,1,242,0)
LIST=Send(bytes,255,0)
%SEEK=
VERS=Send(string,VERSACK);Send(bytes,1,73);

[End]

