Merge branch '20-bug-setup-is-not-aware-of-copy_extension' into 'master'
Resolve "BUG: Setup is not aware of `copy_extension`" Closes #20 See merge request atom/AtOM!26
This commit is contained in:
commit
af40b872a7
2
atom
2
atom
@ -501,7 +501,7 @@ do
|
||||
getDestFile
|
||||
for copy_ext in "${destinationcopyext[@]}"
|
||||
do
|
||||
if [[ $filename =~ '.*'"$copy_ext" ]]
|
||||
if [[ $filename =~ '.*\.'"$copy_ext"'$' ]]
|
||||
then
|
||||
copied=1
|
||||
break
|
||||
|
||||
@ -186,7 +186,7 @@ getConfigDestination() {
|
||||
destinationcopymime[$destination]="${destinationcopymime[$destination]:+${destinationcopymime[$destination]}|}$value"
|
||||
;;
|
||||
'copy_extension')
|
||||
destinationcopyext[$destination]="${destinationcopyext[$destination]:+${destinationcopyext[$destination]}|}\.$value$"
|
||||
destinationcopyext[$destination]="${destinationcopyext[$destination]:+${destinationcopyext[$destination]}|}$value"
|
||||
;;
|
||||
'higher-than')
|
||||
expr='^[0-9]*$'
|
||||
|
||||
@ -49,13 +49,13 @@ printConfig() {
|
||||
EOF
|
||||
[ -n "${destinationskipmime["$destination"]}" ] \
|
||||
&& echo " |Skipped mime-types|${destinationskipmime["$destination"]//\|/
|
||||
| | |}"
|
||||
| |}"
|
||||
[ -n "${destinationcopymime["$destination"]}" ] \
|
||||
&& echo " |Copied mime-types|${destinationcopymime["$destination"]//\|/
|
||||
| | |}"
|
||||
| |}"
|
||||
[ -n "${destinationcopyext["$destination"]}" ] \
|
||||
&& echo " |Copied extensions|${destinationcopyext["$destination"]//\|/
|
||||
| | |}"
|
||||
| |}"
|
||||
done
|
||||
}|column -t -s'|'
|
||||
}
|
||||
|
||||
@ -208,8 +208,7 @@ bitrate ${destinationquality["$destination"]}
|
||||
done
|
||||
cat <<-EOCfg
|
||||
|
||||
# * copy_extension <extension>: Same as skip_extension, except that files
|
||||
# matching will be copied as-is to the destination.
|
||||
# * copy_extension <extension>: Copy files whose name and with ".<extension>"
|
||||
EOCfg
|
||||
destinationcopyext["$destination"]="${destinationcopyext["$destination"]}|"
|
||||
while [[ ${destinationcopyext["$destination"]} =~ \| ]]
|
||||
|
||||
@ -388,16 +388,16 @@ setupDestination() {
|
||||
copiedmimes+=("${destinationcopymime["$destination"]%%|*}")
|
||||
destinationcopymime["$destination"]="${destinationcopymime["$destination"]#*|}"
|
||||
done
|
||||
[ -n "${destinationcopymime["$destination"]}" ] \
|
||||
[ -n "${destinationcopymime["$destination"]}" ] \
|
||||
&& copiedmimes+=("${destinationcopymime["$destination"]}")
|
||||
count=${#copiedmimes[@]}
|
||||
unset destinationcopymime["$destination"]
|
||||
for (( i=0 ; 1 ; i++ ))
|
||||
do
|
||||
read \
|
||||
-e \
|
||||
read \
|
||||
-e \
|
||||
${copiedmimes[i]+-i"${copiedmimes[i]}"} \
|
||||
-p 'Copy mime-type: ' \
|
||||
-p 'Copy mime-type: ' \
|
||||
value
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
@ -410,6 +410,44 @@ setupDestination() {
|
||||
fi
|
||||
done
|
||||
unset copiedmimes
|
||||
|
||||
cat <<-EODesc
|
||||
|
||||
Copy extensions (extension, string):
|
||||
Files with extension <extension> will be copied as-is to the
|
||||
destination. E.g. .jpg will copy covers and other images to the
|
||||
destination.
|
||||
|
||||
This prompt will loop until an empty string is encountered.
|
||||
EODesc
|
||||
while [[ ${destinationcopyext["$destination"]} =~ \| ]]
|
||||
do
|
||||
copiedexts+=("${destinationcopyext["$destination"]%%|*}")
|
||||
destinationcopyext["$destination"]="${destinationcopyext["$destination"]#*|}"
|
||||
done
|
||||
[ -n "${destinationcopyext["$destination"]}" ] \
|
||||
&& copiedexts+=("${destinationcopyext["$destination"]}")
|
||||
count=${#copiedexts[@]}
|
||||
unset destinationcopyext["$destination"]
|
||||
for (( i=0 ; 1 ; i++ ))
|
||||
do
|
||||
read \
|
||||
-e \
|
||||
${copiedexts[i]+-i"${copiedexts[i]}"} \
|
||||
-p 'Copy extension: ' \
|
||||
value
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
destinationcopyext[$destination]="${destinationcopyext[$destination]:+${destinationcopyext[$destination]}|}$value"
|
||||
elif (( i < count ))
|
||||
then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset copiedexts
|
||||
|
||||
cat <<-EODesc
|
||||
|
||||
Channels (integer):
|
||||
|
||||
@ -24,6 +24,7 @@ Completion is available for prompts asking for a paths or filenames.
|
||||
destinationchannels \
|
||||
destinationfat32compat \
|
||||
destinationcopymime \
|
||||
destinationcopyext \
|
||||
destinationformat \
|
||||
destinationfrequency \
|
||||
destinationid \
|
||||
@ -40,6 +41,7 @@ Completion is available for prompts asking for a paths or filenames.
|
||||
destinationchannels \
|
||||
destinationfat32compat \
|
||||
destinationcopymime \
|
||||
destinationcopyext \
|
||||
destinationformat \
|
||||
destinationfrequency \
|
||||
destinationid \
|
||||
@ -74,7 +76,7 @@ Completion is available for prompts asking for a paths or filenames.
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
read -p'Run now? [Y/n] ' do_run
|
||||
read -p'Run index and conversion now? [Y/n] ' do_run
|
||||
case $do_run in
|
||||
n) exit ;;
|
||||
*) ;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user