1
|
#!/bin/sh
|
2
|
|
3
|
BLA='#####################'
|
4
|
NAME1=$(uci get radio.@radio[0].name1)
|
5
|
NAME2=$(uci get radio.@radio[0].name2)
|
6
|
NAME3=$(uci get radio.@radio[0].name3)
|
7
|
NAME4=$(uci get radio.@radio[0].name4)
|
8
|
NAME5=$(uci get radio.@radio[0].name5)
|
9
|
NAME6=$(uci get radio.@radio[0].name6)
|
10
|
NAME7=$(uci get radio.@radio[0].name7)
|
11
|
NAME8=$(uci get radio.@radio[0].name8)
|
12
|
NAME9=$(uci get radio.@radio[0].name9)
|
13
|
NAME10=$(uci get radio.@radio[0].name10)
|
14
|
NAME11=$(uci get radio.@radio[0].name11)
|
15
|
NAME12=$(uci get radio.@radio[0].name12)
|
16
|
NAME13=$(uci get radio.@radio[0].name13)
|
17
|
NAME14=$(uci get radio.@radio[0].name14)
|
18
|
NAME15=$(uci get radio.@radio[0].name15)
|
19
|
NAME16=$(uci get radio.@radio[0].name16)
|
20
|
|
21
|
C=0
|
22
|
for NAME in "$NAME1" "$NAME2" "$NAME3" "$NAME4" "$NAME5" "$NAME6" "$NAME7" "$NAME8" "$NAME9" "$NAME10"
|
23
|
do
|
24
|
NM=${NAME:0:19}
|
25
|
NMLEN=`expr length $NM`
|
26
|
NML19=`expr 19 - $NMLEN`
|
27
|
BLA19=${BLA:0:$NML19}
|
28
|
echo "AB"$NM$BLA19"0"$C > /dev/ttyS0
|
29
|
echo "AB"$NM$BLA19"0"$C
|
30
|
C=`expr $C + 1`
|
31
|
/usr/bin/sleep 0.1
|
32
|
done
|
33
|
|
34
|
C=10
|
35
|
for NAME in "$NAME11" "$NAME12" "$NAME13" "$NAME14" "$NAME15" "$NAME16"
|
36
|
do
|
37
|
NM=${NAME:0:19}
|
38
|
NMLEN=`expr length $NM`
|
39
|
NML19=`expr 19 - $NMLEN`
|
40
|
BLA19=${BLA:0:$NML19}
|
41
|
echo "AB"$NM$BLA19$C > /dev/ttyS0
|
42
|
echo "AB"$NM$BLA19$C
|
43
|
C=`expr $C + 1`
|
44
|
/usr/bin/sleep 0.1
|
45
|
done
|
46
|
|
47
|
killall wget 2> /dev/null
|
48
|
killall meta-ser 2> /dev/null
|
49
|
killall madplay 2> /dev/null
|
50
|
|
51
|
PLAY="0"
|
52
|
while [ 1 ]; do
|
53
|
CH=`dd if=/dev/ttyS0 count=1 2> /dev/null`
|
54
|
|
55
|
CH1=$(uci get radio.@radio[0].ch1)
|
56
|
CH2=$(uci get radio.@radio[0].ch2)
|
57
|
CH3=$(uci get radio.@radio[0].ch3)
|
58
|
CH4=$(uci get radio.@radio[0].ch4)
|
59
|
CH5=$(uci get radio.@radio[0].ch5)
|
60
|
CH6=$(uci get radio.@radio[0].ch6)
|
61
|
CH7=$(uci get radio.@radio[0].ch7)
|
62
|
CH8=$(uci get radio.@radio[0].ch8)
|
63
|
CH9=$(uci get radio.@radio[0].ch9)
|
64
|
CH10=$(uci get radio.@radio[0].ch10)
|
65
|
CH11=$(uci get radio.@radio[0].ch11)
|
66
|
CH12=$(uci get radio.@radio[0].ch12)
|
67
|
CH13=$(uci get radio.@radio[0].ch13)
|
68
|
CH14=$(uci get radio.@radio[0].ch14)
|
69
|
CH15=$(uci get radio.@radio[0].ch15)
|
70
|
CH16=$(uci get radio.@radio[0].ch16)
|
71
|
NAME1=$(uci get radio.@radio[0].name1)
|
72
|
NAME2=$(uci get radio.@radio[0].name2)
|
73
|
NAME3=$(uci get radio.@radio[0].name3)
|
74
|
NAME4=$(uci get radio.@radio[0].name4)
|
75
|
NAME5=$(uci get radio.@radio[0].name5)
|
76
|
NAME6=$(uci get radio.@radio[0].name6)
|
77
|
NAME7=$(uci get radio.@radio[0].name7)
|
78
|
NAME8=$(uci get radio.@radio[0].name8)
|
79
|
NAME9=$(uci get radio.@radio[0].name9)
|
80
|
NAME10=$(uci get radio.@radio[0].name10)
|
81
|
NAME11=$(uci get radio.@radio[0].name11)
|
82
|
NAME12=$(uci get radio.@radio[0].name12)
|
83
|
NAME13=$(uci get radio.@radio[0].name13)
|
84
|
NAME14=$(uci get radio.@radio[0].name14)
|
85
|
NAME15=$(uci get radio.@radio[0].name15)
|
86
|
NAME16=$(uci get radio.@radio[0].name16)
|
87
|
|
88
|
case $CH in
|
89
|
0 )
|
90
|
if [ $PLAY -eq "1" ]
|
91
|
then
|
92
|
killall wget 2> /dev/null
|
93
|
killall meta-ser 2> /dev/null
|
94
|
killall madplay 2> /dev/null
|
95
|
/usr/bin/sleep 0.2
|
96
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH1 | meta-ser | madplay - 2> /dev/null &
|
97
|
fi
|
98
|
uci set radio.@radio[0].state=1
|
99
|
CHPLAY=$CH1
|
100
|
NAMEPLAY=$NAME1
|
101
|
STATE="1"
|
102
|
echo $CH1
|
103
|
echo $NAME1
|
104
|
;;
|
105
|
1 )
|
106
|
if [ $PLAY -eq "1" ]
|
107
|
then
|
108
|
killall wget 2> /dev/null
|
109
|
killall meta-ser 2> /dev/null
|
110
|
killall madplay 2> /dev/null
|
111
|
/usr/bin/sleep 0.2
|
112
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH2 | meta-ser | madplay - 2> /dev/null &
|
113
|
fi
|
114
|
uci set radio.@radio[0].state=2
|
115
|
CHPLAY=$CH2
|
116
|
NAMEPLAY=$NAME2
|
117
|
STATE="2"
|
118
|
echo $CH2
|
119
|
echo $NAME2
|
120
|
;;
|
121
|
2 )
|
122
|
if [ $PLAY -eq "1" ]
|
123
|
then
|
124
|
killall wget 2> /dev/null
|
125
|
killall meta-ser 2> /dev/null
|
126
|
killall madplay 2> /dev/null
|
127
|
/usr/bin/sleep 0.2
|
128
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH3 | meta-ser | madplay - 2> /dev/null &
|
129
|
fi
|
130
|
uci set radio.@radio[0].state=3
|
131
|
CHPLAY=$CH3
|
132
|
NAMEPLAY=$NAME3
|
133
|
STATE="3"
|
134
|
echo $CH3
|
135
|
echo $NAME3
|
136
|
;;
|
137
|
3 )
|
138
|
if [ $PLAY -eq "1" ]
|
139
|
then
|
140
|
killall wget 2> /dev/null
|
141
|
killall meta-ser 2> /dev/null
|
142
|
killall madplay 2> /dev/null
|
143
|
/usr/bin/sleep 0.2
|
144
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH4 | meta-ser | madplay - 2> /dev/null &
|
145
|
fi
|
146
|
uci set radio.@radio[0].state=4
|
147
|
CHPLAY=$CH4
|
148
|
NAMEPLAY=$NAME4
|
149
|
STATE="4"
|
150
|
echo $CH4
|
151
|
echo $NAME4
|
152
|
;;
|
153
|
4 )
|
154
|
if [ $PLAY -eq "1" ]
|
155
|
then
|
156
|
killall wget 2> /dev/null
|
157
|
killall meta-ser 2> /dev/null
|
158
|
killall madplay 2> /dev/null
|
159
|
/usr/bin/sleep 0.2
|
160
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH5 | meta-ser | madplay - 2> /dev/null &
|
161
|
fi
|
162
|
uci set radio.@radio[0].state=5
|
163
|
CHPLAY=$CH5
|
164
|
NAMEPLAY=$NAME5
|
165
|
STATE="5"
|
166
|
echo $CH5
|
167
|
echo $NAME5
|
168
|
;;
|
169
|
5 )
|
170
|
if [ $PLAY -eq "1" ]
|
171
|
then
|
172
|
killall wget 2> /dev/null
|
173
|
killall meta-ser 2> /dev/null
|
174
|
killall madplay 2> /dev/null
|
175
|
/usr/bin/sleep 0.2
|
176
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH6 | meta-ser | madplay - 2> /dev/null &
|
177
|
fi
|
178
|
uci set radio.@radio[0].state=6
|
179
|
CHPLAY=$CH6
|
180
|
NAMEPLAY=$NAME6
|
181
|
STATE="6"
|
182
|
echo $CH6
|
183
|
echo $NAME6
|
184
|
;;
|
185
|
6 )
|
186
|
if [ $PLAY -eq "1" ]
|
187
|
then
|
188
|
killall wget 2> /dev/null
|
189
|
killall meta-ser 2> /dev/null
|
190
|
killall madplay 2> /dev/null
|
191
|
/usr/bin/sleep 0.2
|
192
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH7 | meta-ser | madplay - 2> /dev/null &
|
193
|
fi
|
194
|
uci set radio.@radio[0].state=7
|
195
|
CHPLAY=$CH7
|
196
|
NAMEPLAY=$NAME7
|
197
|
STATE="7"
|
198
|
echo $CH7
|
199
|
echo $NAME7
|
200
|
;;
|
201
|
7 )
|
202
|
if [ $PLAY -eq "1" ]
|
203
|
then
|
204
|
killall wget 2> /dev/null
|
205
|
killall meta-ser 2> /dev/null
|
206
|
killall madplay 2> /dev/null
|
207
|
/usr/bin/sleep 0.2
|
208
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH8 | meta-ser | madplay - 2> /dev/null &
|
209
|
fi
|
210
|
uci set radio.@radio[0].state=8
|
211
|
CHPLAY=$CH8
|
212
|
NAMEPLAY=$NAME8
|
213
|
STATE="8"
|
214
|
echo $CH8
|
215
|
echo $NAME8
|
216
|
;;
|
217
|
8 )
|
218
|
if [ $PLAY -eq "1" ]
|
219
|
then
|
220
|
killall wget 2> /dev/null
|
221
|
killall meta-ser 2> /dev/null
|
222
|
killall madplay 2> /dev/null
|
223
|
/usr/bin/sleep 0.2
|
224
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH9 | meta-ser | madplay - 2> /dev/null &
|
225
|
fi
|
226
|
uci set radio.@radio[0].state=9
|
227
|
CHPLAY=$CH9
|
228
|
NAMEPLAY=$NAME9
|
229
|
STATE="9"
|
230
|
echo $CH9
|
231
|
echo $NAME9
|
232
|
;;
|
233
|
9 )
|
234
|
if [ $PLAY -eq "1" ]
|
235
|
then
|
236
|
killall wget 2> /dev/null
|
237
|
killall meta-ser 2> /dev/null
|
238
|
killall madplay 2> /dev/null
|
239
|
/usr/bin/sleep 0.2
|
240
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH10 | meta-ser | madplay - 2> /dev/null &
|
241
|
fi
|
242
|
uci set radio.@radio[0].state=10
|
243
|
CHPLAY=$CH10
|
244
|
NAMEPLAY=$NAME10
|
245
|
STATE="10"
|
246
|
echo $CH10
|
247
|
echo $NAME10
|
248
|
;;
|
249
|
10 )
|
250
|
if [ $PLAY -eq "1" ]
|
251
|
then
|
252
|
killall wget 2> /dev/null
|
253
|
killall meta-ser 2> /dev/null
|
254
|
killall madplay 2> /dev/null
|
255
|
/usr/bin/sleep 0.2
|
256
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH11 | meta-ser | madplay - 2> /dev/null &
|
257
|
fi
|
258
|
uci set radio.@radio[0].state=11
|
259
|
CHPLAY=$CH11
|
260
|
NAMEPLAY=$NAME11
|
261
|
STATE="11"
|
262
|
echo $CH11
|
263
|
echo $NAME11
|
264
|
;;
|
265
|
11 )
|
266
|
if [ $PLAY -eq "1" ]
|
267
|
then
|
268
|
killall wget 2> /dev/null
|
269
|
killall meta-ser 2> /dev/null
|
270
|
killall madplay 2> /dev/null
|
271
|
/usr/bin/sleep 0.2
|
272
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH12 | meta-ser | madplay - 2> /dev/null &
|
273
|
fi
|
274
|
uci set radio.@radio[0].state=12
|
275
|
CHPLAY=$CH12
|
276
|
NAMEPLAY=$NAME12
|
277
|
STATE="12"
|
278
|
echo $CH12
|
279
|
echo $NAME12
|
280
|
;;
|
281
|
12 )
|
282
|
if [ $PLAY -eq "1" ]
|
283
|
then
|
284
|
killall wget 2> /dev/null
|
285
|
killall meta-ser 2> /dev/null
|
286
|
killall madplay 2> /dev/null
|
287
|
/usr/bin/sleep 0.2
|
288
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH13 | meta-ser | madplay - 2> /dev/null &
|
289
|
fi
|
290
|
uci set radio.@radio[0].state=13
|
291
|
CHPLAY=$CH13
|
292
|
NAMEPLAY=$NAME13
|
293
|
STATE="13"
|
294
|
echo $CH13
|
295
|
echo $NAME13
|
296
|
;;
|
297
|
13 )
|
298
|
if [ $PLAY -eq "1" ]
|
299
|
then
|
300
|
killall wget 2> /dev/null
|
301
|
killall meta-ser 2> /dev/null
|
302
|
killall madplay 2> /dev/null
|
303
|
/usr/bin/sleep 0.2
|
304
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH14 | meta-ser | madplay - 2> /dev/null &
|
305
|
fi
|
306
|
uci set radio.@radio[0].state=14
|
307
|
CHPLAY=$CH14
|
308
|
NAMEPLAY=$NAME14
|
309
|
STATE="14"
|
310
|
echo $CH14
|
311
|
echo $NAME14
|
312
|
;;
|
313
|
14 )
|
314
|
if [ $PLAY -eq "1" ]
|
315
|
then
|
316
|
killall wget 2> /dev/null
|
317
|
killall meta-ser 2> /dev/null
|
318
|
killall madplay 2> /dev/null
|
319
|
/usr/bin/sleep 0.2
|
320
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH15 | meta-ser | madplay - 2> /dev/null &
|
321
|
fi
|
322
|
uci set radio.@radio[0].state=15
|
323
|
CHPLAY=$CH15
|
324
|
NAMEPLAY=$NAME15
|
325
|
STATE="15"
|
326
|
echo $CH15
|
327
|
echo $NAME15
|
328
|
;;
|
329
|
15 )
|
330
|
if [ $PLAY -eq "1" ]
|
331
|
then
|
332
|
killall wget 2> /dev/null
|
333
|
killall meta-ser 2> /dev/null
|
334
|
killall madplay 2> /dev/null
|
335
|
/usr/bin/sleep 0.2
|
336
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CH16 | meta-ser | madplay - 2> /dev/null &
|
337
|
fi
|
338
|
uci set radio.@radio[0].state=16
|
339
|
CHPLAY=$CH16
|
340
|
NAMEPLAY=$NAME16
|
341
|
STATE="16"
|
342
|
echo $CH16
|
343
|
echo $NAME16
|
344
|
;;
|
345
|
100 )
|
346
|
killall wget 2> /dev/null
|
347
|
killall meta-ser 2> /dev/null
|
348
|
killall madplay 2> /dev/null
|
349
|
/usr/bin/sleep 0.2
|
350
|
wget -q --save-headers --header='Icy-MetaData:1' -O - $CHPLAY | meta-ser | madplay - 2> /dev/null &
|
351
|
uci set radio.@radio[0].state=$STATE
|
352
|
PLAY="1"
|
353
|
echo "Play"
|
354
|
echo $CHPLAY
|
355
|
echo $NAMEPLAY
|
356
|
;;
|
357
|
101 )
|
358
|
killall wget 2> /dev/null
|
359
|
killall meta-ser 2> /dev/null
|
360
|
killall madplay 2> /dev/null
|
361
|
/usr/bin/sleep 0.2
|
362
|
echo "NM06 " > /dev/ttyS0
|
363
|
/usr/bin/sleep 0.1
|
364
|
echo "ST06 " > /dev/ttyS0
|
365
|
PLAY="0"
|
366
|
echo "Stop"
|
367
|
echo $CHPLAY
|
368
|
echo $NAMEPLAY
|
369
|
;;
|
370
|
* )
|
371
|
killall wget 2> /dev/null
|
372
|
killall meta-ser 2> /dev/null
|
373
|
killall madplay 2> /dev/null
|
374
|
uci set radio.@radio[0].state=0
|
375
|
;;
|
376
|
esac
|
377
|
done
|