ソースを参照

dlna configuration menu style

Bob Mottram 7 年 前
コミット
5c410c4b34
共有1 個のファイルを変更した11 個の追加18 個の削除を含む
  1. 11
    18
      src/freedombone-app-dlna

+ 11
- 18
src/freedombone-app-dlna ファイルの表示

@@ -47,29 +47,22 @@ function logging_off_dlna {
47 47
 }
48 48
 
49 49
 function configure_interactive_dlna {
50
+    W=(1 $"Attach a drive containing playable media"
51
+       2 $"Remove a drive containing playable media")
52
+
50 53
     while true
51 54
     do
52
-        data=$(mktemp 2>/dev/null)
53
-        dialog --backtitle $"Freedombone Control Panel" \
54
-               --title $"Media Menu" \
55
-               --radiolist $"Choose an operation:" 13 70 3 \
56
-               1 $"Attach a drive containing playable media" off \
57
-               2 $"Remove a drive containing playable media" off \
58
-               3 $"Exit" on 2> "$data"
59
-        sel=$?
60
-        case $sel in
61
-            1) rm -f "$data"
62
-               break;;
63
-            255) rm -f "$data"
64
-                 break;;
65
-        esac
66
-        case $(cat "$data") in
55
+        # shellcheck disable=SC2068
56
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Media Menu" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3)
57
+
58
+        if [ ! "$selection" ]; then
59
+            break
60
+        fi
61
+
62
+        case $selection in
67 63
             1) attach-music;;
68 64
             2) remove-music;;
69
-            3) rm -f "$data"
70
-               break;;
71 65
         esac
72
-        rm -f "$data"
73 66
     done
74 67
 }
75 68