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

48
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,27 +1193,32 @@ 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// /}"
soxoptions_in+=' --single-threaded' if ! decodetaskid=$(
soxoptions_out+=" --temp \"$tempdir\"" Select tasks id <<<"key = $tmpfile"
decodetaskid=$(
InsertIfUnset tasks <<-EOInsert
unicity_check $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 then
echo 'COMMIT;BEGIN TRANSACTION;' >&3 soxoptions_in+=' --single-threaded'
(( debug )) \ soxoptions_out+=" --temp \"$tempdir\""
&& echo -e "\bCommitted $count tasks... " 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 fi
unset \ unset \
channels \ channels \