* normalize
	* rename
	* fat32compat
	* skip_mime-type
	* copy_mime-type
This commit is contained in:
Vincent Riquer 2013-06-18 12:30:53 +02:00
parent 618e086799
commit 8f7c907fb9

View File

@ -178,35 +178,160 @@ setupDestination() {
Normalize (boolean):
Normalize output files.
EODesc
case ${destinationnormalize["$destination"]} in
0) initialvalue=n ;;
1) initialvalue=y ;;
*) unset initialvalue ;;
esac
comeagain() {
:
}
comeagain
cat <<-EODesc
EODesc
comeagain() {
:
}
comeagain
cat <<-EODesc
EODesc
comeagain() {
:
}
comeagain
cat <<-EODesc
EODesc
comeagain() {
:
}
comeagain
cat <<-EODesc
EODesc
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
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
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() {
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
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
destinationskipmime["$destination"]="${destinationskipmime["$destination"]}|"
while [[ ${destinationskipmime["$destination"]} =~ / ]]
do
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
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
destinationcopymime["$destination"]="${destinationcopymime["$destination"]}|"
while [[ ${destinationcopymime["$destination"]} =~ / ]]
do
copiedmimes+=("${destinationcopymime["$destination"]%%|*}")
destinationcopymime["$destination"]="${destinationcopymime["$destination"]#*|}"
done
count=${#copiedmimes[@]}
unset destinationcopymime["$destination"]
for (( i=0 ; 1 ; i++ ))
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
EODesc
comeagain() {
: