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

View File

@ -74,7 +74,9 @@ copyFiles_action() {
then then
Update destination_files \ Update destination_files \
filename "$destdir/${sourcefilename##*/}"\ 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 \ last_change $lastchange \
<<-EOWhere <<-EOWhere
id = $destfileid id = $destfileid

View File

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

View File

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

View File

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

View File

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

View File

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