Setup:
* normalize * rename * fat32compat * skip_mime-type * copy_mime-type
This commit is contained in:
parent
618e086799
commit
8f7c907fb9
@ -178,34 +178,159 @@ setupDestination() {
|
|||||||
Normalize (boolean):
|
Normalize (boolean):
|
||||||
Normalize output files.
|
Normalize output files.
|
||||||
EODesc
|
EODesc
|
||||||
|
case ${destinationnormalize["$destination"]} in
|
||||||
|
0) initialvalue=n ;;
|
||||||
|
1) initialvalue=y ;;
|
||||||
|
*) unset initialvalue ;;
|
||||||
|
esac
|
||||||
comeagain() {
|
comeagain() {
|
||||||
:
|
read \
|
||||||
|
-e \
|
||||||
|
${initialvalue+-i $initialvalue}\
|
||||||
|
-p'Normalize (y/N): ' \
|
||||||
|
value
|
||||||
|
case $value in
|
||||||
|
[yY])
|
||||||
|
destinationnormalize["$destination"]=1
|
||||||
|
;;
|
||||||
|
''|[nN])
|
||||||
|
destinationnormalize["$destination"]=0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
comeagain
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
comeagain
|
comeagain
|
||||||
cat <<-EODesc
|
cat <<-EODesc
|
||||||
|
|
||||||
|
Rename (string):
|
||||||
|
Destination files will be named according to <string>, after
|
||||||
|
expansion of special strings:
|
||||||
|
%{album},
|
||||||
|
%{albumartist},
|
||||||
|
%{artist},
|
||||||
|
%{disc},
|
||||||
|
%{genre},
|
||||||
|
%{title},
|
||||||
|
%{track},
|
||||||
|
%{year}.
|
||||||
|
Untagged files or files in unrecognized formats will not be changed.
|
||||||
|
|
||||||
|
Leave blank if you don't want file renaming.
|
||||||
EODesc
|
EODesc
|
||||||
|
initialvalue="${destinationrenamepath["$destination"]}"
|
||||||
|
initialvalue+="${initialvalue+/}"
|
||||||
|
initialvalue+="${destinationrename["$destination"]}"
|
||||||
|
read \
|
||||||
|
-e \
|
||||||
|
${initialvalue+-i"$initialvalue"} \
|
||||||
|
-p'Rename pattern: ' \
|
||||||
|
value
|
||||||
|
case "$value" in
|
||||||
|
*/*)
|
||||||
|
destinationrenamepath["$destination"]="${value%/*}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
destinationrename["$destination"]="${value##*/}"
|
||||||
|
cat <<-EODesc
|
||||||
|
|
||||||
|
FAT32 Compatibility (boolean):
|
||||||
|
Rename files for compatibility with FAT32 filesystems.
|
||||||
|
EODesc
|
||||||
|
case ${destinationfat32compat["$destination"]} in
|
||||||
|
0) initialvalue=n ;;
|
||||||
|
1) initialvalue=y ;;
|
||||||
|
*) unset initialvalue ;;
|
||||||
|
esac
|
||||||
comeagain() {
|
comeagain() {
|
||||||
:
|
read \
|
||||||
|
-e \
|
||||||
|
${initialvalue+-i $initialvalue}\
|
||||||
|
-p'FAT32 Compatibility (y/N): ' \
|
||||||
|
value
|
||||||
|
case $value in
|
||||||
|
[yY])
|
||||||
|
destinationfat32compat["$destination"]=1
|
||||||
|
;;
|
||||||
|
''|[nN])
|
||||||
|
destinationfat32compat["$destination"]=0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
comeagain
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
comeagain
|
comeagain
|
||||||
cat <<-EODesc
|
cat <<-EODesc
|
||||||
|
|
||||||
|
Skip mime-type (mime-type, string):
|
||||||
|
Files with mime-type <mime-type> will not be included in that
|
||||||
|
destination. The '*' character is a wildcard.
|
||||||
|
|
||||||
|
This prompt will loop until an empty string is encountered.
|
||||||
EODesc
|
EODesc
|
||||||
comeagain() {
|
destinationskipmime["$destination"]="${destinationskipmime["$destination"]}|"
|
||||||
:
|
while [[ ${destinationskipmime["$destination"]} =~ / ]]
|
||||||
}
|
do
|
||||||
comeagain
|
skippedmimes+=("${destinationskipmime["$destination"]%%|*}")
|
||||||
|
destinationskipmime["$destination"]="${destinationskipmime["$destination"]#*|}"
|
||||||
|
done
|
||||||
|
count=${#skippedmimes[@]}
|
||||||
|
unset destinationskipmime["$destination"]
|
||||||
|
for (( i=0 ; 1 ; i++ ))
|
||||||
|
do
|
||||||
|
read \
|
||||||
|
-e \
|
||||||
|
${skippedmimes[i]+-i"${skippedmimes[i]}"} \
|
||||||
|
-p 'Skip mime-type: ' \
|
||||||
|
value
|
||||||
|
if [ -n "$value" ]
|
||||||
|
then
|
||||||
|
destinationskipmime[$destination]="${destinationskipmime[$destination]:+${destinationskipmime[$destination]}|}$value"
|
||||||
|
elif (( i < count ))
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset skippedmimes
|
||||||
cat <<-EODesc
|
cat <<-EODesc
|
||||||
|
|
||||||
|
Copy mime-type (mime-type, string):
|
||||||
|
Files with mime-type <mime-type> will be copied as-is to the
|
||||||
|
destination. E.g. image/* will copy covers and other images to the
|
||||||
|
destination. The '*' character is a wildcard.
|
||||||
|
|
||||||
|
This prompt will loop until an empty string is encountered.
|
||||||
EODesc
|
EODesc
|
||||||
comeagain() {
|
destinationcopymime["$destination"]="${destinationcopymime["$destination"]}|"
|
||||||
:
|
while [[ ${destinationcopymime["$destination"]} =~ / ]]
|
||||||
}
|
do
|
||||||
comeagain
|
copiedmimes+=("${destinationcopymime["$destination"]%%|*}")
|
||||||
cat <<-EODesc
|
destinationcopymime["$destination"]="${destinationcopymime["$destination"]#*|}"
|
||||||
EODesc
|
done
|
||||||
comeagain() {
|
count=${#copiedmimes[@]}
|
||||||
:
|
unset destinationcopymime["$destination"]
|
||||||
}
|
for (( i=0 ; 1 ; i++ ))
|
||||||
comeagain
|
do
|
||||||
|
read \
|
||||||
|
-e \
|
||||||
|
${copiedmimes[i]+-i"${copiedmimes[i]}"} \
|
||||||
|
-p 'Copy mime-type: ' \
|
||||||
|
value
|
||||||
|
if [ -n "$value" ]
|
||||||
|
then
|
||||||
|
destinationcopymime[$destination]="${destinationcopymime[$destination]:+${destinationcopymime[$destination]}|}$value"
|
||||||
|
elif (( i < count ))
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset copiedmimes
|
||||||
cat <<-EODesc
|
cat <<-EODesc
|
||||||
EODesc
|
EODesc
|
||||||
comeagain() {
|
comeagain() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user