imprufe db/import-md5-list

This commit is contained in:
6543 2019-02-08 00:43:40 +01:00
parent e282ebc0fc
commit 30e26c1626

View File

@ -78,7 +78,9 @@ function md5_in_add() {
local relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
local name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
local folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)
[ "$(db_query "SELECT COUNT(ID) FROM File WHERE MD5='$md5' AND Folder='$folder' AND Name='$name';")" == "0" ] && { #wenn KEIN gleicher Eintrag Vorhanden
db_query "INSERT INTO File (MD5, Folder, Name, TTSync) VALUES ('$md5', '$folder', '$name', $TTSYNC_EXIST );" #-> handle in future: ";'()"
}
done

exit 0
@ -104,7 +106,12 @@ function md5_in_del() {
local relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
local name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
local folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)

if [ "$(db_query "SELECT COUNT(ID) FROM File WHERE MD5='$md5' AND Folder='$folder' AND Name='$name';")" -gt "0" ]; then #wenn gleicher Eintrag Vorhanden
db_query "UPDATE File SET TTSync=$TTSYNC_DEL WHERE MD5='$md5' AND Folder='$folder' AND Name='$name';" #-> handle in future: ";'()"
else #Ansonsten Erstelle Del eintrag
db_query "INSERT INTO File (MD5, Folder, Name, TTSync) VALUES ('$md5', '$folder', '$name', $TTSYNC_DEL );" #-> handle in future: ";'()"
fi
done

exit 0