Merge branch 'master' of BezierQuadratic/FreeCompetitors into master
This commit is contained in:
commit
b8fd05de4f
5 changed files with 22 additions and 16 deletions
8
licenses.json
Normal file
8
licenses.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"licenses": [
|
||||
"GNU GPL v3.0",
|
||||
"GPL3",
|
||||
"GPL3+",
|
||||
"MIT"
|
||||
]
|
||||
}
|
BIN
modules/__pycache__/render.cpython-310.pyc
Normal file
BIN
modules/__pycache__/render.cpython-310.pyc
Normal file
Binary file not shown.
BIN
modules/__pycache__/search.cpython-310.pyc
Normal file
BIN
modules/__pycache__/search.cpython-310.pyc
Normal file
Binary file not shown.
|
@ -7,16 +7,13 @@
|
|||
# your ability to set it up and running.
|
||||
|
||||
from modules import search
|
||||
import json
|
||||
|
||||
def html(page, json):
|
||||
|
||||
# This function adds a rendering of the json into the page
|
||||
|
||||
|
||||
|
||||
free = search.is_free(json)
|
||||
|
||||
|
||||
page = page + "\n <h1>"
|
||||
try:
|
||||
page = page + '\n<img src="'+ json["links"]["icon"] + '" alt="Logo" style="width:50px;">'
|
||||
|
@ -118,7 +115,6 @@ def suggestions(page, json):
|
|||
biggest = i[0]
|
||||
|
||||
for i in found:
|
||||
|
||||
free = search.is_free(i[-1])
|
||||
|
||||
if not i[0] or i[-1] == json or not free:
|
||||
|
|
|
@ -101,14 +101,16 @@ def suggest(json_data):
|
|||
|
||||
return found
|
||||
|
||||
def is_free(data):
|
||||
|
||||
# TODO: Add a more complex algorithm of checking if software is
|
||||
# free or not. There are plenty of semi-free software like
|
||||
# Unreal Engine. They have licenses but they do not give the users
|
||||
# the four essential freedoms.
|
||||
|
||||
free = False
|
||||
if "licenses" in data and data["licenses"]:
|
||||
free = True
|
||||
return free
|
||||
def is_free(app):
|
||||
if "licenses" in app and app["licenses"]:
|
||||
matches = 0
|
||||
with open("licenses.json", "r") as data:
|
||||
all_licenses = json.load(data)
|
||||
for license in app["licenses"]:
|
||||
for license2 in all_licenses["licenses"]:
|
||||
if license2 == license:
|
||||
matches = matches + 1
|
||||
break
|
||||
if matches == len(app["licenses"]):
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue