Importing music from a directory
This commit is contained in:
parent
fc86a24477
commit
c60aea3580
|
@ -156,10 +156,71 @@ function reconfigure_koel {
|
|||
echo -n ''
|
||||
}
|
||||
|
||||
function configure_interactive_koel {
|
||||
function koel_import_from_directory {
|
||||
data=$(tempfile 2>/dev/null)
|
||||
dialog --title "test" --dselect /home/$MY_USERNAME/ 30 60 2> $data
|
||||
selected_dir=$(cat $data)
|
||||
rm $data
|
||||
if [[ "$selected_dir" == '/music' ]]; then
|
||||
return
|
||||
fi
|
||||
if [ ! -d $selected_dir ]; then
|
||||
return
|
||||
fi
|
||||
if [[ "$selected_dir" == "/home/$MY_USERNAME/" ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ "$selected_dir" == "/home/$MY_USERNAME/."* ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ "$selected_dir" == *"/Maildir" || "$selected_dir" == *"/Sync" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
dialog --title $"Import music directory" \
|
||||
--backtitle $"Freedombone Control Panel" \
|
||||
--defaultno \
|
||||
--yesno $"\nImport the directory:\n\n $selected_dir" 12 75
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) return;;
|
||||
255) return;;
|
||||
esac
|
||||
|
||||
mv $selected_dir /music
|
||||
|
||||
dialog --title $"Import music directory" \
|
||||
--msgbox $"Import success. You may need to re-sync within Koel." 6 40
|
||||
}
|
||||
|
||||
function koel_import_from_usb {
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function configure_interactive_koel {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Koel" \
|
||||
--radiolist $"Choose an operation:" 13 70 3 \
|
||||
1 $"Import music from directory" off \
|
||||
2 $"Import music from USB drive" off \
|
||||
3 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) koel_import_from_directory;;
|
||||
2) koel_import_from_usb;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function upgrade_koel {
|
||||
if grep -q "koel domain" $COMPLETION_FILE; then
|
||||
KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
|
||||
|
|
Loading…
Reference in New Issue