-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathPreConfiguration.sh
649 lines (649 loc) · 24.7 KB
/
PreConfiguration.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
#!/bin/bash
set +e #
echo -e "\e[92m _ ______ ___ __ ______\e[0m" #
echo -e "\e[92m / | / / __ < / / / / / _/\e[0m" #
echo -e "\e[92m / |/ / /_/ / /_____/ / / // / \e[0m" #
echo -e "\e[92m / /| / _, _/ /_____/ /_/ // / \e[0m" #
echo -e "\e[92m/_/ |_/_/ |_/_/ \____/___/ \e[0m" #
echo "" #
echo -e "\e[92mConfiguration-Utility\e[0m" #
echo "" #
echo "_________________________________________________________ " #
echo " " #
echo -e "\e[4;92mDo you want to use Spectrum/VU-Meter?\e[0;0m" #
echo -e "\e[92m(This enables two CAVA instances)\e[0m" #
echo "" #
echo -e "\e[91m---> This needs some resources!!! " #
echo -e "-> Better use Pi3 or above.\e[0m" #
echo " " #
echo "______________________ " #
echo " " #
echo -e "\e[93mValid selections are: \e[0m" #
echo -e "1 -> \e[92mYes\e[0m" #
echo -e "2 -> \e[91mNo\e[0m" #
echo -e "\e[93m--->\e[0m" #" #
getCAVATag() { #
read -p "Enter your decision: " CAVATag #
case "$CAVATag" in #
1) #
sed -i 's/\(SpectrumActive = \)\(.*\)/\1True/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mCAVA/Spectrum will be installed...\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(SpectrumActive = \)\(.*\)/\1False/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mCAVA/Spectrum won't be installed...\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
until getCAVATag; do : ; done #
echo "________________________________________________________________________ " #
echo " " #
echo " " #
echo -e "\e[4;92mDo you want to activate Album-Art-Tool for NR1-UI-Remote?\e[0;0m" #
echo " " #
echo -e "More informations under: \e[93mhttps://github.com/Maschine2501/NR1-UI-Remote\e[0m" #
echo " " #
echo -e "\e[25;91mIf you select YES you'll get a promt, select: "'"Standalone"'" \e[0;0m" #
echo "______________________ " #
echo " " #
echo -e "\e[93mValid selections are: \e[0m" #
echo -e "1 -> \e[92mYes\e[0m" #
echo -e "2 -> \e[91mNo\e[0m" #
echo -e "\e[93m--->\e[0m" #
cd #
getRemote() { #
read -p "Enter your decision: " Remote #
case "$Remote" in #
1) #
sed -i 's/\(NR1UIRemoteActive = \)\(.*\)/\1True/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sudo apt install -y proftpd-basic #
sudo cp /home/volumio/NR1-UI/ConfigurationFiles/proftpd/proftpd.conf /etc/proftpd #
sudo cp /home/volumio/NR1-UI/ConfigurationFiles/proftpd/proftp-custom.conf /etc/proftpd/conf.d #
sudo mkdir /home/volumio/proftpd #
sudo chmod 777 /home/volumio/proftpd #
sudo cp /home/volumio/NR1-UI/ConfigurationFiles/proftpd/controls.log /home/volumio/proftpd #
sudo cp /home/volumio/NR1-UI/ConfigurationFiles/proftpd/proftpd.log /home/volumio/proftpd #
sudo service proftpd restart #
echo " " #
echo -e "\e[92mAlbum-Art-Tool is activated...\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(NR1UIRemoteActive = \)\(.*\)/\1False/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py
echo " " #
echo -e "\e[92mAlbum-Art-Tool is not active...\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
until getRemote; do : ; done #
cd #
if [[ $CAVATag -eq 1 ]];
then
echo -e "\e[92mInstalling Cava...\e[0m" #
git clone https://github.com/Maschine2501/cava.git #
cd cava #
sudo bash autogen.sh #
./configure && make -j4 && sudo make install #
cd #
git clone https://github.com/Maschine2501/cava2.git /home/volumio/CAVAinstall #
cd /home/volumio/CAVAinstall #
sudo bash ./autogen.sh #
./configure --prefix=/home/volumio/CAVA2 && make -j4 && sudo make install #
cd #
sudo cp /home/volumio/NR1-UI/service-files/cava1.service /lib/systemd/system/ #
sudo cp /home/volumio/NR1-UI/service-files/cava2.service /lib/systemd/system/ #
sudo systemctl daemon-reload #
sudo systemctl enable cava1.service #
sudo systemctl enable cava2.service #
fi
if [[ $CAVATag -eq 1 ]];
then
sudo sudo cp /home/volumio/NR1-UI/ConfigurationFiles/mpd.conf.tmpl /volumio/app/plugins/music_service/mpd #
echo " " #
echo " " #
echo -e "\e[92mFifo-Audio-Outputs for Cava has been added to mpd.conf\e[0m" #
echo " " #
echo " " #
sudo service mpd restart #
fi
echo "_________________________________________________________________ " #
echo " " #
echo " " #
echo -e "\e[4;92mPlease select your Display-Type.\e[0;0m" #
echo " " #
echo " " #
echo "_____________________ " #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> for \e[92mssd1306\e[0m" #
echo -e "2 -> for \e[92mssd1322\e[0m" #
echo -e "3 -> for \e[92mBraun-specific\e[0m" #
echo -e "\e[93m---> \e[0m" #
getDisplayType() { #
read -p "Enter your decision: " DisplayNumber #
case "$DisplayNumber" in #
1) #
sed -i 's/\(DisplayTechnology = \)\(.*\)/\1"'"i2c1306"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mSet Display-Type as ssd1306\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(DisplayTechnology = \)\(.*\)/\1"'"spi1322"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mSet Display-Type as ssd1322\e[0m" #
return 0 #
;; #
3) #
sed -i 's/\(DisplayTechnology = \)\(.*\)/\1"'"Braun"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mSet Display-Type as Braun-Specific\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2' or '3'" #
return 1 #
;; #
esac #
} #
until getDisplayType; do : ; done #
echo "_________________________________________________________________ " #
echo " " #
getScreenLayout1306() { #
read -p "Enter your decision: " DisplayNumber #
case "$DisplayNumber" in #
1) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Spectrum-Screen"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Spectrum-Screen" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Layout as Spectrum-Screen\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Progress-Bar"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Progress-Bar" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Layout as Progress-Bar\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter a number between '1' and '2'" #
return 1 #
;; #
esac #
} #
getScreenLayout1322() { #
read -p "Enter your decision: " DisplayNumber #
case "$DisplayNumber" in #
1) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Spectrum-Left"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Spectrum-Left" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as Spectrum-Left\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Spectrum-Center"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Spectrum-Center" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as Spectrum-Center\e[0m" #
return 0 #
;; #
3) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Spectrum-Right"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Spectrum-Right" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as Spcetrum-Right\e[0m" #
return 0 #
;; #
4) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"No-Spectrum"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "No-Spectrum" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as No-Spectrum\e[0m" #
return 0 #
;; #
5) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Modern"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as Modern\e[0m" #
return 0 #
;; #
6) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"VU-Meter-1"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "VU-Meter-1" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as VU-Meter-1\e[0m" #
return 0 #
;; #
7) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"VU-Meter-2"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "VU-Meter-2" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as VU-Meter-2\e[0m" #
return 0 #
;; #
8) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"VU-Meter-Bar"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "VU-Meter-Bar" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as VU-Meter-Bar\e[0m" #
return 0 #
;; #
9) #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Modern-simplistic"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Modern-simplistic" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
echo " " #
echo -e "\e[92mSet Screen Layout as Modern-simplistic\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter a number between '1' and '9'" #
return 1 #
;; #
esac #
} #
if [[ $CAVATag -eq 2 && $DisplayNumber -eq 1 ]];
then #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Progress-Bar"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Progress-Bar" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
fi
if [[ $CAVATag -eq 2 && $DisplayNumber -eq 2 ]];
then
#else
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"No-Spectrum"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "No-Spectrum" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
fi #
if [[ $CAVATag -eq 1 ]];
then
echo "" #
echo -e "\e[4;92mPlease select your Screen Layout.\e[0;;0m" #
echo ""#
echo -e "\e[93mYou can find Previews/Screenshots here: \e[0m" #
echo -e "\e[93mhttps://github.com/Maschine2501/NR1-UI \e[0m" #
if [ $DisplayNumber -eq 1 ]; #
then #
echo "_____________________" #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> \e[92mSpectrum-Screen\e[0m" #
echo -e "2 -> \e[92mProgress-Bar\e[0m" #
echo -e "\e[93m---> \e[0m" #
until getScreenLayout1306; do : ; done #
else #
echo "_____________________ " #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> for \e[92mSpectrum-Left\e[0m" #
echo -e "2 -> for \e[92mSpectrum-Center\e[0m" #
echo -e "3 -> for \e[92mSpectrum-Right\e[0m" #
echo -e "4 -> for \e[92mNo-Spectrum\e[0m" #
echo -e "5 -> for \e[92mModern\e[0m" #
echo -e "6 -> for \e[92mVU-Meter-1\e[0m" #
echo -e "7 -> for \e[92mVU-Meter-2\e[0m" #
echo -e "8 -> for \e[92mVU-Meter-Bar\e[0m" #
echo -e "9 -> for \e[92mModern-simplistic\e[0m" #
echo -e "\e[93m---> \e[0m" #
until getScreenLayout1322; do : ; done #
fi
fi #
if [[ $CAVATag -eq 2 ]]; #
then #
if [ $DisplayNumber -eq 1 ];
then #
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"Progress-Bar"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "Progress-Bar" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
#fi
#if [ $DisplayNumber -eq 2 ]; #
else
sed -i 's/\(NowPlayingLayout = \)\(.*\)/\1"'"No-Spectrum"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "No-Spectrum" > /home/volumio/NR1-UI/ConfigurationFiles/LayoutSet.txt #
fi
fi #
echo "_________________________________________________________________ " #
echo " " #
echo -e "\e[4;92mShould the Display be rotated? \e[0;0m" #
echo " " #
echo "_____________________ " #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> \e[92mDisplay not rotated\e[0m" #
echo -e "2 -> \e[92mDisplay rotated 180 degrees \e[0m" #
echo -e "\e[93m---> \e[0m" #
getDisplayRotation() { #
read -p "Enter your decision: " RotationNumber #
case "$RotationNumber" in #
1) #
sed -i 's/\(oledrotation = \)\(.*\)/\10/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mSet Display-Rotation to zero Rotation.\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(oledrotation = \)\(.*\)/\12/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mSet Display-Rotation to 180 degrees Rotation\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
until getDisplayRotation; do : ; done #
echo "_________________________________________________________________ " #
echo " " #
echo -e "\e[4;92mDo you use LED's?\e[0m" #
echo " " #
echo -e "\e[93mMore informations here: \e[0m" #
echo -e "\e[93mhttps://github.com/Maschine2501/NR1-UI/wiki/LED-Wiring \e[0m" #
echo " " #
echo "_____________________ " #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> \e[92mYes\e[0m" #
echo -e "2 -> \e[91mNo\e[0m" #
echo -e "\e[93m---> \e[0m" #
getLEDUsage() { #
read -p "Enter your decision: " LEDUsageNumber #
case "$LEDUsageNumber" in #
1) #
sed -i 's/\(ledActive = \)\(.*\)/\1True/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mActivated LED-Option\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(ledActive = \)\(.*\)/\1False/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(ledTechnology = \)\(.*\)/\1None/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mDeactivated LED-Option\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
until getLEDUsage; do : ; done #
getLEDType() { #
read -p "Enter your decision: " LEDTypeNumber #
case "$LEDTypeNumber" in #
1) #
sed -i 's/\(ledTechnology = \)\(.*\)/\1"'"GPIOusage"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo -e "\e[92mActivated LED-Type: GPIO\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(ledTechnology = \)\(.*\)/\1"'"pcf8574usage"'"/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo -e "\e[92mActivated LED-Type: PCF8574\e[0m" #
echo " " #
echo " " #
/bin/bash /home/volumio/NR1-UI/pcf-i2c-adress-config.sh
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
if [ $LEDUsageNumber -eq 1 ]; then #
echo "_________________________________________________________________ " #
echo " " #
echo -e "\e[4;92mPlease select your LED Technology:\e[0;0m" #
echo " " #
echo -e "\e[93mMore informations here: \e[0m" #
echo -e "\e[93mhttps://github.com/Maschine2501/NR1-UI/wiki/LED-Wiring \e[0;0m" #
echo " " #
echo "_____________________" #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> \e[92mif you connect LED's directly to the GPIO's of the Raspberry\e[0m" #
echo -e "2 -> \e[92mif you use an PCF8574 i2c device\e[0m" #
echo -e "\e[93m---> \e[0m" #
until getLEDType; do : ; done #
fi #
echo "_________________________________________________________________ " #
echo " " #
echo -e "\e[4;92mDo you use the Standby-Circuit?\e[0;0m" #
echo " " #
echo -e "\e[93mMore informations here: \e[0m" #
echo -e "\e[93mhttps://github.com/Maschine2501/NR1-UI/wiki/Standby-Module \e[0;0m" #
echo " " #
echo -e "\e[4;91mWARNING: Do not select YES if you do not have connected the circuit!!!\e[0;0m" #
echo " " #
echo "______________________ " #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "1 -> \e[92mYes\e[0m" #
echo -e "2 -> \e[91mNo\e[0m" #
echo -e "\e[93m----> \e[0m" #
StandbyUsage() { #
read -p "Enter your decision: " StandbyNumber #
case "$StandbyNumber" in #
1) #
sed -i 's/\(StandbyActive = \)\(.*\)/\1True/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo "dtoverlay=gpio-shutdown" >> /boot/userconfig.txt #
echo " " #
echo -e "\e[92mActivated Standby-Function\e[0m" #
return 0 #
;; #
2) #
sed -i 's/\(StandbyActive = \)\(.*\)/\1False/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mDeactivated Standby-Function\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
until StandbyUsage; do : ; done #
echo "_________________________________________________________________ " #
echo " " #
echo -e "\e[4;92mPlease select your Button- / Rotary- configuration\e[0;0m" #
echo " " #
echo -e "\e[93m*standard*-configuration means a conection like this: \e[0m" #
echo -e "\e[93mhttps://raw.githubusercontent.com/Maschine2501/NR1-UI/master/wiki/wiring/Wiring.jpg\e[0m" #
echo " " #
echo "_____________________" #
echo -e "\e[93mValid selections are:\e[0m" #
echo -e "\e[92m1 -> standard\e[0m" #
echo -e "\e[91m2 -> custom\e[0m" #
echo -e "\e[93m--->\e[0m" #
getGPIONumberA() { #
read -p "Please enter the BCM Number for Button A :" ANumber #
case "$ANumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledBtnA = \)\(.*\)/\1$ANumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
} #
getGPIONumberB() { #
read -p "Please enter the BCM Number for Button B :" BNumber #
case "$BNumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledBtnB = \)\(.*\)/\1$BNumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
} #
getGPIONumberC() { #
read -p "Please enter the BCM Number for Button C :" CNumber #
case "$CNumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledBtnC = \)\(.*\)/\1$CNumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
} #
getGPIONumberD() { #
read -p "Please enter the BCM Number for Button D :" DNumber #
case "$DNumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledBtnD = \)\(.*\)/\1$DNumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
} #
getGPIONumberL() { #
read -p "Please enter the BCM Number for Rotary-Left :" LNumber #
case "$LNumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledRtrLeft = \)\(.*\)/\1$LNumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
} #
getGPIONumberR() { #
read -p "Please enter the BCM Number for Rotary-Right :" RNumber #
case "$RNumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledRtrRight = \)\(.*\)/\1$RNumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
} #
getGPIONumberRB() { #
read -p "Please enter the BCM Number for Rotary-Button :" RBNumber #
case "$RBNumber" in #
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27) #
sed -i "s/\(oledRtrBtn = \)\(.*\)/\1$RBNumber/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
return 0 #
;; #
*) #
printf %s\\n "Number was out of range...(must be 0-27)" #
return 1 #
;; #
esac #
}
getButtonLayout() { #
read -p "Enter your decision: " ButonNumber #
case "$ButonNumber" in #
1) #
sed -i 's/\(oledBtn = \)\(.*\)/\14/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(oledBtn = \)\(.*\)/\117/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(oledBtn = \)\(.*\)/\15/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(oledBtn = \)\(.*\)/\16/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(oledRtrLeft = \)\(.*\)/\122/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(oledRtrRight = \)\(.*\)/\123/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
sed -i 's/\(oledRtrBtn = \)\(.*\)/\127/' /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -e "\e[92mSet standard-buttonlayout\e[0m" #
return 0 #
;; #
2) #
echo -e "\e[4;92mPlease Enter the BCM-(GPIO) Number for each Button.\e[0;0m" #
echo " " #
echo -e "\e[93mFor BCM2 enter 2, for BCM17 enter 17...\e[0m" #
echo -e "\e[93mBCM-list: https://de.pinout.xyz/#\e[0m" #
echo " " #
echo -e "\e[91mthe input is not filtered!!!\e[0m" #
echo -e "\e[91m-> if you enter something wrong, something wrong will happen!\e[0m" #
echo " " #
until getGPIONumberA; do : ; done #
until getGPIONumberB; do : ; done #
until getGPIONumberC; do : ; done #
until getGPIONumberD; do : ; done #
until getGPIONumberL; do : ; done #
until getGPIONumberR; do : ; done #
until getGPIONumberRB; do : ; done #
echo " " #
echo -e "\e[92mSet custom-buttonlayout\e[0m" #
return 0 #
;; #
*) #
printf %s\\n "Please enter '1' or '2'" #
return 1 #
;; #
esac #
} #
until getButtonLayout; do : ; done #
echo "_________________________________________________________________" #
echo " " #
echo -e "\e[4;92mPlease enter a Value for Pause -> to -> Stop -Time.\e[0;0m" #
echo " " #
echo -e "\e[93mValue is in Seconds = 15 = 15 Seconds.\e[0m" #
echo -e "\e[93mAfter this time, while playback is paused, player will Stop and return to Standby-Screen.\e[0;0m" #
echo " " #
echo "____________________________________________ " #
echo -e "\e[93mValid values are numbers between 1 and 86400\e[0m" #
echo -e "\e[93m86400 seconds are 24 hours...\e[0m" #
echo " " #
getPlay2PauseTime() { #
read -p "Enter a Time (in seconds): " Play2PauseT #
case "$Play2PauseT" in #
[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-8][0-6][0-3][0-9][0-9]|86400) #
sed -i "s/\(oledPause2StopTime = \)\(.*\)/\1$Play2PauseT.0/" /home/volumio/NR1-UI/ConfigurationFiles/PreConfiguration.py #
echo " " #
echo -n "Set Play-to-Pause timer to "; echo -n "${Play2PauseT} "; echo -n "seconds" #
return 0 #
;; #
*) #
printf %s\\n "Please enter a number between '1' and '86400'" #
return 1 #
;; #
esac #
} #
until getPlay2PauseTime; do : ; done #
echo " " #
echo " " #
echo " " #
echo " " #
echo -e "\e[4;92mConfiguration has finished, congratulations!\e[0;0m" #
echo " " #
echo " " #
echo -e "\e[93mPlease have a look in the Installation instructions to finish setup.\e[0m" #
echo " " #
echo -e "\e[93mhttps://github.com/Maschine2501/NR1-UI/wiki/Installation-Steps-(for-Python3.8.5-Version---Bash-Script)\e[0m" #
echo " " #
echo " " #
echo -e "\e[25;91mIf you use CAVA/Spectrum: \e[0;0m" #
echo " " #
echo -e "\e[91mPlease set Audio-Output to HDMI or Headphones and save setting.\e[0m" #
echo -e "\e[91mNow Select your DAC/Playback device and save aggain.\e[0m" #
exit 0 #