diff --git a/atom b/atom index d4aa334..01b32b1 100755 --- a/atom +++ b/atom @@ -1112,13 +1112,14 @@ unset count tagfiles echo ' CREATE TEMPORARY TABLE tasks( id INTEGER PRIMARY KEY, - unicity_check TEXT SECONDARY KEY, + key TEXT UNIQUE, command_line TEXT, requires INTEGER, status INTEGER NOT NULL, FOREIGN KEY(requires) REFERENCES tasks(id) ON DELETE SET NULL - );' >&3 + ); + CREATE INDEX tasks_by_key ON tasks ( key );' >&3 echo ' SELECT COUNT(DISTINCT source_files.id) @@ -1192,27 +1193,32 @@ do soxoptions_out+=" -c ${destinationchannels["$destination"]}" fi tmpfile="$fileid${soxoptions_in// /}${soxoptions_out// /}" - soxoptions_in+=' --single-threaded' - soxoptions_out+=" --temp \"$tempdir\"" - decodetaskid=$( - InsertIfUnset tasks <<-EOInsert - unicity_check $tmpfile - command_line sox $soxoptions_in "$sourcepath/$filename" $soxoptions_out "$tempdir/$tmpfile.wav" - status 0 - EOInsert + if ! decodetaskid=$( + Select tasks id <<<"key = $tmpfile" ) - case $(( ++count % 40 )) in - 0) echo -ne '\b|' ;; - 10) echo -ne '\b/' ;; - 20) echo -en '\b-' ;; - 30) echo -ne '\b\\' ;; - *) ;; - esac - if (( count % 1000 == 0 )) then - echo 'COMMIT;BEGIN TRANSACTION;' >&3 - (( debug )) \ - && echo -e "\bCommitted $count tasks... " + soxoptions_in+=' --single-threaded' + soxoptions_out+=" --temp \"$tempdir\"" + decodetaskid=$( + Insert tasks <<-EOInsert + key $tmpfile + command_line sox $soxoptions_in "$sourcepath/$filename" $soxoptions_out "$tempdir/$tmpfile.wav" + status 0 + EOInsert + ) + case $(( ++count % 40 )) in + 0) echo -ne '\b|' ;; + 10) echo -ne '\b/' ;; + 20) echo -en '\b-' ;; + 30) echo -ne '\b\\' ;; + *) ;; + esac + if (( count % 1000 == 0 )) + then + echo 'COMMIT;BEGIN TRANSACTION;' >&3 + (( debug )) \ + && echo -en "\bCommitted $count tasks... " + fi fi unset \ channels \