Option to format a usb drive to store music

This commit is contained in:
Bob Mottram 2017-05-25 22:03:31 +01:00
parent 0fdbc41739
commit 31ffa567d6
1 changed files with 28 additions and 3 deletions

View File

@ -230,6 +230,29 @@ function koel_export_to_usb {
dialog --title $"Export music to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50 dialog --title $"Export music to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50
} }
function format_music_drive {
detect_usb_drive
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"Format USB drive $USB_DRIVE for music storage" \
--backtitle $"Freedombone Control Panel" \
--defaultno \
--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
sel=$?
case $sel in
1) return;;
255) return;;
esac
clear
echo ''
echo $"Formatting drive $USB_DRIVE. ALL CONTENTS WILL BE LOST."
echo ''
${PROJECT_NAME}-format $USB_DRIVE
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
}
function configure_interactive_koel { function configure_interactive_koel {
while true while true
do do
@ -237,11 +260,12 @@ function configure_interactive_koel {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
--title $"Koel" \ --title $"Koel" \
--radiolist $"Choose an operation:" 14 70 4 \ --radiolist $"Choose an operation:" 15 70 5 \
1 $"Import music from directory" off \ 1 $"Import music from directory" off \
2 $"Import music from USB drive" off \ 2 $"Import music from USB drive" off \
3 $"Export music to USB drive" off \ 3 $"Export music to USB drive" off \
4 $"Exit" on 2> $data 4 $"Format a USB drive for music storage" off \
5 $"Exit" on 2> $data
sel=$? sel=$?
case $sel in case $sel in
1) break;; 1) break;;
@ -251,7 +275,8 @@ function configure_interactive_koel {
1) koel_import_from_directory;; 1) koel_import_from_directory;;
2) koel_import_from_usb;; 2) koel_import_from_usb;;
3) koel_export_to_usb;; 3) koel_export_to_usb;;
4) break;; 4) format_music_drive;;
5) break;;
esac esac
done done
} }