beautysh tools/db/update-file-state
This commit is contained in:
parent
a6abdc45ea
commit
eb0354cf87
@ -102,17 +102,17 @@ function main() {
|
||||
|
||||
fi
|
||||
}
|
||||
else
|
||||
else
|
||||
# file dont exist
|
||||
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck=$DATE WHERE ID=$ID;"
|
||||
fi
|
||||
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck=$DATE WHERE ID=$ID;"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#add new files ....
|
||||
cat "$list_tmp/new" | while read line; do
|
||||
#add new files ....
|
||||
cat "$list_tmp/new" | while read line; do
|
||||
file_add "$line"
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
rm -r "$list_tmp/"
|
||||
@ -147,23 +147,23 @@ function file_size() {
|
||||
}
|
||||
|
||||
function file_add() {
|
||||
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)"
|
||||
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")"
|
||||
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 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
|
||||
#}
|
||||
#db entry is{
|
||||
# chek if size ->md5 exist -> update path&name (MV)
|
||||
# else complete new entry
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user