PVC debugging

This commit is contained in:
Neil Carpenter 2022-12-05 07:32:27 -05:00
parent 4a0de99672
commit c29bd05f3b
2 changed files with 8 additions and 0 deletions

View file

@ -1,14 +1,21 @@
import hashlib
import os
def already_posted(id, path):
print("Checking if posted " + id + " " + path)
res = os.listdir("/data")
print(res)
with open(path) as file:
content = file.read().split("\n")
print("already posted " + content)
sha1 = hashlib.sha1(bytes(id, "utf-8")).hexdigest()
if sha1 in content:
return True
return False
def mark_as_posted(id, path):
print("Adding " + id + " " + path)
with open(path, 'a') as file:
sha1 = hashlib.sha1(bytes(id, "utf-8")).hexdigest()
file.write(sha1+'\n')
print(file.read())

View file

@ -44,6 +44,7 @@ elif (os.environ.get("USE_KUBERNETES")):
else:
id_filename = "./already_posted.txt"
print(id_filename)
with open(id_filename, "a") as f:
f.write("\n")