Browse Source

icecast configuration menu style

Bob Mottram 7 years ago
parent
commit
55906ffcd6
1 changed files with 20 additions and 27 deletions
  1. 20
    27
      src/freedombone-app-icecast

+ 20
- 27
src/freedombone-app-icecast View File

@@ -401,32 +401,28 @@ function icecast_set_maximum_streams {
401 401
 }
402 402
 
403 403
 function configure_interactive_icecast {
404
+    W=(1 $"Import stream files from directory"
405
+       2 $"Import stream files from USB drive"
406
+       3 $"Format a USB drive for stream file storage"
407
+       4 $"Export stream files to USB drive"
408
+       5 $"Manually edit playlist"
409
+       6 $"Enable login for stream visitors"
410
+       7 $"Change password for stream visitors"
411
+       8 $"Re-scan playlist"
412
+       9 $"Restart stream"
413
+       10 $"Set Stream Name/Description/Genre"
414
+       11 $"Set maximum number of clients/streams")
415
+
404 416
     while true
405 417
     do
406
-        data=$(mktemp 2>/dev/null)
407
-        dialog --backtitle $"Freedombone Control Panel" \
408
-               --title $"Icecast" \
409
-               --radiolist $"Choose an operation:" 19 70 12 \
410
-               1 $"Import stream files from directory" off \
411
-               2 $"Import stream files from USB drive" off \
412
-               3 $"Format a USB drive for stream file storage" off \
413
-               4 $"Export stream files to USB drive" off \
414
-               5 $"Manually edit playlist" off \
415
-               6 $"Enable login for stream visitors" off \
416
-               7 $"Change password for stream visitors" off \
417
-               8 $"Re-scan playlist" off \
418
-               9 $"Restart stream" off \
419
-               10 $"Set Stream Name/Description/Genre" off \
420
-               11 $"Set maximum number of clients/streams" off \
421
-               12 $"Exit" on 2> "$data"
422
-        sel=$?
423
-        case $sel in
424
-            1) rm -f "$data"
425
-               break;;
426
-            255) rm -f "$data"
427
-                 break;;
428
-        esac
429
-        case $(cat "$data") in
418
+        # shellcheck disable=SC2068
419
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Icecast" --menu $"Choose an operation, or ESC to exit:" 20 60 11 "${W[@]}" 3>&2 2>&1 1>&3)
420
+
421
+        if [ ! "$selection" ]; then
422
+            break
423
+        fi
424
+
425
+        case $selection in
430 426
             1) icecast_import_from_directory;;
431 427
             2) icecast_import_from_usb;;
432 428
             3) icecast_format_drive;;
@@ -443,10 +439,7 @@ function configure_interactive_icecast {
443 439
                start_icecast;;
444 440
             10) icecast_set_stream_name;;
445 441
             11) icecast_set_maximum_streams;;
446
-            12) rm -f "$data"
447
-                break;;
448 442
         esac
449
-        rm -f "$data"
450 443
     done
451 444
 }
452 445