Upload files to 'modules'

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2022-03-29 14:53:17 +00:00
parent 2d12250bc3
commit 0f293528b9
2 changed files with 13 additions and 6 deletions

View file

@ -66,11 +66,16 @@ def suggestions(page, json):
# This function will render suggestions
page = page + "<br><br><h1>Replacements:</h1><br><br>"
print("json request")
found = search.suggest(json)
print("json received", len(found))
for i in found:
print(i[-1].get("names",["no name"])[0], "Drawing")
free = False
if "licenses" in i[-1] and i[-1]["licenses"]:
free = True

View file

@ -27,7 +27,7 @@ def search_app(name):
with open("apps/"+i) as json_file:
idata = json.load(json_file)
except Exception as e:
print("Error!", e)
print("Error!", i, e)
idata = {}
all_apps.append(idata)
@ -69,7 +69,7 @@ def suggest(json_data):
with open("apps/"+i) as json_file:
idata = json.load(json_file)
except Exception as e:
print("Error!", e)
print("Error!", i, e)
idata = {}
all_apps.append(idata)
@ -81,12 +81,14 @@ def suggest(json_data):
for b in json_data.get(c, []):
if b in i.get(c, []):
score += 1
print(score, "SCORE")
print(score, i.get("names",["no name"])[0], "SCORE")
found.append([score, i])
try:
found = reversed(sorted(found))
except:
return []
found.sort(key=lambda x: x[0])
found = list(reversed(found))
except Exception as e:
print("Found problem:", e)
fount = []
return found