Fixes for Presentation 1

This commit is contained in:
Martin Schett 2020-12-09 19:04:25 +01:00
parent d093dbb5b9
commit ffa2954d1f
5 changed files with 17 additions and 8 deletions

View File

@ -226,7 +226,7 @@ while (command.lower() not in ["exit", "quit", "end"]):
print("fetch - gets the next image from database if exists") print("fetch - gets the next image from database if exists")
print("fetchall - get all images") print("fetchall - get all images")
print("delete - delets the next image from db if exists") print("delete - delets the next image from db if exists")
print("delete - delets all images from the service") print("deleteall - delets all images from the service")
print("rapid <#amount> [<#time>] - next <amount> images in line are sent to backend in <time> (default: 5) second intervals") print("rapid <#amount> [<#time>] - next <amount> images in line are sent to backend in <time> (default: 5) second intervals")
print("skip [<#amount>] - skips the next <amount> number of images in line or 1 if no <amount> is given") print("skip [<#amount>] - skips the next <amount> number of images in line or 1 if no <amount> is given")
print("set <#index> - sets image on given <index> as next in line") print("set <#index> - sets image on given <index> as next in line")
@ -234,7 +234,7 @@ while (command.lower() not in ["exit", "quit", "end"]):
print() print()
print() print()
if command.lower() == "check": if command.lower() == "check" or command.lower() == "health":
check_system() check_system()
if command.lower() == "dir": if command.lower() == "dir":

View File

@ -85,9 +85,12 @@ class MinioService:
r = requests.get(settings.AWS_HOST + "?list") r = requests.get(settings.AWS_HOST + "?list")
root = ET.fromstring(r.content) root = ET.fromstring(r.content)
list = [] list = []
cnt = 0
for child in root.iter('{http://s3.amazonaws.com/doc/2006-03-01/}Contents'): for child in root.iter('{http://s3.amazonaws.com/doc/2006-03-01/}Contents'):
list.append(child.find('{http://s3.amazonaws.com/doc/2006-03-01/}Key').text) list.append(child.find('{http://s3.amazonaws.com/doc/2006-03-01/}Key').text)
cnt = cnt + 1
if cnt == 0:
return True
body = "<Delete>" body = "<Delete>"
for key in list: for key in list:
body += "<Object><Key>" + key + "</Key></Object>" body += "<Object><Key>" + key + "</Key></Object>"

View File

@ -30,17 +30,18 @@ class MongoDBService:
@staticmethod @staticmethod
def getSingle(identifier): def getSingle(identifier):
metadata = None
try:
instance = MongoManager.getInstance() instance = MongoManager.getInstance()
db = instance.AIC db = instance.AIC
col = db.metadata col = db.metadata
metadata = None metadata = None
try:
resp = col.find({"identifier": identifier}) resp = col.find({"identifier": identifier})
metadata = resp[0] metadata = resp[0]
except: except:
print("Could not find Metadata") print("Could not find Metadata")
if metadata is None: if metadata is None:
return None return None
else: else:

View File

@ -6,6 +6,11 @@ class WrapperService:
@staticmethod @staticmethod
def wrap_file(file_bytes: bytes) -> str: def wrap_file(file_bytes: bytes) -> str:
file_encoded_b64 = base64.b64encode(file_bytes) file_encoded_b64 = base64.b64encode(file_bytes)
print('b64 gemacht')
print(file_encoded_b64)
print()
print('utf8- decodiert')
print(file_encoded_b64.decode())
return file_encoded_b64.decode() return file_encoded_b64.decode()
@staticmethod @staticmethod