%
% anyremote configuration file for DVB-T viewing by Kaffeine. (Server-mode)
% Kaffeine playlist should be already created
%
% Thanks to Johann Bauer for this configuration file.
%

% STATUS unknown
% XTEST no
% SOUND app
% ENV no

GuiAppName=KaffeineDVBT
GuiAppBinary=kaffeine
GuiAppRun=echo 'A=`dcop 2> /dev/null|grep kaffeine`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s
GuiAppIcon=kaffeine.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=View DVB-T by Kaffeine (KDE media player)

[Protocol]=Server

(Init)=Include($(CfgDir)/Utils/aliases-server.cfg);
(Connect)=Make(mode,kaffeine);

KAFFEINE_SETTITLE=Set(title,DVB-T)

[Mode]=kaffeine

(EnterMode)=Exec(echo 'A=`dcop 2> /dev/null|grep kaffeine`; if [ "x$A" == "x" ]; then kaffeine;sleep 2;dcop kaffeine KaffeineIface playDvb;fi'|bash -f -s);\
	Set(layout,default);\
        Set(title,DVB-T);\
	Set(icons,Kaffeine,1,vol_down,2,mute,3,vol_up,4,rewind,5,play,6,forward,7,prev,8,stop,9,next,*,question,0,pause,#,no);\
	Set(menu,replace,Channels,Toggle fullscreen,Close and exit,DVB-T Start);\
	Macro(ALLIN1MENU);
	
Cancel=Exec(dcop kaffeine KaffeineIface quit);

Back=Set(text,close);Macro(ALLIN1MENU)

1=Exec(dcop kaffeine KaffeineIface volDown)
2=Exec(dcop kaffeine KaffeineIface mute)
3=Exec(dcop kaffeine KaffeineIface volUp)

4=Exec(dcop kaffeine KaffeineIface posMinus)
5=Exec(dcop kaffeine KaffeineIface play);Set(status,Playing);Macro(KAFFEINE_SETTITLE);Timer(KAFFEINE_SETTITLE,10,0);
6=Exec(dcop kaffeine KaffeineIface posPlus)

7=Exec(dcop kaffeine KaffeineIface previous);
8=Exec(dcop kaffeine KaffeineIface stop);Set(status,Stopped);Timer(KAFFEINE_SETTITLE,cancel);
9=Exec(dcop kaffeine KaffeineIface next)


* 1=Exec(dcop kaffeine XinePartIface zoomOut);
* 3=Exec(dcop kaffeine XinePartIface zoomIn);

* *=Set(text,replace,Help,1 Vol-  2 Mute  3 Vol+\n4 Rew   5 Play  6 FF\n7 Prew  8 Stop  9 Next\n* Help  0 Pause # Exit\n* 1 - Zoom In\n* 3 - Zoom Out\n* # - Run/Quit)
* #=Exec(echo 'P=`dcop|grep kaffeine`; if [ "x$P" == "x" ]; then kaffeine;sleep 2;dcop kaffeine KaffeineIface setNumber 1; else dcop kaffeine KaffeineIface quit; fi;' |bash -f -s)
0=Exec(dcop kaffeine KaffeineIface pause);Make(mode,kaffeine_pause);
#=Exec(dcop kaffeine KaffeineIface quit)

Channels=Make(mode,kaffeine_playlist)
Toggle fullscreen=Exec(dcop kaffeine KaffeineIface fullscreen);
Close and exit=Macro(Cancel);
DVB-T Start=Exec(dcop kaffeine KaffeineIface playDvb);

[ModeEnd]

[Mode]=kaffeine_pause

Back=Set(text,close);Set(menu,replace,Channels,Toggle fullscreen);Macro(ALLIN1MENU)

(EnterMode)=Set(status,Paused);

0=Exec(dcop kaffeine KaffeineIface pause);Set(status,Playing);Make(mode,kaffeine);
5=Exec(dcop kaffeine KaffeineIface play;dcop kaffeine KaffeineIface fullscreen);\
	Make(mode,kaffeine);\
	Set(status,Playing);\

* *=Set(text,replace,Help,1 Vol-  2 Mute  3 Vol+\n4 Rew   5 Play  6 FF\n7 Prew  8 Stop  9 Next\n* Help  0 Pause # Exit\n* # - Run/Quit)

[ModeEnd]

[Mode]=kaffeine_playlist

(EnterMode)=Timer(KAFFEINE_SETTITLE,cancel);\
	Set(list,font,medium);\
	ExecAndSet(list,replace,Channels, cut -d\| -f2 $HOME/.kde/share/apps/kaffeine/channels.dvb |sed '1d' | tr \\n ,);\
	Set(menu,add,Choose);
(ExitMode)=Set(list,close);\
	Set(status,Playing);\
	Set(menu,replace,Channels,Toggle fullscreen,Close and exit,DVB-T Start);\
	Set(title,DVB-T);\
	Macro(KAFFEINE_SETTITLE);\
	Timer(KAFFEINE_SETTITLE,10,0);

Back($$)=Make(mode,kaffeine);
Choose($$)=Exec(dcop kaffeine KaffeineIface setNumber `expr $(Index)`);

[ModeEnd]

[End]
