diff --git a/data.json b/data.json index 62c3713..7a27bf8 100644 --- a/data.json +++ b/data.json @@ -114,6 +114,13 @@ "upstream": "http://gentoo.mirrors.tera-byte.com/", "file": "distfiles/timestamp.dev-local" }, + "GNOME": { + "out_of_date_since": null, + "out_of_date_interval": 86400, + "upstream1": "https://mirrors.dotsrc.org/", + "upstream2": "https://muug.ca/mirror/", + "file": "gnome/core/41/41.beta/cache.json" + }, "GNU": { "out_of_date_since": null, "out_of_date_interval": 86400, diff --git a/main.py b/main.py index a4f0d59..ecf74de 100644 --- a/main.py +++ b/main.py @@ -48,10 +48,18 @@ def checker(directory_URL, file_name): else: return('No dates found') +def gnome_checker(data_json, distro_name): + """GNOME checker""" + csc_url = CSC_MIRROR + data_json[distro_name]["file"] + upstream_url1 = data_json[distro_name]["upstream1"] + data_json[distro_name]["file"] + upstream_url2 = data_json[distro_name]["upstream2"] + data_json[distro_name]["file"] + csc_gnome_text = requests.get(csc_url).text + return csc_gnome_text in [requests.get(upstream_url1).text, requests.get(upstream_url2).text] + def ipfire_checker(): """IPFire checker""" - res_text = requests.get("https://mirrors.ipfire.org/mirrors/mirror.csclub.uwaterloo.ca").text - return res_text.find("The mirror is up") != -1 + ipfire_text = requests.get("https://mirrors.ipfire.org/mirrors/mirror.csclub.uwaterloo.ca").text + return ipfire_text.find("The mirror is up") != -1 def general_checker(data_json, distro_name): """General distro checker""" @@ -90,7 +98,17 @@ if __name__ == "__main__": print(f"Success: {distro} up-to-date") break continue - if distro == "IPFire": + if distro == "GNOME": + gnome_text = requests.get("https://download.gnome.org/core/").text + line_count = len(gnome_text.split('\n')) + # Latest version is currently 41, which has line count of 49 + if line_count == 49: + checker_result = gnome_checker(data, distro) + else: + data[distro]["out_of_date_since"] = None + print(f"Failure: {distro} should check for latest version") + continue + elif distro == "IPFire": checker_result = ipfire_checker() else: checker_result = general_checker(data, distro)