Browse Source

Export music to usb

Bob Mottram 7 years ago
parent
commit
597228ef89
1 changed files with 23 additions and 3 deletions
  1. 23
    3
      src/freedombone-app-koel

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

@@ -212,6 +212,24 @@ function koel_import_from_usb {
212 212
     dialog --title $"Import music from USB drive" --msgbox $'Import complete. You may now remove the USB drive' 6 50
213 213
 }
214 214
 
215
+function koel_export_to_usb {
216
+    clear
217
+    detect_usb_drive
218
+
219
+    if [ ! -b $USB_DRIVE ]; then
220
+        dialog --title $"Export music to USB drive" --msgbox $'No USB drive found' 6 50
221
+        return
222
+    fi
223
+
224
+    backup_mount_drive ${USB_DRIVE} ${MY_USERNAME}
225
+    if [ ! -d $USB_MOUNT/Music ]; then
226
+        mkdir -p $USB_MOUNT/Music
227
+    fi
228
+    cp -ru /music/* $USB_MOUNT/Music
229
+    backup_unmount_drive ${USB_DRIVE}
230
+    dialog --title $"Export music to USB drive" --msgbox $'Export complete. You may now remove the USB drive' 6 50
231
+}
232
+
215 233
 function configure_interactive_koel {
216 234
     while true
217 235
     do
@@ -219,10 +237,11 @@ function configure_interactive_koel {
219 237
         trap "rm -f $data" 0 1 2 5 15
220 238
         dialog --backtitle $"Freedombone Control Panel" \
221 239
                --title $"Koel" \
222
-               --radiolist $"Choose an operation:" 13 70 3 \
240
+               --radiolist $"Choose an operation:" 14 70 4 \
223 241
                1 $"Import music from directory" off \
224 242
                2 $"Import music from USB drive" off \
225
-               3 $"Exit" on 2> $data
243
+               3 $"Export music to USB drive" off \
244
+               4 $"Exit" on 2> $data
226 245
         sel=$?
227 246
         case $sel in
228 247
             1) break;;
@@ -231,7 +250,8 @@ function configure_interactive_koel {
231 250
         case $(cat $data) in
232 251
             1) koel_import_from_directory;;
233 252
             2) koel_import_from_usb;;
234
-            3) break;;
253
+            3) koel_export_to_usb;;
254
+            4) break;;
235 255
         esac
236 256
     done
237 257
 }