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
     dialog --title $"Import music from USB drive" --msgbox $'Import complete. You may now remove the USB drive' 6 50
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
 function configure_interactive_koel {
233
 function configure_interactive_koel {
216
     while true
234
     while true
217
     do
235
     do
219
         trap "rm -f $data" 0 1 2 5 15
237
         trap "rm -f $data" 0 1 2 5 15
220
         dialog --backtitle $"Freedombone Control Panel" \
238
         dialog --backtitle $"Freedombone Control Panel" \
221
                --title $"Koel" \
239
                --title $"Koel" \
222
-               --radiolist $"Choose an operation:" 13 70 3 \
240
+               --radiolist $"Choose an operation:" 14 70 4 \
223
                1 $"Import music from directory" off \
241
                1 $"Import music from directory" off \
224
                2 $"Import music from USB drive" off \
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
         sel=$?
245
         sel=$?
227
         case $sel in
246
         case $sel in
228
             1) break;;
247
             1) break;;
231
         case $(cat $data) in
250
         case $(cat $data) in
232
             1) koel_import_from_directory;;
251
             1) koel_import_from_directory;;
233
             2) koel_import_from_usb;;
252
             2) koel_import_from_usb;;
234
-            3) break;;
253
+            3) koel_export_to_usb;;
254
+            4) break;;
235
         esac
255
         esac
236
     done
256
     done
237
 }
257
 }