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

View File

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