diff --git a/lib/destinations/create b/lib/destinations/create index 5c9910b..f9664d8 100644 --- a/lib/destinations/create +++ b/lib/destinations/create @@ -1,7 +1,22 @@ #!/bin/bash + +# Copyright © 2012-2026 ScriptFanix +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# A copy of the GNU General Public License v3 is includded in the LICENSE file +# at the root of the project. + createDestinations() { for destination in ${destinations[@]} do + # Create destination directory if it doesn't exist yet if ! [ -d "${destinationpath["$destination"]}" ] then if ! mkdir -p "${destinationpath["$destination"]}" @@ -10,6 +25,8 @@ createDestinations() { exit $EINVDEST fi fi + # Ensure the destination has a DB record; store its numeric ID + # for later use destinationid["$destination"]=$( InsertIfUnset destinations <<<"name $destination ${destinationenabled[\"$destination\"]}" ) diff --git a/lib/destinations/updateMimes b/lib/destinations/updateMimes index 6835e01..312241b 100644 --- a/lib/destinations/updateMimes +++ b/lib/destinations/updateMimes @@ -1,12 +1,32 @@ #!/bin/bash + +# Copyright © 2012-2026 ScriptFanix +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# A copy of the GNU General Public License v3 is includded in the LICENSE file +# at the root of the project. + updateMimes() { + # Reset all mime_actions to action=1 (transcode) as the default Update mime_actions action 1 <<<"action != 1" + + # For each destination's skip patterns, set action=0 (exclude from + # processing) + # Multiple patterns are pipe-separated; split by setting IFS='|' for destination in ${!destinationskipmime[@]} do IFS='|' for mime_type in ${destinationskipmime["$destination"]} do IFS="$oldIFS" + # Convert config wildcard '*' to SQL wildcard '%' Update mime_type_actions action 0 >/dev/null < <( cat <<-EOWhere destination_id = ${destinationid["$destination"]} @@ -15,12 +35,17 @@ updateMimes() { ) done done + + # For each destination's copy-mime patterns, set action=2 (copy + # verbatim) + # Multiple patterns are pipe-separated; split by setting IFS='|' for destination in ${!destinationcopymime[@]} do IFS='|' for mime_type in ${destinationcopymime["$destination"]} do IFS="$oldIFS" + # Convert config wildcard '*' to SQL wildcard '%' Update mime_type_actions action 2 >/dev/null < <( cat <<-EOWhere destination_id = ${destinationid["$destination"]}