move code to decodeFile()
This commit is contained in:
parent
b4efa78092
commit
311617cefb
70
atom
70
atom
@ -420,75 +420,7 @@ do
|
|||||||
rest=${rest#*|}
|
rest=${rest#*|}
|
||||||
performer=${rest%%|*}
|
performer=${rest%%|*}
|
||||||
unset rest
|
unset rest
|
||||||
case "$mimetype" in
|
decodeFile
|
||||||
'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
|
getDestDir
|
||||||
getDestFile
|
getDestFile
|
||||||
if (( copied ))
|
if (( copied ))
|
||||||
|
|||||||
@ -1,33 +1,77 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
decodeFile() {
|
decodeFile() {
|
||||||
if ! decodetaskid=$(
|
case "$mimetype" in
|
||||||
Select tasks id <<<"key = $tmpfile"
|
'audio/mpeg')
|
||||||
)
|
if [[ ${destinationformat[$destination]} = mp3 ]] \
|
||||||
then
|
&& checkCopy
|
||||||
decodetaskid=$(
|
then
|
||||||
Insert tasks <<-EOInsert
|
copied=1
|
||||||
key $tmpfile
|
else
|
||||||
source_file $fileid
|
decodeSox
|
||||||
$(
|
fi
|
||||||
for key in ${!commandline[@]}
|
;;
|
||||||
do
|
'application/ogg opus')
|
||||||
echo "cmd_arg$key ${commandline[key]}"
|
if [[ ${destinationformat[$destination]} = opus ]] \
|
||||||
done
|
&& checkCopy
|
||||||
|
then
|
||||||
|
copied=1
|
||||||
|
else
|
||||||
|
decodeOpusdec
|
||||||
|
if (( ${destinationnormalize["$destination"]}))\
|
||||||
|
|| (
|
||||||
|
[ -n "${destinationfrequency["$destination"]}" ]\
|
||||||
|
&& (( ${rate:-0} != ${destinationfrequency["$destination"]}))\
|
||||||
|
) || (
|
||||||
|
[ -n "${destinationchannels["$destination"]}" ]\
|
||||||
|
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
|
||||||
)
|
)
|
||||||
status 0
|
then
|
||||||
EOInsert
|
sox_needed=1
|
||||||
)
|
fi
|
||||||
progressSpin
|
fi
|
||||||
fi
|
;;
|
||||||
if (( sox_needed ))
|
'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
|
then
|
||||||
cleanup="$tempdir/$tmpfile"
|
if ! decodetaskid=$(
|
||||||
decodeSox "$tempdir/$tmpfile.wav"
|
|
||||||
if ! soxtaskid=$(
|
|
||||||
Select tasks id <<<"key = $tmpfile"
|
Select tasks id <<<"key = $tmpfile"
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
soxtaskid=$(
|
decodetaskid=$(
|
||||||
Insert tasks <<-EOInsert
|
Insert tasks <<-EOInsert
|
||||||
key $tmpfile
|
key $tmpfile
|
||||||
source_file $fileid
|
source_file $fileid
|
||||||
@ -37,13 +81,37 @@ decodeFile() {
|
|||||||
echo "cmd_arg$key ${commandline[key]}"
|
echo "cmd_arg$key ${commandline[key]}"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
requires $decodetaskid
|
|
||||||
required $decodetaskid
|
|
||||||
status 0
|
status 0
|
||||||
cleanup $cleanup
|
|
||||||
EOInsert
|
EOInsert
|
||||||
)
|
)
|
||||||
progressSpin
|
progressSpin
|
||||||
fi
|
fi
|
||||||
|
if (( sox_needed ))
|
||||||
|
then
|
||||||
|
cleanup="$tempdir/$tmpfile"
|
||||||
|
decodeSox "$tempdir/$tmpfile.wav"
|
||||||
|
if ! soxtaskid=$(
|
||||||
|
Select tasks id <<<"key = $tmpfile"
|
||||||
|
)
|
||||||
|
then
|
||||||
|
soxtaskid=$(
|
||||||
|
Insert tasks <<-EOInsert
|
||||||
|
key $tmpfile
|
||||||
|
source_file $fileid
|
||||||
|
$(
|
||||||
|
for key in ${!commandline[@]}
|
||||||
|
do
|
||||||
|
echo "cmd_arg$key ${commandline[key]}"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
requires $decodetaskid
|
||||||
|
required $decodetaskid
|
||||||
|
status 0
|
||||||
|
cleanup $cleanup
|
||||||
|
EOInsert
|
||||||
|
)
|
||||||
|
progressSpin
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user