84 lines
2.9 KiB
Bash
84 lines
2.9 KiB
Bash
#!/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.
|
|
|
|
printConfig() {
|
|
{
|
|
# Build a pipe-delimited table
|
|
# 'column -t -s|' will transform into columns
|
|
echo "General|Config file|$cffile"
|
|
[ -n "$ionice" ] && echo "|IO Nice|$ionice"
|
|
cat <<-EOF
|
|
|Load|$maxload
|
|
|Load Interval|$loadinterval
|
|
|Temp Dir|$tempdir
|
|
|Database|$database
|
|
|Debug|$debug
|
|
|
|
Source|Path|$sourcepath
|
|
EOF
|
|
# Print skipped directories
|
|
# use a continuation prefix after the first
|
|
for prune_expression in "${skippeddirectories[@]}"
|
|
do
|
|
(( printed )) \
|
|
&& echo -n ' | |' \
|
|
|| echo -n ' |Skipped directories|'
|
|
echo "$prune_expression"
|
|
printed=1
|
|
done
|
|
unset printed
|
|
# Loop over destinations and print their settings
|
|
# use the destination name as a key into the associative arrays
|
|
for destination in ${destinations[@]}
|
|
do
|
|
cat <<-EOF
|
|
|
|
$destination|Path|${destinationpath["$destination"]}
|
|
|Enabled|${destinationenabled["$destination"]}
|
|
|Format|${destinationformat["$destination"]}
|
|
|Quality|${destinationquality["$destination"]}
|
|
EOF
|
|
# Show format-specific fields
|
|
if [[ ${destinationformat["$destination"]} == opus ]]
|
|
then
|
|
echo " |Expected loss|${destinationloss["$destination"]}"
|
|
elif [[ ${destinationformat["$destination"]} == mp3 ]]
|
|
then
|
|
echo " |Prevent resampling|${destinationnoresample["$destination"]}"
|
|
fi
|
|
cat <<-EOF
|
|
|Normalize|${destinationnormalize["$destination"]}
|
|
|Channels|${destinationchannels["$destination"]}
|
|
|Frequency|${destinationfrequency["$destination"]}
|
|
|Higher than|${destinationmaxbps["$destination"]}
|
|
|Fat32 Compat.|${destinationfat32compat["$destination"]}
|
|
|ASCII Compat.|${destinationascii["$destination"]}
|
|
|Path Change|${destinationrenamepath["$destination"]}
|
|
|File Rename|${destinationrename["$destination"]}
|
|
EOF
|
|
# Display pipe-separated mime lists: one entry per row
|
|
[ -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'|' # Format as aligned columns using '|' as delimiter
|
|
}
|