From b38138667ab307442e1597da1858fa0193a870ee Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Thu, 7 May 2020 20:40:52 +0200 Subject: [PATCH] Add copy_extension --- atom | 8 ++++++++ lib/config/getDestination | 3 +++ lib/config/print | 3 +++ lib/config/write | 11 +++++++++++ 4 files changed, 25 insertions(+) diff --git a/atom b/atom index 05f719e..5a5e8e2 100755 --- a/atom +++ b/atom @@ -634,6 +634,14 @@ do decodeFile getDestDir getDestFile + for copy_ext in "${destinationcopyext[@]}" + do + if [[ $filename =~ '.*\.'$copy_ext'$' ]] + then + copied=1 + break + fi + done if (( copied )) then copyFiles_matching diff --git a/lib/config/getDestination b/lib/config/getDestination index 20773db..5284c75 100644 --- a/lib/config/getDestination +++ b/lib/config/getDestination @@ -185,6 +185,9 @@ getConfigDestination() { 'copy_mime-type') destinationcopymime[$destination]="${destinationcopymime[$destination]:+${destinationcopymime[$destination]}|}$value" ;; + 'copy_extension') + destinationcopyext[$destination]="${destinationcopyext[$destination]:+${destinationcopyext[$destination]}|}$value" + ;; 'higher-than') expr='^[0-9]*$' if ! [[ $value =~ $expr ]] diff --git a/lib/config/print b/lib/config/print index ddbc65e..dea0d16 100644 --- a/lib/config/print +++ b/lib/config/print @@ -52,6 +52,9 @@ printConfig() { | | |}" [ -n "${destinationcopymime["$destination"]}" ] \ && echo " |Copied mime-types|${destinationcopymime["$destination"]//\|/ +| | |}" + [ -n "${destinationcopyext["$destination"]}" ] \ + && echo " |Copied extensions|${destinationcopyext["$destination"]//\|/ | | |}" done }|column -t -s'|' diff --git a/lib/config/write b/lib/config/write index 40da076..1b85c7b 100644 --- a/lib/config/write +++ b/lib/config/write @@ -207,6 +207,17 @@ bitrate ${destinationquality["$destination"]} done cat <<-EOCfg +# * copy_extension : Same as skip_extension, except that files +# matching will be copied as-is to the destination. + EOCfg + destinationcopyext["$destination"]="${destinationcopyext["$destination"]}|" + while [[ ${destinationcopyext["$destination"]} =~ \| ]] + do + echo $'copy_extension\t\t'"${destinationcopyext["$destination"]%%|*}" + destinationcopyext["$destination"]="${destinationcopyext["$destination"]#*|}" + done + cat <<-EOCfg + # * channels : Files with more than channels will be # downmixed. Useful if you create files for telephony music-on-hold. EOCfg