Export music to usb

This commit is contained in:
Bob Mottram 2017-05-25 21:45:01 +01:00
parent 5c446645aa
commit 597228ef89
1 changed files with 23 additions and 3 deletions

View File

@ -212,6 +212,24 @@ function koel_import_from_usb {
dialog --title $"Import music from USB drive" --msgbox $'Import complete. You may now remove the USB drive' 6 50
}
function koel_export_to_usb {
clear
detect_usb_drive
if [ ! -b $USB_DRIVE ]; then
dialog --title $"Export music to USB drive" --msgbox $'No USB drive found' 6 50
return
fi
backup_mount_drive ${USB_DRIVE} ${MY_USERNAME}
if [ ! -d $USB_MOUNT/Music ]; then
mkdir -p $USB_MOUNT/Music
fi
cp -ru /music/* $USB_MOUNT/Music
backup_unmount_drive ${USB_DRIVE}
dialog --title $"Export music to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50
}
function configure_interactive_koel {
while true
do
@ -219,10 +237,11 @@ function configure_interactive_koel {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Koel" \
--radiolist $"Choose an operation:" 13 70 3 \
--radiolist $"Choose an operation:" 14 70 4 \
1 $"Import music from directory" off \
2 $"Import music from USB drive" off \
3 $"Exit" on 2> $data
3 $"Export music to USB drive" off \
4 $"Exit" on 2> $data
sel=$?
case $sel in
1) break;;
@ -231,7 +250,8 @@ function configure_interactive_koel {
case $(cat $data) in
1) koel_import_from_directory;;
2) koel_import_from_usb;;
3) break;;
3) koel_export_to_usb;;
4) break;;
esac
done
}