From a6abdc45ea407f89d6734f0e1a1ccf6be270b179 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 10 May 2019 21:17:04 +0200 Subject: [PATCH] wip on android --- tools/db/update-file-state | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/db/update-file-state b/tools/db/update-file-state index edb2852..a62099a 100644 --- a/tools/db/update-file-state +++ b/tools/db/update-file-state @@ -147,9 +147,23 @@ function file_size() { } function file_add() { - echo "dumy func file_add [rel. path] -#chek if path still esist chek usw... -#chek if size ->md5 exist -> not new MV !!! +echo 2DO +local relrevpath="$(echo $1 | sed 's|^/||g' | sed 's|/$||g' | rev | sed "s/'/''/g")" #last statement set ' as '' so it wont have an evect in the sql statement +local name="$(echo $relrevpath | cut -d '/' -f 1 | rev)" + local folder="$(echo $relrevpath | cut -d '/' -f 2- | rev)" +local FILE="$moviedir/$(echo $relrevpath | rev)" +[ -f "$FILE" ] || return 1 #errer file not exist +local MD5_new=$(md5sum "$FILE" | cut -c -32) +local SIZE_new="$(file_size "$FILE")" + +#db path exist && md5 same -> update this entry +#db path exist && ttsync=exist/backup && md5 !same -> ttsync=del + new db entry +#or new db entry + +#db entry is{ +# chek if size ->md5 exist -> update path&name (MV) +# else complete new entry +#} }