%
% anyremote configuration file for Exaile management (Server-mode)
% prerequisites: amixer/pactl utility
%

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

GuiAppName=Exaile
GuiAppBinary=exaile
GuiAppRun=echo 'P=`ps -ef|grep exaile |grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppIcon=exaile.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=Exaile is a music player aiming to be similar to KDE's Amarok, but for GTK+ and written in Python.

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Macro(SETUP_DEFAULT_MIXER);\
	Make(var,player_name,by_value,Exaile);\
	Include($(CfgDir)/Utils/aliases-server-player.cfg);
	
(Connect)=\
	Make(mode,exaile);

[Mode]=exaile : default_player

% (EnterMode) by Utils/aliases-server-player.cfg

EXAILE_SETTITLE=\
	Make(var,exaile_artist,exaile --get-artist);\
	Make(var,exaile_title,exaile --get-title);\
	Set(title,$(exaile_artist) $(exaile_title));

APP_MENU=\
	Set(menu,replace,Play CD,Power Off,Suspend);\
	Macro(ALLIN1MENU);

% Power Off, Suspend by Utils/aliases-server-player.cfg

Play CD=\
	Exec(exaile --play-cd);\
	Timer(EXAILE_SETTITLE,5,0);

EXAILE_SETPOS=\
	Exec(qdbus org.exaile.Exaile /org/exaile/Exaile Seek $(exaile_pos));

PLAY=\
	Exec(exaile --play);\
	Macro(EXAILE_SETTITLE);\
	Timer(EXAILE_SETTITLE,5,0);
	
RWD=\
	Make(var,exaile_pos,echo "`qdbus org.exaile.Exaile /org/exaile/Exaile CurrentProgress` * 2 - 8"|bc);\
	Macro(EXAILE_SETPOS);\
	Macro(EXAILE_SETTITLE);
	
FF=\
	Make(var,exaile_pos,echo "`qdbus org.exaile.Exaile /org/exaile/Exaile CurrentProgress` * 2 + 12"|bc);\
	Macro(EXAILE_SETPOS);\
	Macro(EXAILE_SETTITLE);
	
PREV=\
	Exec(exaile --prev);\
	Macro(EXAILE_SETTITLE);

STOP=\
	Exec(exaile --stop);\
	Timer(EXAILE_SETTITLE,cancel);

NEXT=\
	Exec(exaile --next);\
	Macro(EXAILE_SETTITLE);

PAUSE=\
	Exec(exaile --play-pause);\
	Timer(EXAILE_SETTITLE,cancel);

RUN_IF_NEED=\
	Exec(P=`ps -ef|grep exaile|grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" = "x" ]; then exaile 2> /dev/null & fi);

RUN_OR_QUIT=\
	Timer(EXAILE_SETTITLE,cancel);\
	Exec(P=`ps -ef|grep exaile|grep -v grep|grep -v anyremote|grep -v nedit`; if [ "x$P" = "x" ]; then exaile 2> /dev/null & else pkill -f "python (.)*exaile"; fi);

QUIT=\
	Timer(EXAILE_SETTITLE,cancel);Exec(pkill -f 'python (.)*exaile')

[ModeEnd]

[End]
