Bläddra i källkod

Option to format a usb drive to store music

Bob Mottram 8 år sedan
förälder
incheckning
31ffa567d6
1 ändrade filer med 28 tillägg och 3 borttagningar
  1. 28
    3
      src/freedombone-app-koel

+ 28
- 3
src/freedombone-app-koel Visa fil

230
     dialog --title $"Export music to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50
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
 function configure_interactive_koel {
256
 function configure_interactive_koel {
234
     while true
257
     while true
235
     do
258
     do
237
         trap "rm -f $data" 0 1 2 5 15
260
         trap "rm -f $data" 0 1 2 5 15
238
         dialog --backtitle $"Freedombone Control Panel" \
261
         dialog --backtitle $"Freedombone Control Panel" \
239
                --title $"Koel" \
262
                --title $"Koel" \
240
-               --radiolist $"Choose an operation:" 14 70 4 \
263
+               --radiolist $"Choose an operation:" 15 70 5 \
241
                1 $"Import music from directory" off \
264
                1 $"Import music from directory" off \
242
                2 $"Import music from USB drive" off \
265
                2 $"Import music from USB drive" off \
243
                3 $"Export music to USB drive" off \
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
         sel=$?
269
         sel=$?
246
         case $sel in
270
         case $sel in
247
             1) break;;
271
             1) break;;
251
             1) koel_import_from_directory;;
275
             1) koel_import_from_directory;;
252
             2) koel_import_from_usb;;
276
             2) koel_import_from_usb;;
253
             3) koel_export_to_usb;;
277
             3) koel_export_to_usb;;
254
-            4) break;;
278
+            4) format_music_drive;;
279
+            5) break;;
255
         esac
280
         esac
256
     done
281
     done
257
 }
282
 }