Ver código fonte

koel configuration menu style

Bob Mottram 7 anos atrás
pai
commit
383619b029
1 arquivos alterados com 13 adições e 20 exclusões
  1. 13
    20
      src/freedombone-app-koel

+ 13
- 20
src/freedombone-app-koel Ver arquivo

@@ -272,33 +272,26 @@ function format_music_drive {
272 272
 
273 273
 
274 274
 function configure_interactive_koel {
275
+    W=(1 $"Import music from directory"
276
+       2 $"Import music from USB drive"
277
+       3 $"Export music to USB drive"
278
+       4 $"Format a USB drive for music storage")
279
+
275 280
     while true
276 281
     do
277
-        data=$(mktemp 2>/dev/null)
278
-        dialog --backtitle $"Freedombone Control Panel" \
279
-               --title $"Koel" \
280
-               --radiolist $"Choose an operation:" 12 70 5 \
281
-               1 $"Import music from directory" off \
282
-               2 $"Import music from USB drive" off \
283
-               3 $"Export music to USB drive" off \
284
-               4 $"Format a USB drive for music storage" off \
285
-               5 $"Exit" on 2> "$data"
286
-        sel=$?
287
-        case $sel in
288
-            1) rm -f "$data"
289
-               break;;
290
-            255) rm -f "$data"
291
-                 break;;
292
-        esac
293
-        case $(cat "$data") in
282
+        # shellcheck disable=SC2068
283
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Koel" --menu $"Choose an operation, or ESC to exit:" 12 60 4 "${W[@]}" 3>&2 2>&1 1>&3)
284
+
285
+        if [ ! "$selection" ]; then
286
+            break
287
+        fi
288
+
289
+        case $selection in
294 290
             1) koel_import_from_directory;;
295 291
             2) koel_import_from_usb;;
296 292
             3) koel_export_to_usb;;
297 293
             4) format_music_drive;;
298
-            5) rm -f "$data"
299
-               break;;
300 294
         esac
301
-        rm -f "$data"
302 295
     done
303 296
 }
304 297