# THIS SOFTWARE IS A PART OF FREE COMPETITOR PROJECT
# THE FOLLOWING SOURCE CODE I UNDER THE GNU
# AGPL LICENSE V3 OR ANY LATER VERSION.
# This project is not for simple users, but for
# web-masters and a like, so we are counting on
# your ability to set it up and running.
from modules import search
def html(page, json):
# This function adds a rendering of the json into the page
free = search.is_free(json)
page = page + "\n
"
try:
page = page + '\n'
except:
pass
name = json.get("names",["Unknown"])[0]
page = page + "\n" + name
page = page + "
"
# Few words about it
page = page + ""+json.get("comment","")+"
"
# I want to show nothing else from if it's proprietary
if not free:
l = json.get("issues", [])
page = page +"Anti-Features / Problems:
"
for i in l:
page = page + "
"+i
return page
# Links
#
#
# Company |
# Contact |
# Country |
#
page = page + """
"""
page = page + ""
links = json.get("links", {})
for website in links:
if website in ["icon"]:
continue
link = links[website]
page = page + """
|
"""
page = page + "
"
# Details
categories = {"generic_name":"Features",
"licenses":"License(s)",
"platforms":"Platforms",
"networks_read":"Accesses Data from",
"networks_write":"Interacts / Publishes to",
"formats_read":"Opens from File-Formats",
"formats_write":"Saves to File-Formats",
"issues":"Anti-Features / Problems",
"interface":"Interface",
"languages":"Programming Languages"}
for c in categories:
l = json.get(c, [])
if not l:
continue
page = page + ""
page = page +""+categories[c]+":
"
for i in l:
page = page + " "+i+"
"
page = page + " "
return page
def suggestions(page, json):
# This function will render suggestions
page = page + "Free Competitors:
"
found = search.suggest(json)
biggest = 0
for i in found:
if i[0] > biggest:
biggest = i[0]
for i in found:
free = search.is_free(i[-1])
if not i[0] or i[-1] == json or not free:
continue
page = page + "
Features match: " + str(int(i[0]/biggest*100)) + "%"
page = html(page, i[-1])
return page
def search_widget(page):
# Adds a search bar to the page
page = page + """
"""
return page
def source_code_link(page):
# Adds a source code link
page = page + "
This website is under the GNU AGPL license.
"
page = page + """
"""
return page