diff --git a/tools/db/update-file-state b/tools/db/update-file-state index f2c87c9..18256de 100644 --- a/tools/db/update-file-state +++ b/tools/db/update-file-state @@ -58,6 +58,11 @@ function main() { #cd to moviedir cd "$moviedir" + #clean DB from old stuff + { + db_query "DELETE From File WHERE Size=0;" + } + #erselle zwei dateilisten list_tmp=$(mktemp -d) db_query "SELECT CONCAT('$moviedir/', Folder, '/', Name) FROM File WHERE TTSync=$TTSYNC_EXIST OR TTSync=$TTSYNC_BACKUP;" > "$list_tmp/indb" @@ -67,7 +72,15 @@ function main() { grep -vf "$list_tmp/indb" "$list_tmp/exist" > "$list_tmp/new" #all IDs wich an old check date: - #db_query "SELECT ID FROM File Where TTCheck < '$DATE' OR TTCheck IS NULL;" + db_query "SELECT ID FROM File Where TTCheck < '$DATE' OR TTCheck IS NULL;" | while read line; do + #for each ID with an old check date ... + ID=$line + TTSync=$(db_query "SELECT TTSync FROM File WHERE ID=$ID;") + + + SIZE=$(db_query "SELECT Size FROM File WHERE ID=$ID;") + MD5=$(db_query "SELECT MD5 FROM File WHERE ID=$ID;") + done ## dateiliste erstellen die mit DB abgeglichen wird