add 'higher-than' bitrate constraint
This commit is contained in:
parent
06761b74a4
commit
7d622bde13
63
atom
63
atom
@ -232,6 +232,16 @@ getConfigDestination() {
|
||||
'copy_mime-type')
|
||||
destinationcopymime[$destination]="${destinationcopymime[$destination]:+${destinationcopymime[$destination]}|}$value"
|
||||
;;
|
||||
'higher-than')
|
||||
expr='^[0-9]*$'
|
||||
if ! [[ $value =~ $expr ]]
|
||||
then
|
||||
echo "Invalid higher-than bitrate value: $value" >&2
|
||||
exit $EMAXBPS
|
||||
fi
|
||||
unset expr
|
||||
destinationmaxbps[$destination]="$value"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
getConfig() {
|
||||
@ -913,6 +923,25 @@ getTags() {
|
||||
fi
|
||||
}
|
||||
|
||||
checkCopy() {
|
||||
(
|
||||
[ -z "${destinationfrequency[$destination]}" ] \
|
||||
|| (( ${rate:-0} == ${destinationfrequency[$destination]} ))
|
||||
) && (
|
||||
[ -z "${destinationchannels[$destination]}" ] \
|
||||
|| (( ${channels:-0} == ${destinationchannels[$destination]} ))
|
||||
) && (
|
||||
(( ${bitrate:-1000} == ${destinationquality[$destination]} )) \
|
||||
|| (
|
||||
[ -n "${destinationmaxbps[$destination]}" ] \
|
||||
|| ((
|
||||
${bitrate:-1000}
|
||||
<= ${destinationmaxbps[$destination]:-0}
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
decodeSox() {
|
||||
if (( ${destinationnormalize["$destination"]} ))
|
||||
then
|
||||
@ -950,6 +979,24 @@ encodeFile::MP3() {
|
||||
:
|
||||
}
|
||||
|
||||
copyFile() {
|
||||
tmpfile="${fileid}copy$destination"
|
||||
extension="${filename##*.}"
|
||||
commandline="cp -al \"$sourcepath/$filename\" \"$destdir/$destfile.$extension\""
|
||||
commandline+=" 2>/dev/null"
|
||||
commandline+=' || '
|
||||
commandline+="cp -a \"$sourcepath/$filename\" \"$destdir/$destfile\""
|
||||
copytaskid=$(
|
||||
Insert tasks <<-EOInsert
|
||||
key ${fileid}copy$destination
|
||||
source_file $fileid
|
||||
command_line $commandline
|
||||
status 0
|
||||
EOInsert
|
||||
)
|
||||
progressSpin
|
||||
}
|
||||
|
||||
encodeFile::Ogg() {
|
||||
#oggenc
|
||||
:
|
||||
@ -1286,10 +1333,22 @@ do
|
||||
unset rest
|
||||
case "$mimetype" in
|
||||
'audio/mpeg')
|
||||
decodeSox
|
||||
if [[ ${destinationformat[$destination]} = mp3 ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeSox
|
||||
fi
|
||||
;;
|
||||
'application/ogg')
|
||||
decodeSox
|
||||
if [[ ${destinationformat[$destination]} = vorbis ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeSox
|
||||
fi
|
||||
;;
|
||||
'audio/x-flac')
|
||||
decodeSox
|
||||
|
||||
@ -77,6 +77,12 @@ Sections:
|
||||
* frequency <hertz>: Files will be resampled as needed to <hertz>Hz
|
||||
sampling-rate. Shoutcast/Icecast streams require a constant sampling-rate.
|
||||
Telephony systems often require a sample rate of 8000Hz.
|
||||
* higher-than <bitrate>: Integer. Only reencode files with bitrates higher
|
||||
then <bitrate>kbps. This only applies if sample-rate, channel count and of
|
||||
course format are equal. If unset, only files with bitrates equal to that
|
||||
of the target will be copied (actually, hardlinking will be attempted
|
||||
first). As Ogg Vorbis target quality is not defined by its bitrate, Ogg
|
||||
Vorbis files will always be reencoded if unset.
|
||||
|
||||
Ogg parameters:
|
||||
* quality <quality>: The quality parameter of oggenc. See man oggenc for
|
||||
|
||||
@ -29,6 +29,7 @@ path /mnt/Musique-mp3.test
|
||||
format mp3
|
||||
bitrate 96
|
||||
normalize yes
|
||||
higher-than 128
|
||||
|
||||
# rename file, path unchanged
|
||||
rename %{track}--%{artist}-%{title}
|
||||
@ -39,6 +40,7 @@ skip_mime-type text/*
|
||||
|
||||
[asterisk]
|
||||
path /mnt/Musique-asterisk
|
||||
quality 0
|
||||
format vorbis
|
||||
normalize yes
|
||||
channels 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user