This commit is contained in:
Neil Carpenter 2022-12-05 07:39:09 -05:00
parent c5ea92ea1f
commit 1be456ae79
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -37,10 +37,11 @@ if verbose:
print('SETTINGS' , settings)
agree = [1, True, "true", "True", "yes", "Yes"]
if (os.environ.get("USE_KUBERNETES")):
id_filename = "/data/already_posted.txt"
if (os.environ.get("USE_DOCKER")):
id_filename = "/app/already_posted.txt"
elif (os.environ.get("USE_KUBERNETES")):
id_filename = "/data/already_posted.txt"
else:
id_filename = "./already_posted.txt"