%
% cmus configuration file for cmus (Server-mode)
%
% cfg by Arthus Belliqueux
%

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

GuiAppName=cmus
GuiAppBinary=cmus-remote
GuiAppRun=echo 'A=`ps -ef|grep cmus|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppIcon=gnome-mime-audio.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=C* Music Player

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v3i.cfg);\
	Macro(SETUP_DEFAULT_MIXER);\
	Make(var,player_name,by_value,CMUS);\
	Include($(CfgDir)/Utils/aliases-server-player.cfg);

(Connect)=Make(mode,cmus);

[Mode]=cmus : default_player

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

APP_MENU=\
	Set(menu,replace,File Browser,Toggle Shuffle,Toggle Repeat,Power Off,Suspend);\
	Macro(ALLIN1MENU);

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

Toggle Shuffle=\
	Exec(cmus-remote -S);
	
Toggle Repeat=\
	Exec(cmus-remote -R);

File Browser=\
	Make(mode,cmus_filebrowser);

% Volume control and 0-9,*,# assignments by Utils/aliases-server-player.cfg

% Do not work on Fedora 14, use defaults
%1=Exec(cmus-remote -v -10%);
%2=Exec(cmus-remote -v -100%);
%3=Exec(cmus-remote -v +10%);

PLAY =Exec(cmus-remote -p);Macro(CMUS_SETTITLE);Timer(CMUS_SETTITLE,5,0);
FF   =Exec(cmus-remote -k +10)
RWD  =Exec(cmus-remote -k -10)
PREV =Exec(cmus-remote -r);Macro(CMUS_SETTITLE);
STOP =Exec(cmus-remote -s);Macro(CMUS_DELTIMER);
NEXT =Exec(cmus-remote -n);Macro(CMUS_SETTITLE);
PAUSE=Exec(cmus-remote -u);

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

RUN_OR_QUIT=\
	Exec(P=`ps -ef|grep cmus|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" = "x" ]; then  xterm -e cmus; else cmus-remote -C quit; fi);\
	Macro(CMUS_DELTIMER);

QUIT=\
	Exec(P=`ps -ef|grep cmus|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" = "x" ]; then true; else cmus-remote -C quit; fi);\
	Macro(CMUS_DELTIMER);

CMUS_DELTIMER=\
	Set(title, );\
	Set(status, );\
	Timer(CMUS_SETTITLE,cancel);

CMUS_SETTITLE=\
	Make(var,cmus_title,cmus-remote -Q|grep "tag title"|sed "s/tag title //");\
	Make(var,cmus_album,cmus-remote -Q|grep "tag album"|grep -v albumartist|sed "s/tag album //");\
	Make(var,cmus_artist,cmus-remote -Q|grep "tag albumartist"|sed "s/tag albumartist //");\
	Set(title,$(cmus_album) - $(cmus_title));\
	Set(status,$(cmus_artist));

[ModeEnd]
	
[Mode]=cmus_filebrowser

(EnterMode)=\
	Macro(FBROWSER_IC_FILL_LIST);\
	Macro(UpdateMenu);

UpdateMenu=Set(menu,replace,GoTo,Queue,Go Home);

GoTo($$)    =Macro(FBROWSER_IC_GO_TO);
Go Home($$) =Macro(FBROWSER_IC_GO_HOME);
%Push($$) use from aliases-server-fbrowser-v3i.cfg
	
Queue($$)=\
	Exec(cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";cmus-remote -q "$(Param)" > /dev/null);

Back($$)=\
	Set(list,close);\
	Make(mode,cmus);

% bug-prone )
1=Make(mode,cmus);	
2=Make(mode,cmus);	
3=Make(mode,cmus);	
4=Make(mode,cmus);	
5=Make(mode,cmus);	
6=Make(mode,cmus);	
7=Make(mode,cmus);	
8=Make(mode,cmus);	
9=Make(mode,cmus);	
*=Make(mode,cmus);	
0=Make(mode,cmus);	
#=Make(mode,cmus);	

[ModeEnd]

[End]
