%
% anyremote configuration file for amarok management.
%

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

GuiAppName=Amarok
GuiAppBinary=amarok
GuiAppVersion= V=`amarok -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`; if [ "x$V" = "x4" ]; then echo OK; else echo NOK; fi
GuiAppRun= A=`pgrep amarok`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi
GuiAppIcon=amarok.png
GuiAppType=Application
GuiAppProtocols=AT
GuiAppDesc=Amarok is the music player for Linux and Unix with an intuitive interface. Amarok makes playing the music you love easier than ever before - and looks good doing it. This configuration file is for Amarok/KDE4

[Protocol]=AT

(Init)=\
	Include($(CfgDir)/Utils/aliases-at.cfg);\
	Make(var,TwoWayComm,by_value,false);\
	Macro(CHECK_RFCOMM_DEVICE);\
	Make(var,kde4_app,by_value,amarok);\
	Macro(TEST_KDE4_APP);

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

[Mode]=amarok : default_player_at

%InCall($$)=Exec(dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.Pause;$(CfgDir)/Utils/message.sh "$(CallId)");Make(remote,off);
%EndCall($$)=Make(remote,on);Exec(dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.Play)

GETVOL=\
	Make(var,am_volume,qdbus org.kde.amarok /Player VolumeGet);

GETPOS=\
	Make(var,am_pos,qdbus org.kde.amarok /Player PositionGet);

RUN_IF_NEED=\
	Exec(A=`qdbus|grep amarok`; if [ "x$A" = "x" ]; then amarok 2> /dev/null; fi);\
	Macro(GETVOL);\
	Make(var,am_mute,by_value,$(am_volume));\
	SendCKPD(E);

RUN_OR_QUIT=\
	Exec(P=`qdbus|grep amarok`; if [ "x$P" = "x" ]; then amarok 2> /dev/null; else dbus-send --type=method_call --dest=org.kde.amarok / org.freedesktop.MediaPlayer.Quit; fi);

QUIT=\
	Exec(dbus-send --type=method_call --dest=org.kde.amarok / org.freedesktop.MediaPlayer.Quit);\
	SendCKPD(E);

% Override
1=Macro(GETVOL);\
	Exec(dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.VolumeSet int32:`expr $(am_volume) - 5`);
2=Make(var,am_mute,if [ "x$(am_mute)" = "x-1" ]; then qdbus org.kde.amarok /Player VolumeGet; dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.VolumeSet int32:0; else dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.VolumeSet int32:$(am_volume); echo "-1"; fi)
3=Macro(GETVOL);\
	Exec(dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.VolumeSet int32:`expr $(am_volume) + 5`);

PLAY=Exec(amarok --play-pause);
RWD=Macro(GETPOS);\
	Exec(dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.PositionSet int32:`expr $(am_pos) - 10000`);
FF=Macro(GETPOS);\
	Exec(dbus-send --type=method_call --dest=org.kde.amarok /Player org.freedesktop.MediaPlayer.PositionSet int32:`expr $(am_pos) + 10000`);
PREV=Exec(amarok --previous); 
NEXT=Exec(amarok --next);
PAUSE=Exec(amarok --pause); 
STOP=Exec(amarok --stop); 

[ModeEnd]

[End]
