%
% anyremote configuration file for Juk/KDE3 management (Server-mode)
%

% STATUS stable
% XTEST no
% SOUND app
% ENV no
% IPC DCOP

GuiAppName=Juk/KDE3
GuiAppBinary=juk
GuiAppVersion=echo 'V=`juk -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`; if [ "x$V" == "x3" ]; then echo OK; else echo NOK; fi'|bash -f -s
GuiAppRun=echo 'A=`dcop 2> /dev/null|grep juk`; if [ "x$A" == "x" ]; then echo NOK; else echo OK; fi'|bash -f -s
GuiAppIcon=juk.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=JuK is a free software audio player for KDE, part of the kdemultimedia package. JuK supports collections of MP3, Ogg Vorbis, and FLAC audio files. This configuration file is for Juk/KDE3.

[Protocol]=Server

(Init)=Include($(CfgDir)/Utils/aliases-server.cfg);\
	Exec(echo 'V=`juk -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`;if [ "x$V" == "x4" ]; then $(CfgDir)/Utils/message.sh "ERROR: this configuration file is for KDE3"; fi'|bash -f -s);

(Connect)=Make(mode,juk);

JUK_SETTITLE=ExecAndSet(title,dcop juk Player playingString)

[Mode]=juk

(EnterMode)=Make(var,juk_volume,by_value,-1);Exec(echo 'A=`dcop|grep juk`; if [ "x$A" == "x" ]; then juk; fi'|bash -f -s);\
	Set(layout,default);Set(icons,Juk,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(font,small);\
	Set(menu,replace,Playlist);\
	Macro(ALLIN1MENU)
(ExitMode)=Timer(JUK_SETTITLE,cancel)

Cancel  =Exec(dcop juk MainApplication-Interface quit);
Back    =Set(text,close);Set(menu,replace,Playlist);Macro(ALLIN1MENU)
Playlist=Timer(JUK_SETTITLE,cancel);Make(mode,juk_playlist)

1=Exec(dcop juk Player volumeDown)
%2=Exec(dcop juk Player mute) -- does not unmute
2=Make(var,juk_volume,echo 'if [ "x$(juk_volume)" == "x-1" ]; then dcop juk Player volume;dcop juk Player setVolume 0; else dcop juk Player setVolume $(juk_volume); echo "-1"; fi;'|bash -f -s)
3=Exec(dcop juk Player volumeUp)

%4=Exec(dcop juk Player seekBack)
%6=Exec(dcop juk Player seekForward)

4=Exec(echo 'T=`dcop juk Player currentTime`;T2=`expr $T - 5`;dcop juk Player seek $T2'| bash -f -s);
5=Exec(dcop juk Player play);Macro(JUK_SETTITLE);Timer(JUK_SETTITLE,5,0)
6=Exec(echo 'T=`dcop juk Player currentTime`;T2=`expr $T + 5`;dcop juk Player seek $T2'| bash -f -s);

7=Exec(dcop juk Player back);Macro(JUK_SETTITLE);
8=Exec(dcop juk Player stop);Timer(JUK_SETTITLE,cancel)
9=Exec(dcop juk Player forward);Macro(JUK_SETTITLE);

* *=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 # Kill)
* #=Exec(echo 'P=`dcop|grep juk`; if [ "x$P" == "x" ]; then juk; else dcop juk MainApplication-Interface quit; fi'|bash -f -s);
0=Exec(dcop juk Player playPause);
#=Exec(dcop juk MainApplication-Interface quit);Timer(JUK_SETTITLE,cancel)

[ModeEnd]

[Mode]=juk_playlist

(EnterMode)=Timer(JUK_SETTITLE,cancel);\
	Set(list,font,medium);\
	ExecAndSet(list,replace,Playlist,echo 'L=`dcop juk Collection playlist`;dcop juk Collection playlistTracks "$L" > $HOME/.anyRemote/juk.playlist'| bash -f -s;cat $HOME/.anyRemote/juk.playlist |sed "s/'/_/g"|xargs -i basename {}|sed 's/,/\r/g;s/$/,/');\
	Set(menu,add,Choose);
	
(ExitMode)=Macro(JUK_SETTITLE);\
	Timer(JUK_SETTITLE,5,0);

Back($$)  =Make(mode,juk);
Choose($$)=Exec(echo 'F=`head -$(Index) $HOME/.anyRemote/juk.playlist|tail -1`;dcop juk Player play "$F"'| bash -f -s);
[ModeEnd]

[End]
