%
% anyremote configuration file for kmplayer management. (Server-mode)
% prerequisites: kmplayer, amixer utility
% 
%

% STATUS stable
% XTEST no
% SOUND mixer
% ENV no
% FBROWSER v.3i

GuiAppName=Kmplayer
GuiAppBinary=kmplayer
GuiAppRun=echo 'A=`dcop 2> /dev/null|grep kmplayer`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s
GuiAppIcon=kmplayer.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=Media Player for KDE

[Protocol]=Server

(Init)=Include($(CfgDir)/Utils/aliases-server.cfg);

(Connect)=Set(icons,KMPlayer,1,vol_down,2,mute,3,vol_up,4,rewind,5,play,6,forward,7,fullscreen,8,stop,9,default,*,question,0,folder,#,no);\
	Set(title,);\
	Set(status,);

Cancel=Macro(QUIT);

TITLE=ExecAndSet(title,sleep 1;echo 'KMP=`dcop|grep kmplayer`;dcop $KMP kmplayer-mainwindow#1 caption'|bash -f -s|sed 's/ - KMPlayer//;s/URL - file:\/\///');
QUIT=Exec(echo 'KMP=`dcop|grep kmplayer`;dcop $KMP MainApplication-Interface quit'|bash -f -s)

Back=Set(text,close);
Back($$)=Set(list,close);
UpdateMenu=Set(menu,replace,GoTo,Open,Go Home);

% FBROWSER v.3i 
FillList=Set(iconlist,replace,Files,folder:..);\
	Macro(FillDir);\
        Macro(FillFile);
FillDir =ExecAndSet(iconlist,add,SAME,cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";ls -F --quoting-style=shell|sed 's/\*//;s/,/\r/g;s/@//;s/$/,/'|grep '/'| xargs -d '\n' -i echo "folder:" {});
FillFile=ExecAndSet(iconlist,add,SAME,cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";ls -F --quoting-style=shell|sed 's/\*//;s/,/\r/g;s/@//;s/$/,/'|grep -v '/'| xargs -d '\n' -i echo "file:"{});
GoTo($$)=Make(var,goto,by_value,$(Param));\
	ExecAndSet(iconlist,replace,Files,cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";echo "if [ -d $(goto) ]; then cd $(goto);fi;pwd>$HOME/.anyRemote/ar_storedir.tmp;"|bash -f -s;echo "folder:..");\
	Macro(FillDir);\
        Macro(FillFile);
Go Home($$)=ExecAndSet(iconlist,replace,Files,cd;pwd>$HOME/.anyRemote/ar_storedir.tmp;echo "folder:..");\
	Macro(FillDir);\
        Macro(FillFile);
% FBROWSER v.3i 

Open($$)=Set(list,close);\
	Set(menu,clear);\
	Exec(cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";kmplayer "$(Param)");\
	Macro(TITLE);

1=Exec(amixer sset Master,0 5%-    -q)
2=Exec(amixer sset Master,0 toggle -q)
3=Exec(amixer sset Master,0 5%+    -q)

4=Exec(echo 'KMP=`dcop|grep kmplayer`;POS=`dcop $KMP KMediaPlayer position`;NEWPOS=`expr $POS - 10000`;dcop $KMP KMediaPlayer seek $NEWPOS'|bash -f -s)
5=Exec(echo 'KMP=`dcop|grep kmplayer`;dcop $KMP KMediaPlayer play'|bash -f -s);Macro(TITLE);
6=Exec(echo 'KMP=`dcop|grep kmplayer`;POS=`dcop $KMP KMediaPlayer position`;NEWPOS=`expr $POS + 10000`;dcop $KMP KMediaPlayer seek $NEWPOS'|bash -f -s)

7=Exec(echo 'KMP=`dcop|grep kmplayer`;dcop $KMP KMediaPlayer toggleFullScreen'|bash -f -s)
8=Exec(echo 'KMP=`dcop|grep kmplayer`;dcop $KMP KMediaPlayer stop'|bash -f -s)

* *=Set(text,replace,Help,1 - Vol-\n2 - Mute\n3 - Vol+\n4 - Rew\n5 - Play\n6 - FF\n7- Toggle fullscreen\n8 - Stop\n* *- Help\n0 - File browser\n# - Exit)
0=Macro(QUIT);Macro(FillList);Macro(UpdateMenu);
#=Macro(QUIT)


 
[End]
