diff --git a/lib/decode/file b/lib/decode/file index 1571222..5883f83 100644 --- a/lib/decode/file +++ b/lib/decode/file @@ -1,4 +1,5 @@ #!/bin/bash +declare soxtaskid decodeFile() { case "$mimetype" in 'video/'*) @@ -77,7 +78,23 @@ decodeFile() { 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 ;; diff --git a/lib/encode/mp3 b/lib/encode/mp3 index 68a93ab..d0d6800 100644 --- a/lib/encode/mp3 +++ b/lib/encode/mp3 @@ -75,4 +75,5 @@ encodeFile::mp3() { EOInsert ) progressSpin + soxtaskid='' } diff --git a/lib/encode/opus b/lib/encode/opus index 3aa993d..bfa48ca 100644 --- a/lib/encode/opus +++ b/lib/encode/opus @@ -43,4 +43,5 @@ encodeFile::opus() { EOInsert ) progressSpin + soxtaskid='' } diff --git a/lib/encode/vorbis b/lib/encode/vorbis index 7eee65c..a96523f 100644 --- a/lib/encode/vorbis +++ b/lib/encode/vorbis @@ -39,4 +39,5 @@ encodeFile::vorbis() { EOInsert ) progressSpin + soxtaskid='' } diff --git a/lib/video/extractaudio b/lib/video/extractaudio index d8d3344..afa1392 100644 --- a/lib/video/extractaudio +++ b/lib/video/extractaudio @@ -1,6 +1,6 @@ #!/bin/bash extractAudio() { - tmpfile="${fileid}ffmpeg" + tmpfile="${fileid}ffmpeg.wav" commandline=(${ionice}ffmpeg -v 0 -vn -y) - commandline+=(-i "$sourcepath/$filename" "$tempdir/$tmpfile.wav") + commandline+=(-i "$sourcepath/$filename" "$tempdir/$tmpfile") } diff --git a/lib/workers/master b/lib/workers/master index b51b064..96e3937 100644 --- a/lib/workers/master +++ b/lib/workers/master @@ -93,6 +93,30 @@ master() { then sleep 0.1 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 )) then sleep 0.1