%
% anyremote configuration file for Audacious management (AT-mode) 
%

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

GuiAppName=Audacious
GuiAppBinary=audacious
GuiAppRun= P=`ps -ef|grep audacious|grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" = "x" ]; then echo NOK; else echo OK; fi
GuiAppIcon=audacious.png
GuiAppType=Application
GuiAppProtocols=AT
GuiAppDesc=Audacious is a fork of Beep Media Player (BMP) 0.9.7.1, which in itself was based on XMMS1.

[Protocol]=AT

(Init)=\
	Include($(CfgDir)/Utils/aliases-at.cfg);\
	Make(var,TwoWayComm,by_value,false);\
	Macro(CHECK_RFCOMM_DEVICE);

(Connect)=\
	Make(mode,audacious);

[Mode]=audacious : default_player_at

(EnterMode)=\
	Macro(SETUP_DEFAULT_POWER_MANAGEMENT);\
	Macro(RUN_IF_NEED);\
	Make(var,au_volume,by_value,-1);

(Disconnect)=\
	Macro(STOP);

%InCall($$)=\
%	Macro(STOP);\
%	Exec(notify-send -t 5000 "Call from $(Param)");\
%	Make(remote,off);
	
%EndCall($$)=\
%	Make(remote,on);\
%	Macro(PLAY);

RUN_IF_NEED=\
	Exec(P=`ps -ef|grep audacious|grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" = "x" ]; then audacious& fi);

RUN_OR_QUIT=\
	Exec(P=`ps -ef|grep audacious|grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" = "x" ]; then audacious& else audtool shutdown; fi);

QUIT=\
	Exec(audtool shutdown);

% Override
1=Exec(V=`audtool get-volume`;audtool set-volume `expr $V - 5`)
2=Make(var,au_volume,if [ "x$(au_volume)" = "x-1" ]; then audtool get-volume;audtool set-volume 0; else audtool set-volume $(au_volume); echo "-1"; fi)
3=Exec(V=`audtool get-volume`;audtool set-volume `expr $V + 5`)

PLAY=Exec(audacious -t);
RWD=Exec(audtool playback-seek-relative -5);
FF=Exec(audtool playback-seek-relative 5);
PREV=Exec(audacious -r);
NEXT=Exec(audacious -f);
STOP=Exec(audacious -s);
PAUSE=Exec(audacious -t);

[ModeEnd]

[End]
