rename, index, and use key identifying tasks

This commit is contained in:
Vincent Riquer 2013-03-10 14:07:53 +01:00
parent 7328a9e25c
commit 58b9d78afa

16
atom
View File

@ -1112,13 +1112,14 @@ unset count tagfiles
echo ' echo '
CREATE TEMPORARY TABLE tasks( CREATE TEMPORARY TABLE tasks(
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
unicity_check TEXT SECONDARY KEY, key TEXT UNIQUE,
command_line TEXT, command_line TEXT,
requires INTEGER, requires INTEGER,
status INTEGER NOT NULL, status INTEGER NOT NULL,
FOREIGN KEY(requires) REFERENCES tasks(id) FOREIGN KEY(requires) REFERENCES tasks(id)
ON DELETE SET NULL ON DELETE SET NULL
);' >&3 );
CREATE INDEX tasks_by_key ON tasks ( key );' >&3
echo ' echo '
SELECT COUNT(DISTINCT source_files.id) SELECT COUNT(DISTINCT source_files.id)
@ -1192,11 +1193,15 @@ do
soxoptions_out+=" -c ${destinationchannels["$destination"]}" soxoptions_out+=" -c ${destinationchannels["$destination"]}"
fi fi
tmpfile="$fileid${soxoptions_in// /}${soxoptions_out// /}" tmpfile="$fileid${soxoptions_in// /}${soxoptions_out// /}"
if ! decodetaskid=$(
Select tasks id <<<"key = $tmpfile"
)
then
soxoptions_in+=' --single-threaded' soxoptions_in+=' --single-threaded'
soxoptions_out+=" --temp \"$tempdir\"" soxoptions_out+=" --temp \"$tempdir\""
decodetaskid=$( decodetaskid=$(
InsertIfUnset tasks <<-EOInsert Insert tasks <<-EOInsert
unicity_check $tmpfile key $tmpfile
command_line sox $soxoptions_in "$sourcepath/$filename" $soxoptions_out "$tempdir/$tmpfile.wav" command_line sox $soxoptions_in "$sourcepath/$filename" $soxoptions_out "$tempdir/$tmpfile.wav"
status 0 status 0
EOInsert EOInsert
@ -1212,7 +1217,8 @@ do
then then
echo 'COMMIT;BEGIN TRANSACTION;' >&3 echo 'COMMIT;BEGIN TRANSACTION;' >&3
(( debug )) \ (( debug )) \
&& echo -e "\bCommitted $count tasks... " && echo -en "\bCommitted $count tasks... "
fi
fi fi
unset \ unset \
channels \ channels \