From 63c8da0e8f127a0197fcaf34541b5541cba12582 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 10 May 2019 19:10:22 +0200 Subject: [PATCH] WIP ... 2 --- tools/db/update-file-state | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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