Bläddra i källkod

dlna configuration menu style

Bob Mottram 7 år sedan
förälder
incheckning
5c410c4b34
1 ändrade filer med 11 tillägg och 18 borttagningar
  1. 11
    18
      src/freedombone-app-dlna

+ 11
- 18
src/freedombone-app-dlna Visa fil

47
 }
47
 }
48
 
48
 
49
 function configure_interactive_dlna {
49
 function configure_interactive_dlna {
50
+    W=(1 $"Attach a drive containing playable media"
51
+       2 $"Remove a drive containing playable media")
52
+
50
     while true
53
     while true
51
     do
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
             1) attach-music;;
63
             1) attach-music;;
68
             2) remove-music;;
64
             2) remove-music;;
69
-            3) rm -f "$data"
70
-               break;;
71
         esac
65
         esac
72
-        rm -f "$data"
73
     done
66
     done
74
 }
67
 }
75
 
68