%
% anyremote configuration file for smplayer2 management. (Server-mode)
% (tested with v6.2)
%

% STATUS stable
% XTEST yes
% SOUND mixer
% ENV no
% FBROWSER v.4i
% DEF_VIDEO_PLAYER   
% ALL_IN_ONE 
% MEDIACENTER video

GuiAppName=SMPlayer2
GuiAppBinary=smplayer2
GuiAppRun=echo 'A=`qdbus 2> /dev/null|grep SMPlayer2`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppIcon=application-x-smplayer2.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=A fork of SMPlayer, targeted at mplayer2 users.

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Macro(SETUP_DEFAULT_MIXER);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v4i.cfg);\
	Macro(FBROWSER_IC_INIT);\
	Include($(CfgDir)/Utils/aliases-server-video-player.cfg);\
	Make(var,app_name,by_value,SMPlayer2);\
	Make(var,do_app_init,by_value,1);\
	Make(var,open_file,by_value,);\
	Make(var,smplayer2_layout,\
	     V=`$(CfgDir)/Utils/registry.sh $(TmpDir) get smplayer2_layout`;\
	     if [ "x$V" = "x" ]; then echo "3x4"; else echo $V; fi);\
	Make(var,app_manage_mode,by_value,smplayer2_$(smplayer2_layout));

(Exit)=\
	Macro(FBROWSER_IC_EXIT);\
	Exec($(CfgDir)/Utils/registry.sh $(TmpDir) set smplayer2_layout $(smplayer2_layout));

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

[Mode]=smplayer2_init : default_video_player_init

APP_IS_RUN=\
	Make(var,app_run,A=`qdbus 2> /dev/null|grep SMPlayer2`; if [ "x$A" = "x" ]; then echo 0; else echo 1; fi);

[ModeEnd]

[Mode]=smplayer2_general

APP_START_IF=\
	Exec(P=`qdbus|grep SMPlayer2`;\
	     if [ "x$P" = "x" ]; then cd "$(fbrowser_dir)";smplayer2 $(open_file) 2> /dev/null & fi);

% Application window should be present in output of "wmctrl -l"
APP_RAISE=\
	Exec($(CfgDir)/Utils/run-or-switch-to.sh -switch smplayer2);

APP_QUIT=\
	Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Quit > /dev/null);

APP_FULLSCREEN=\
	Make(var,smplayer2_fs,F=`qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Fullscreen`;\
	     if [ "x$F" = "xfalse" ]; then echo True; else echo False; fi);\
	Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Fullscreen $(smplayer2_fs) > /dev/null);
	
PLAY=\
	Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Play > /dev/null);

%Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Seek -10 > /dev/null)
RWD=\
    Emulate(key,Left);

%Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Seek 10 > /dev/null)
FF=\
    Emulate(key,Right);

STOP=\
	Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Stop > /dev/null);

PAUSE=\
	Exec(qdbus org.mpris.MediaPlayer2.SMPlayer2 /org/mpris/MediaPlayer2 Pause > /dev/null)

Layout 3x4=\
	Make(mode,smplayer2_3x4);

Layout 5x1=\
	Make(mode,smplayer2_5x1);

[ModeEnd]

[Mode]=smplayer2_3x4 : smplayer2_general,default_video_player 

APP_POST_SETUP=\
	Make(var,smplayer2_layout,by_value,3x4);\
	Make(var,app_manage_mode,by_value,smplayer2_$(smplayer2_layout));

APP_MENU=\
	Set(menu,replace,Layout 5x1,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

% Override
1=Emulate(key,9);

2=Emulate(key,m);

3=Emulate(key,0);

* *=Set(text,replace,Help,1 Vol-\n2 Mute\n3 Vol+\n4 Rewind\n5 Play\n6 FF\n7 File Browser\n8 Stop\n9 Fullscreen\n** Help\n0 Pause\n# Exit)

[ModeEnd]

[Mode]=smplayer2_5x1 : smplayer2_general,default_video_player_5x1 

APP_POST_SETUP=\
	Make(var,smplayer2_layout,by_value,5x1);\
	Make(var,app_manage_mode,by_value,smplayer2_$(smplayer2_layout));

APP_MENU=\
	Set(menu,replace,Help,Mute,Quit,Fullscreen,Files,Layout 3x4,IMDB,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

% Override
VOL-=\
	Emulate(key,9);

Mute=\
	Emulate(key,m);

VOL+=\
	Emulate(key,0);

DEFAULT_HELP=\
	Set(text,replace,Help,Joystick Down Vol-\nJoystick Up Vol+\n1 Rewind\n2 Play\n3 FastForward\n4 Pause\n5 Stop and quit $(app_name));

Fullscreen=\
	Macro(APP_FULLSCREEN);

[ModeEnd]

[End]
