%
% anyremote configuration file for Xfmedia (http://spuriousinterrupt.org/projects/xfmedia) 
% management (Server-mode)
%
% prerequisites: amixer/pactl utility
%

% STATUS stable
% XTEST no
% SOUND mixer
% ENV no
% DEF_PLAYER   

GuiAppName=xfmedia
GuiAppBinary=xfmedia
GuiAppRun=echo 'P=`ps -ef|grep xfmedia| grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s
GuiAppIcon=xfmedia.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=Xfmedia is a simple, easy-to-use media player based on the xine engine.

[Protocol]=Server

(Init)=Include($(CfgDir)/Utils/aliases-server.cfg);\
	Macro(SETUP_DEFAULT_MIXER);\
	Make(var,player_name,by_value,XfMedia);\
	Include($(CfgDir)/Utils/aliases-server-player.cfg);\
	Exec(echo 'P=`which xfmedia 2> /dev/null|grep xfmedia|grep -v no|grep -v edit|grep -v anyremote|wc -l|tr -d " "`;if [ "x$P" == "x1" ]; then true; else $(CfgDir)/Utils/message.sh "ERROR: xfmeida is not installed"; fi'|bash -f -s);
	
(Connect)=Make(mode,xfmedia);

[Mode]=xfmedia : default_player

% xfmedia does not supports FF/RWD, so use customized setup

(EnterMode)=\
	Macro(RUN_IF_NEED);\
	Macro(SETUP_DEFAULT_PLAYER_NO_FF_FWD);
 
* *=Macro(DEFAULT_HELP_NO_FF_FWD);

% Volume control and 0,4,5,6,8,*,# assignments by Utils/aliases-server-player.cfg

PLAY =Exec(xfmedia-remote -p);
RWD  =Make(none);
FF   =Make(none);
PREV =Exec(xfmedia-remote --previous);
STOP =Exec(xfmedia-remote --stop);
NEXT =Exec(xfmedia-remote --next);
PAUSE=Exec(xfmedia-remote --pause);

RUN_IF_NEED=Exec(echo 'P=`ps -ef|grep xfmedia| grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" == "x" ]; then xfmedia & fi'|bash -f -s);
RUN_OR_QUIT=Exec(echo 'P=`ps -ef|grep xfmedia| grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" == "x" ]; then xfmedia & else pkill xfmedia; fi'|bash -f -s);
APP_QUIT=Exec(pkill xfmedia);

[ModeEnd]

[End]
