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 '
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,11 +1193,15 @@ do
soxoptions_out+=" -c ${destinationchannels["$destination"]}"
fi
tmpfile="$fileid${soxoptions_in// /}${soxoptions_out// /}"
if ! decodetaskid=$(
Select tasks id <<<"key = $tmpfile"
)
then
soxoptions_in+=' --single-threaded'
soxoptions_out+=" --temp \"$tempdir\""
decodetaskid=$(
InsertIfUnset tasks <<-EOInsert
unicity_check $tmpfile
Insert tasks <<-EOInsert
key $tmpfile
command_line sox $soxoptions_in "$sourcepath/$filename" $soxoptions_out "$tempdir/$tmpfile.wav"
status 0
EOInsert
@ -1212,7 +1217,8 @@ do
then
echo 'COMMIT;BEGIN TRANSACTION;' >&3
(( debug )) \
&& echo -e "\bCommitted $count tasks... "
&& echo -en "\bCommitted $count tasks... "
fi
fi
unset \
channels \