add 'higher-than' bitrate constraint
This commit is contained in:
parent
06761b74a4
commit
7d622bde13
59
atom
59
atom
@ -232,6 +232,16 @@ getConfigDestination() {
|
|||||||
'copy_mime-type')
|
'copy_mime-type')
|
||||||
destinationcopymime[$destination]="${destinationcopymime[$destination]:+${destinationcopymime[$destination]}|}$value"
|
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
|
esac
|
||||||
}
|
}
|
||||||
getConfig() {
|
getConfig() {
|
||||||
@ -913,6 +923,25 @@ getTags() {
|
|||||||
fi
|
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() {
|
decodeSox() {
|
||||||
if (( ${destinationnormalize["$destination"]} ))
|
if (( ${destinationnormalize["$destination"]} ))
|
||||||
then
|
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() {
|
encodeFile::Ogg() {
|
||||||
#oggenc
|
#oggenc
|
||||||
:
|
:
|
||||||
@ -1286,10 +1333,22 @@ do
|
|||||||
unset rest
|
unset rest
|
||||||
case "$mimetype" in
|
case "$mimetype" in
|
||||||
'audio/mpeg')
|
'audio/mpeg')
|
||||||
|
if [[ ${destinationformat[$destination]} = mp3 ]] \
|
||||||
|
&& checkCopy
|
||||||
|
then
|
||||||
|
copied=1
|
||||||
|
else
|
||||||
decodeSox
|
decodeSox
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
'application/ogg')
|
'application/ogg')
|
||||||
|
if [[ ${destinationformat[$destination]} = vorbis ]] \
|
||||||
|
&& checkCopy
|
||||||
|
then
|
||||||
|
copied=1
|
||||||
|
else
|
||||||
decodeSox
|
decodeSox
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
'audio/x-flac')
|
'audio/x-flac')
|
||||||
decodeSox
|
decodeSox
|
||||||
|
|||||||
@ -77,6 +77,12 @@ Sections:
|
|||||||
* frequency <hertz>: Files will be resampled as needed to <hertz>Hz
|
* frequency <hertz>: Files will be resampled as needed to <hertz>Hz
|
||||||
sampling-rate. Shoutcast/Icecast streams require a constant sampling-rate.
|
sampling-rate. Shoutcast/Icecast streams require a constant sampling-rate.
|
||||||
Telephony systems often require a sample rate of 8000Hz.
|
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:
|
Ogg parameters:
|
||||||
* quality <quality>: The quality parameter of oggenc. See man oggenc for
|
* quality <quality>: The quality parameter of oggenc. See man oggenc for
|
||||||
|
|||||||
@ -29,6 +29,7 @@ path /mnt/Musique-mp3.test
|
|||||||
format mp3
|
format mp3
|
||||||
bitrate 96
|
bitrate 96
|
||||||
normalize yes
|
normalize yes
|
||||||
|
higher-than 128
|
||||||
|
|
||||||
# rename file, path unchanged
|
# rename file, path unchanged
|
||||||
rename %{track}--%{artist}-%{title}
|
rename %{track}--%{artist}-%{title}
|
||||||
@ -39,6 +40,7 @@ skip_mime-type text/*
|
|||||||
|
|
||||||
[asterisk]
|
[asterisk]
|
||||||
path /mnt/Musique-asterisk
|
path /mnt/Musique-asterisk
|
||||||
|
quality 0
|
||||||
format vorbis
|
format vorbis
|
||||||
normalize yes
|
normalize yes
|
||||||
channels 1
|
channels 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user