%
% anyremote configuration file for AlsaPlayer (http://www.alsaplayer.org/) (Server-mode)
% 

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

GuiAppName=AlsaPlayer
GuiAppBinary=alsaplayer
GuiAppRun=echo 'A=`pgrep alsaplayer`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppIcon=alsaplayer.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=AlsaPlayer is a new type of PCM player. It has some very interesting features unique to Linux/Unix players. The goal is to create a fully pluggable framework for playback of all sorts of media with the focus on PCM audio data. 

[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,AlsaPlayer);\
	Include($(CfgDir)/Utils/aliases-server-player.cfg);

(Connect)=Make(mode,alsaplayer);

[Mode]=alsaplayer : default_player

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

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

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

File Browser=\
	Make(mode,alsaplayer_filebrowser);

Playlist=\
	Make(mode,alsaplayer_playlist);
	
%APLAYER_GETVOL=Make(var,aplayer_volume,alsaplayer --status|grep volume|tr -d " "|cut -f 2 -d ":");

PLAY =Exec(alsaplayer --start);
RWD  =Exec(alsaplayer --relative -5)
FF   =Exec(alsaplayer --relative 5)
PREV =Exec(alsaplayer --prev)
STOP =Exec(alsaplayer --stop);
NEXT =Exec(alsaplayer --next)
PAUSE=Exec(alsaplayer --pause);

* 4=Exec(alsaplayer --speed -1.0);
* 6=Exec(alsaplayer --speed 1.0);
* *=Set(text,replace,Help,1 Vol-\n2 Mute\n3 Vol+\n4 RWD\n5 Play\n6 Next\n7 FF\n8 Stop\n9 Next\n* 4 Play reversely\n * 6 Play normal speed\n ** Help\n0 Pause\n# Quit\n* # - Run/Quit)

RUN_IF_NEED=Exec($(CfgDir)/Utils/run-or-switch-to.sh alsaplayer);
RUN_OR_QUIT=Exec(P=`pgrep alsaplayer`; if [ "x$P" = "x" ]; then alsaplayer & else alsaplayer --quit; fi);
QUIT=Exec(alsaplayer --quit);

[ModeEnd]

[Mode]=alsaplayer_playlist

(EnterMode)=\
	ExecAndSet(list,replace,Playlist,cd; cat .alsaplayer/alsaplayer.m3u|sed "s/'//g"|xargs -i basename {}|sed 's/\*//;s/@//;s/,/ /g;s/$/,/');\
	Set(menu,replace,Jump);

Push($$)=\
	Macro(JUMP);
	
Jump($$)=\
        Macro(JUMP);
	
JUMP=\
	Set(list,close);\
	Exec(alsaplayer --jump $(Index));\
	Make(mode,alsaplayer);

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

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

[ModeEnd]

[Mode]=alsaplayer_filebrowser

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

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

GoTo($$)    =Macro(FBROWSER_IC_GO_TO);
Go Home($$) =Macro(FBROWSER_IC_GO_HOME);
%Push($$) use from aliases-server-fbrowser-v3i.cfg

Open($$)=\
	Set(list,close);\
	Exec(alsaplayer -e `cat $HOME/.anyRemote/ar_storedir.tmp`/$(Param));\
	Make(mode,alsaplayer);

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

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

[ModeEnd]

[End]
