move code to decodeFile()
This commit is contained in:
parent
b4efa78092
commit
311617cefb
68
atom
68
atom
@ -420,75 +420,7 @@ do
|
||||
rest=${rest#*|}
|
||||
performer=${rest%%|*}
|
||||
unset rest
|
||||
case "$mimetype" in
|
||||
'audio/mpeg')
|
||||
if [[ ${destinationformat[$destination]} = mp3 ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeSox
|
||||
fi
|
||||
;;
|
||||
'application/ogg opus')
|
||||
if [[ ${destinationformat[$destination]} = opus ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeOpusdec
|
||||
if (( ${destinationnormalize["$destination"]}))\
|
||||
|| (
|
||||
[ -n "${destinationfrequency["$destination"]}" ]\
|
||||
&& (( ${rate:-0} != ${destinationfrequency["$destination"]}))\
|
||||
) || (
|
||||
[ -n "${destinationchannels["$destination"]}" ]\
|
||||
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
|
||||
)
|
||||
then
|
||||
sox_needed=1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
'application/ogg'*)
|
||||
if [[ ${destinationformat[$destination]} = vorbis ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeSox
|
||||
fi
|
||||
;;
|
||||
'audio/x-flac')
|
||||
decodeSox
|
||||
;;
|
||||
*)
|
||||
extendedtype=$(file -b "$sourcepath/$filename")
|
||||
case "$extendedtype" in
|
||||
*'Musepack '*)
|
||||
decodeMpcdec
|
||||
if (( ${destinationnormalize["$destination"]}))\
|
||||
|| (
|
||||
[ -n "${destinationfrequency["$destination"]}" ]\
|
||||
&& (( ${rate:-0} != ${destinationfrequency["$destination"]}))\
|
||||
) || (
|
||||
[ -n "${destinationchannels["$destination"]}" ]\
|
||||
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
|
||||
)
|
||||
then
|
||||
sox_needed=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
decodeSox
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
if ! (( copied ))
|
||||
then
|
||||
decodeFile
|
||||
fi
|
||||
getDestDir
|
||||
getDestFile
|
||||
if (( copied ))
|
||||
|
||||
@ -1,5 +1,72 @@
|
||||
#!/bin/bash
|
||||
decodeFile() {
|
||||
case "$mimetype" in
|
||||
'audio/mpeg')
|
||||
if [[ ${destinationformat[$destination]} = mp3 ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeSox
|
||||
fi
|
||||
;;
|
||||
'application/ogg opus')
|
||||
if [[ ${destinationformat[$destination]} = opus ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeOpusdec
|
||||
if (( ${destinationnormalize["$destination"]}))\
|
||||
|| (
|
||||
[ -n "${destinationfrequency["$destination"]}" ]\
|
||||
&& (( ${rate:-0} != ${destinationfrequency["$destination"]}))\
|
||||
) || (
|
||||
[ -n "${destinationchannels["$destination"]}" ]\
|
||||
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
|
||||
)
|
||||
then
|
||||
sox_needed=1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
'application/ogg'*)
|
||||
if [[ ${destinationformat[$destination]} = vorbis ]] \
|
||||
&& checkCopy
|
||||
then
|
||||
copied=1
|
||||
else
|
||||
decodeSox
|
||||
fi
|
||||
;;
|
||||
'audio/x-flac')
|
||||
decodeSox
|
||||
;;
|
||||
*)
|
||||
extendedtype=$(file -b "$sourcepath/$filename")
|
||||
case "$extendedtype" in
|
||||
*'Musepack '*)
|
||||
decodeMpcdec
|
||||
if (( ${destinationnormalize["$destination"]}))\
|
||||
|| (
|
||||
[ -n "${destinationfrequency["$destination"]}" ]\
|
||||
&& (( ${rate:-0} != ${destinationfrequency["$destination"]}))\
|
||||
) || (
|
||||
[ -n "${destinationchannels["$destination"]}" ]\
|
||||
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
|
||||
)
|
||||
then
|
||||
sox_needed=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
decodeSox
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
if ! (( copied ))
|
||||
then
|
||||
if ! decodetaskid=$(
|
||||
Select tasks id <<<"key = $tmpfile"
|
||||
)
|
||||
@ -46,4 +113,5 @@ decodeFile() {
|
||||
progressSpin
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user