%
% anyremote configuration file for quodlibet. (Server-mode)
% 
% Thanks to Van Wout Heeswijk for this cfg.file
%

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

GuiAppName=Quodlibet
GuiAppBinary=quodlibet
GuiAppRun=echo 'A=`ps -ef|grep quodlibet|grep -v grep`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi' | bash -f -s
GuiAppIcon=quodlibet.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=Quod Libet is a GTK+-based audio player written in Python. It's designed around the idea that you know how to organize your music better than we do.

[Protocol]=Server

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

[Mode]=quodlibet : default_player

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

APP_PRE_SETUP=\
	Make(var,quodlibet_volume,echo "-1");
	
QUODLIBET_SETTITLE=\
	ExecAndSet(title,quodlibet --print-playing);

1=Exec(quodlibet --volume-down)
2=Make(var,quodlibet_volume,if [ "x$(quodlibet_volume)" = "x-1" ]; then V=`quodlibet --status|cut -f 3 -d ' '|grep '.'`;echo "$V * 100"|bc|cut -f 1 -d '.';quodlibet --volume=0; else quodlibet --volume=$(quodlibet_volume);echo "-1"; fi)
3=Exec(quodlibet --volume-up)

% Android support
VOL-=Exec(quodlibet --volume-down)
VOL+=Exec(quodlibet --volume-up)

% 0-9,*,# assignments by Utils/aliases-server-player.cfg
PLAY =Exec(quodlibet --seek=-10)
RWD  =Exec(quodlibet --play);Macro(QUODLIBET_SETTITLE);Timer(QUODLIBET_SETTITLE,5,0);
FF   =Exec(quodlibet --seek=+10)
PREV =Exec(quodlibet --previous);Macro(QUODLIBET_SETTITLE);
STOP =Exec(quodlibet --play-pause)
NEXT =Exec(quodlibet --next);Macro(QUODLIBET_SETTITLE);
PAUSE=Exec(quodlibet --play-pause)

RUN_IF_NEED=\
	Exec(P=`ps -ef|grep quodlibet|grep -v grep|grep -v quodlibet.cfg`; if [ "x$P" = "x" ]; then quodlibet & fi);
RUN_OR_QUIT=\
	Timer(QUODLIBET_SETTITLE,cancel);\
	Exec(P=`ps -ef|grep quodlibet|grep -v grep|grep -v quodlibet.cfg`; if [ "x$P" = "x" ]; then quodlibet & else quodlibet --quit; fi);
QUIT=\
	Timer(QUODLIBET_SETTITLE,cancel);\
	Exec(quodlibet --quit);

[ModeEnd]

[End]
