123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- import os
- import sys
- import json
- from modules import missing
- args = sys.argv
- if "--help" in args or "-h" in args:
- print("""You can use the next commands after check.py
- -links | Will skip checking the links
- --help | Displays this help menu""")
- exit()
- print("* Checking...")
- try:
- with open("data/missing.json") as json_file:
- miss = json.load(json_file)
- except:
- miss = {}
- if miss:
- print()
- print("* Missing Software found! Please copy-paste the next")
- print(" section into our Missing Software Mega-Thread at: ")
- print(" https://notabug.org/jyamihud/FreeCompetitors/issues/25")
- print("===========================================================")
- print()
- missing.List()
- if miss:
- print()
- print("===========================================================")
- print()
- import urllib.request
- import urllib.error
- error = False
- def iferror():
- if not error:
- print()
- print(" * Some files in 'apps' folder have problems! Please")
- print(" copy-paste the next section into our Problems with")
- print(" Software Mega-Thread at: ")
- print(" https://notabug.org/jyamihud/FreeCompetitors/issues/24")
- print("===========================================================")
- print()
- return True
- for f in os.listdir("apps"):
- if f.endswith(".json"):
-
- try:
- with open("apps/"+f) as json_file:
- app = json.load(json_file)
- except Exception as e:
- error = iferror()
- print(" - [ ] `apps/"+f+"` fails to load. Says: `"+str(e)+"`")
- continue
-
- if not "-links" in args:
- for link in app.get("links",[]):
-
-
-
-
- try:
- urllib.request.urlopen(app.get("links",[])[link])
- except Exception as e:
- if "403" not in str(e):
- error = iferror()
- print(" - [ ] `apps/"+f+"` "+link+" link doesn't seem to work.")
-
- lices = app.get("licenses", [])
- try:
- with open("data/licenses.json") as json_file:
- ll = json.load(json_file)["licenses"]
- except:
- ll = {}
-
- for lic in lices:
- found = False
- for l in ll:
- if lic in [l.get("licenseId",""),l.get("name","")]:
- found = True
- if not found:
- error = iferror()
- print(" - [ ] `apps/"+f+"` License '"+lic+"' is unknown.")
-
- print()
- print("===========================================================")
- print()
- print("* Check is finished!")
- print()
|