Always try ffmpeg on unknown filetypes

This commit is contained in:
Vincent Riquer 2016-09-01 18:44:02 +02:00
parent 5977629cab
commit b4afedb70f
6 changed files with 47 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
declare soxtaskid
decodeFile() { decodeFile() {
case "$mimetype" in case "$mimetype" in
'video/'*) 'video/'*)
@ -77,7 +78,23 @@ decodeFile() {
fi fi
;; ;;
*) *)
decodeSox if (( disablevideo ))
then
decodeSox
else
extractAudio
if (( ${destinationnormalize["$destination"]}))\
|| (
[ -n "${destinationfrequency["$destination"]}" ]\
&& (( ${rate:-0} != ${destinationfrequency["$destination"]}))\
) || (
[ -n "${destinationchannels["$destination"]}" ]\
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
)
then
sox_needed=1
fi
fi
;; ;;
esac esac
;; ;;

View File

@ -75,4 +75,5 @@ encodeFile::mp3() {
EOInsert EOInsert
) )
progressSpin progressSpin
soxtaskid=''
} }

View File

@ -43,4 +43,5 @@ encodeFile::opus() {
EOInsert EOInsert
) )
progressSpin progressSpin
soxtaskid=''
} }

View File

@ -39,4 +39,5 @@ encodeFile::vorbis() {
EOInsert EOInsert
) )
progressSpin progressSpin
soxtaskid=''
} }

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
extractAudio() { extractAudio() {
tmpfile="${fileid}ffmpeg" tmpfile="${fileid}ffmpeg.wav"
commandline=(${ionice}ffmpeg -v 0 -vn -y) commandline=(${ionice}ffmpeg -v 0 -vn -y)
commandline+=(-i "$sourcepath/$filename" "$tempdir/$tmpfile.wav") commandline+=(-i "$sourcepath/$filename" "$tempdir/$tmpfile")
} }

View File

@ -93,6 +93,30 @@ master() {
then then
sleep 0.1 sleep 0.1
continue continue
elif (( active == 0 && ready == 0 ))
then
dumpfile=tasks-$(date +%Y%m%d%H%M%S).csv
cat <<-EOF
$remaining TASKS LEFT, NONE READY!
Something went wrong, dumping tasks table to $dumpfile
EOF
cat >&3 <<-EOSQL
.mode csv
.headers on
.output $dumpfile
SELECT * from tasks;
.mode list
.headers off
.output stdout
EOSQL
closeDatabase
echo "Waiting for children to come back home..."
wait
echo $'\nGood luck!'
exit 1
elif (( ready == 0 )) elif (( ready == 0 ))
then then
sleep 0.1 sleep 0.1