1%
2% anyremote configuration file for Banshee management. (Server-mode Command Fusion iViewer)
3% prerequisites: Iviewer client installed on Ipod touch/Iphone 2.x and Iviewer free winamp GUI
4%
5
6% STATUS stable
7% XTEST no
8% SOUND mixer
9% ENV no
10
11GuiAppName=Banshee
12GuiAppBinary= B=`which banshee 2> /dev/null`;if [ "x$B" = "x" ]; then echo banshee-1; else echo banshee; fi
13GuiAppRun= P=`ps -ef|grep banshee|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" = "x" ]; then echo NOK; else echo OK; fi
14GuiAppIcon=media-player-banshee.png
15GuiAppType=Application
16GuiAppProtocols=iViewer
17GuiAppDesc=Music management and playback for Gnome
18
19[Protocol]=iViewer
20
21(Init)=\
22	Include($(CfgDir)/Utils/aliases-iviewer.cfg);\
23	Macro(SETUP_DEFAULT_MIXER);\
24	Make(var,IViewer,by_value,true);\
25	Make(var, banshee_exec, which banshee 2> /dev/null);\
26	Make(var, banshee_exec, if [ "x$(banshee_exec)" = "x" ]; then which banshee-1; else echo $(banshee_exec); fi);\
27
28BANSHEE_CMD=\
29	Exec(P=`ps -ef|grep banshee|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" != "x" ]; then $(banshee_cmd); fi);
30
31%a1 = volume
32%a2 = needs a constent update to. its the seek bar
33
34%s1 = artist
35%s2 = track
36%s5 = current playback in min:sec
37%s6 = song length min:sec.
38
39% play
40d1(1)=\
41	Make(var,banshee_cmd,by_value,$(banshee_exec) --toggle-playing);\
42	Macro(BANSHEE_CMD);
43
44% stop
45d30(1)=\
46	Make(var,banshee_cmd,by_value,$(banshee_exec) --pause);\
47	Macro(BANSHEE_CMD);
48
49% pause
50d31(1)=\
51	Make(var,banshee_cmd,by_value,$(banshee_exec) --pause);\
52	Macro(BANSHEE_CMD);
53
54% next
55d5(1)=\
56	Make(var,banshee_cmd,by_value,$(banshee_exec) --next);\
57	Macro(BANSHEE_CMD);\
58	Macro(TITLE);
59
60% prev
61d6(1)=\
62	Make(var,banshee_cmd,by_value,$(banshee_exec) --previous);\
63	Macro(BANSHEE_CMD);\
64	Macro(TITLE);
65
66% toggle repeat
67d12(1)=\
68	Exec(echo "Toggle repeat")
69
70% toggle shuffle
71d9(1)=\
72	Exec(echo "Toggle shuffle")
73
74% volume contol
75a1($$)=\
76	Make(var,default_mixer_value,by_value,$(Index));\
77	Macro(DEFAULT_VOLUME_SET);\
78	Macro(VOLUME);
79
80% seek >> and <<
81a2($$)=\
82	Make(var,song_len,P=`$(banshee_exec) --query-duration|cut -f 2 -d ":"|cut -f 1 -d ","|tr -d " "`;if [ "x$P" = "x" ]; then echo 1; else echo $P; fi);\
83 	Make(var,song_pos,$(Index)*$(song_len)/65535"|bc);\
84 	Exec($(banshee_exec) --set-position=$(song_pos));\
85	Macro(PLAYBACK);
86
87% Feedback
88PLAYBACK=\
89	Make(var,song_pos,P=`$(banshee_exec) --query-position|cut -f 2 -d ":"|cut -f 1 -d ","|tr -d " "`;if [ "x$P" = "x" ]; then echo 1; else echo $P; fi);\
90	Make(var,pos_mm,echo "$(song_pos)/60"|bc);\
91	Make(var,pos_ss,echo "$(song_pos)-$(pos_mm)*60"|bc);\
92	Send(string,s5=$(pos_mm):$(pos_ss));Send(bytes,3);\
93	Make(var,song_len,P=`$(banshee_exec) --query-duration|cut -f 2 -d ":"|cut -f 1 -d ","|tr -d " "`;if [ "x$P" = "x" ]; then echo 1; else echo $P; fi);\
94	Make(var,playback_pos,echo "65535*$(song_pos)/$(song_len)"|bc);\
95	Send(string,a2=$(playback_pos));Send(bytes,3);
96
97%Send(string,s5=);ExecAndSend(string,echo "01:00");Send(bytes,3);\
98%        Make(var,playback_persent,echo "65535*"`echo 50`"/100"|bc);\
99%        Send(string,a2=$(playback_persent));Send(bytes,3);
100
101% get volume: 0 - 65535
102VOLUME=\
103	Macro(DEFAULT_VOLUME_GET);\
104	Send(string,a1=$(default_mixer_value));Send(bytes,3);
105
106% Artist name
107ARTIST=\
108	ExecAndSend(string,P=`ps -ef|grep banshee|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" != "x" ]; then $(banshee_exec) --query-artist|cut -f 2 -d ":"|sed "s/%20/ /g"; fi);
109
110% Track
111TRACK=\
112	ExecAndSend(string,P=`ps -ef|grep banshee|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" != "x" ]; then $(banshee_exec) --query-title|cut -f 2 -d ":"|sed "s/%20/ /g"; fi;);
113
114% Song length mm:ss
115SONG_LEN=\
116	Make(var,song_len,P=`$(banshee_exec) --query-duration|cut -f 2 -d ":"|cut -f 1 -d ","|tr -d " "`;if [ "x$P" = "x" ]; then echo 1; else echo $P; fi);\
117	Make(var,song_mm,echo "$(song_len)/60"|bc);\
118	Make(var,song_ss,echo "$(song_len)-$(song_mm)*60"|bc);\
119	Send(string,$(song_mm):$(song_ss));
120
121%
122% The following is a common part. In general, it should not be changed.
123%
124
125TITLE=\
126	Send(string,s1=);Macro(ARTIST);Send(bytes,3);\
127	Send(string,s2=);Macro(TRACK);Send(bytes,3);\
128	Send(string,s6=);Macro(SONG_LEN);Send(bytes,3);\
129	Send(string,s4=img_coverart-300.png);Send(bytes,3);
130
131d5(0)=Macro(TITLE);
132d6(0)=Macro(TITLE);
133
134% Init
135i(1)=Macro(TITLE);
136
137% Password p(PASSWORD)"
138p($$)=Send(string,p=ok);Send(bytes,3);
139
140% Heartbeat
141DISC=\
142	Macro(STOP_TIMERS);\
143	Make(disconnect);
144
145h(0)=Timer(DISC,reset);
146
147% no needs to send "h=1\03" replay directly because this will be done
148% automatically - that controlled by $(IViewer) variable
149% If $(IViewer) variable is not set it needs to use the following command:
150% h(0)=Send(bytes,104,61,49,3);Timer(DISC,reset);
151
152STOP_TIMERS=\
153	Timer(PLAYBACK,cancel);\
154	Timer(VOLUME,cancel);\
155	Timer(TITLE,cancel);
156
157% Event timers
158(Connect)=\
159	Exec(P=`ps -ef|grep banshee|grep -v grep|grep -v anyremote|grep -v edit`; if [ "x$P" = "x" ]; then $(banshee_exec)& fi);\
160	Timer(DISC,10,1);\
161	Timer(PLAYBACK,3,0);\
162	Timer(VOLUME,10,0);\
163	Timer(TITLE,5,0);
164
165(Disconnect)=\
166	Macro(STOP_TIMERS);
167
168[End]
169
170