Implement new DB schema

This commit is contained in:
Vincent Riquer 2013-10-09 01:30:47 +02:00
parent 4ef24fc333
commit eba2adf2c2
7 changed files with 37 additions and 8 deletions

12
atom
View File

@ -388,6 +388,8 @@ echo '
id INTEGER PRIMARY KEY,
key TEXT UNIQUE,
rename_pattern TEXT,
fat32compat INTEGER,
ascii INTEGER,
source_file INTEGER,
fileid INTEGER,
filename TEXT,
@ -793,7 +795,9 @@ do
WHERE destinations.name="'"$destination"'"
AND (destination_files.rename_pattern
!=
"'"${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}"'"
"'"${destinationrenamepath[$destination]}/${destinationrename[$destination]}"'"
OR fat32compat != ${destinationfat32compat["$destination"]}
OR ascii != ${destinationascii["$destination"]}
OR destination_files.rename_pattern is NULL)
AND destination_files.last_change > 0
;
@ -859,7 +863,11 @@ do
echo "UPDATE destination_files" \
"SET filename=\"${destfilename//\"/\"\"}\"," \
" rename_pattern=" \
"\"${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}\"" \
"\"${destinationrenamepath[$destination]}/${destinationrename[$destination]}" \
" fat32compat="
"${destinationfat32compat["$destination"]}\"" \
" ascii=" \
"${destinationascii["$destination"]}" \
"WHERE id=$destfileid;" \
>&3
if (( commit ))

View File

@ -74,7 +74,9 @@ copyFiles_action() {
then
Update destination_files \
filename "$destdir/${sourcefilename##*/}"\
rename_pattern "${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}"\
rename_pattern "${destinationrenamepath[$destination]}/${destinationrename[$destination]}"\
fat32compat ${destinationfat32compat["$destination"]}\
ascii ${destinationascii["$destination"]}\
last_change $lastchange \
<<-EOWhere
id = $destfileid

View File

@ -22,8 +22,11 @@ copyFiles_matching() {
" FROM destination_files" \
" WHERE id=$destfileid" \
" )," \
" rename_pattern=" \
"\"${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}\""\
" rename_pattern" \
"\"${destinationrenamepath[$destination]}/${destinationrename[$destination]}\""\
" fat32compat" \
" ${destinationfat32compat["$destination"]}"\
" ascii ${destinationascii["$destination"]}"\
"WHERE id=$destfileid;" \
>&3
(( ++copies ))

View File

@ -65,7 +65,9 @@ encodeFile::mp3() {
cleanup $tempdir/$tmpfile.wav
source_file $fileid
status 0
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}
fat32compat ${destinationfat32compat["$destination"]}
ascii ${destinationascii["$destination"]}
EOInsert
)
progressSpin

View File

@ -37,7 +37,9 @@ encodeFile::opus() {
cleanup $tempdir/$tmpfile.wav
source_file $fileid
status 0
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}
fat32compat ${destinationfat32compat["$destination"]}
ascii ${destinationascii["$destination"]}
EOInsert
)
progressSpin

View File

@ -33,7 +33,9 @@ encodeFile::vorbis() {
cleanup $tempdir/$tmpfile.wav
source_file $fileid
status 0
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}
fat32compat ${destinationfat32compat["$destination"]}
ascii ${destinationascii["$destination"]}
EOInsert
)
progressSpin

View File

@ -47,6 +47,16 @@ cleaner() {
" SELECT rename_pattern" \
" FROM tasks" \
" WHERE id=$taskid" \
" )," \
" fat32compat=(" \
" SELECT fat32compat" \
" FROM tasks" \
" WHERE id=$taskid" \
" )," \
" ascii=(" \
" SELECT ascii" \
" FROM tasks" \
" WHERE id=$taskid" \
" )" \
"WHERE id=$destfileid;" \
>&3