Browse Source

Option to format a usb drive to store music

Bob Mottram 7 years ago
parent
commit
31ffa567d6
1 changed files with 28 additions and 3 deletions
  1. 28
    3
      src/freedombone-app-koel

+ 28
- 3
src/freedombone-app-koel View File

@@ -230,6 +230,29 @@ function koel_export_to_usb {
230 230
     dialog --title $"Export music to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50
231 231
 }
232 232
 
233
+function format_music_drive {
234
+    detect_usb_drive
235
+    data=$(tempfile 2>/dev/null)
236
+    trap "rm -f $data" 0 1 2 5 15
237
+    dialog --title $"Format USB drive $USB_DRIVE for music storage" \
238
+           --backtitle $"Freedombone Control Panel" \
239
+           --defaultno \
240
+           --yesno $"\nPlease confirm that you wish to format drive\n\n    ${USB_DRIVE}\n\nAll current data on the drive will be lost, and you will be prompted to give a password used to encrypt the drive.\n\nDANGER: If you screw up here and format the wrong drive it's your own fault!" 16 60
241
+    sel=$?
242
+    case $sel in
243
+        1) return;;
244
+        255) return;;
245
+    esac
246
+
247
+    clear
248
+    echo ''
249
+    echo $"Formatting drive $USB_DRIVE. ALL CONTENTS WILL BE LOST."
250
+    echo ''
251
+    ${PROJECT_NAME}-format $USB_DRIVE
252
+    dialog --title $"Format USB drive $USB_DRIVE for music storage" --msgbox $'Format complete. You may now export music or remove the USB drive' 6 50
253
+}
254
+
255
+
233 256
 function configure_interactive_koel {
234 257
     while true
235 258
     do
@@ -237,11 +260,12 @@ function configure_interactive_koel {
237 260
         trap "rm -f $data" 0 1 2 5 15
238 261
         dialog --backtitle $"Freedombone Control Panel" \
239 262
                --title $"Koel" \
240
-               --radiolist $"Choose an operation:" 14 70 4 \
263
+               --radiolist $"Choose an operation:" 15 70 5 \
241 264
                1 $"Import music from directory" off \
242 265
                2 $"Import music from USB drive" off \
243 266
                3 $"Export music to USB drive" off \
244
-               4 $"Exit" on 2> $data
267
+               4 $"Format a USB drive for music storage" off \
268
+               5 $"Exit" on 2> $data
245 269
         sel=$?
246 270
         case $sel in
247 271
             1) break;;
@@ -251,7 +275,8 @@ function configure_interactive_koel {
251 275
             1) koel_import_from_directory;;
252 276
             2) koel_import_from_usb;;
253 277
             3) koel_export_to_usb;;
254
-            4) break;;
278
+            4) format_music_drive;;
279
+            5) break;;
255 280
         esac
256 281
     done
257 282
 }