error corections
This commit is contained in:
parent
eb0354cf87
commit
f82a1a90df
@ -85,7 +85,7 @@ function main() {
|
|||||||
if [ "0" == "$SIZE_new" ]; then
|
if [ "0" == "$SIZE_new" ]; then
|
||||||
#file exist but empty
|
#file exist but empty
|
||||||
#rm "$FILE" <- secure? 2check
|
#rm "$FILE" <- secure? 2check
|
||||||
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck=$DATE WHERE ID=$ID;"
|
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck='$DATE' WHERE ID=$ID;"
|
||||||
else
|
else
|
||||||
#recalc md5 ... + check
|
#recalc md5 ... + check
|
||||||
#update DB
|
#update DB
|
||||||
@ -93,18 +93,18 @@ function main() {
|
|||||||
MD5=$(db_query "SELECT MD5 FROM File WHERE ID=$ID;")
|
MD5=$(db_query "SELECT MD5 FROM File WHERE ID=$ID;")
|
||||||
|
|
||||||
if [ "$MD5" == "$MD5_new" ]; then
|
if [ "$MD5" == "$MD5_new" ]; then
|
||||||
db_query "UPDATE File SET Size=$SIZE_new,TTCheck=$DATE WHERE ID=$ID;"
|
db_query "UPDATE File SET Size=$SIZE_new,TTCheck='$DATE' WHERE ID=$ID;"
|
||||||
else
|
else
|
||||||
#new file/file changed!
|
#new file/file changed!
|
||||||
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck=$DATE WHERE ID=$ID;"
|
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck='$DATE' WHERE ID=$ID;"
|
||||||
file_add "$(db_query "SELECT CONCAT(Folder, '/', Name) FROM File WHERE ID=$ID;")"
|
file_add "$(db_query "SELECT CONCAT(Folder, '/', Name) FROM File WHERE ID=$ID;")" "$MD5_new"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# file dont exist
|
# file dont exist
|
||||||
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck=$DATE WHERE ID=$ID;"
|
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck='$DATE' WHERE ID=$ID;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
@ -146,15 +146,16 @@ function file_size() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# file_add [rel.path] (md5)
|
||||||
function file_add() {
|
function file_add() {
|
||||||
echo 2DO
|
local MD5="$2"
|
||||||
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 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 name="$(echo "$relrevpath" | cut -d '/' -f 1 | rev)"
|
||||||
local folder="$(echo $relrevpath | cut -d '/' -f 2- | rev)"
|
local folder="$(echo "$relrevpath" | cut -d '/' -f 2- | rev)"
|
||||||
local FILE="$moviedir/$(echo $relrevpath | rev)"
|
local FILE="$moviedir/$(echo "$relrevpath" | rev)"
|
||||||
[ -f "$FILE" ] || return 1 #errer file not exist
|
[ -f "$FILE" ] || return 1 #errer file not exist
|
||||||
local MD5_new=$(md5sum "$FILE" | cut -c -32)
|
[ -z "$MD5" ] && MD5="$(md5sum "$FILE" | cut -c -32)"
|
||||||
local SIZE_new="$(file_size "$FILE")"
|
local SIZE="$(file_size "$FILE")"
|
||||||
|
|
||||||
#db path exist && md5 same -> update this entry
|
#db path exist && md5 same -> update this entry
|
||||||
#db path exist && ttsync=exist/backup && md5 !same -> ttsync=del + new db entry
|
#db path exist && ttsync=exist/backup && md5 !same -> ttsync=del + new db entry
|
||||||
|
Loading…
Reference in New Issue
Block a user