浏览代码

koel configuration menu style

Bob Mottram 7 年前
父节点
当前提交
383619b029
共有 1 个文件被更改,包括 13 次插入20 次删除
  1. 13
    20
      src/freedombone-app-koel

+ 13
- 20
src/freedombone-app-koel 查看文件

272
 
272
 
273
 
273
 
274
 function configure_interactive_koel {
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
     while true
280
     while true
276
     do
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
             1) koel_import_from_directory;;
290
             1) koel_import_from_directory;;
295
             2) koel_import_from_usb;;
291
             2) koel_import_from_usb;;
296
             3) koel_export_to_usb;;
292
             3) koel_export_to_usb;;
297
             4) format_music_drive;;
293
             4) format_music_drive;;
298
-            5) rm -f "$data"
299
-               break;;
300
         esac
294
         esac
301
-        rm -f "$data"
302
     done
295
     done
303
 }
296
 }
304
 
297