|
|
|
@ -46,6 +46,18 @@ def checker(directory_URL, file_name): |
|
|
|
|
else: |
|
|
|
|
return('No dates found') |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
def general_checker(data_json, distro_name): |
|
|
|
|
"""General distro checker""" |
|
|
|
|
csc_url = "http://mirror.csclub.uwaterloo.ca/" + data_json[distro_name]["csc"] \ |
|
|
|
|
+ data_json[distro_name]["file"] |
|
|
|
|
upstream_url = data_json[distro_name]["upstream"] + data_json[distro_name]["file"] |
|
|
|
|
return requests.get(csc_url).text == requests.get(upstream_url).text |
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
"""for distro in [Arch, Ceph, Debian, Eclipse, GNU, Kernel, OpenBSD]: |
|
|
|
|
try: |
|
|
|
@ -65,11 +77,12 @@ if __name__ == "__main__": |
|
|
|
|
data = json.load(file) |
|
|
|
|
current_time = int(time.time()) |
|
|
|
|
for distro in data: |
|
|
|
|
csc_url = "http://mirror.csclub.uwaterloo.ca/" + data[distro]["csc"] \ |
|
|
|
|
+ data[distro]["file"] |
|
|
|
|
upstream_url = data[distro]["upstream"] + data[distro]["file"] |
|
|
|
|
try: |
|
|
|
|
if requests.get(csc_url).text == requests.get(upstream_url).text: |
|
|
|
|
if distro == "IPFire": |
|
|
|
|
checker_result = ipfire_checker() |
|
|
|
|
else: |
|
|
|
|
checker_result = general_checker(data, distro) |
|
|
|
|
if checker_result: |
|
|
|
|
data[distro]["out_of_date_since"] = None |
|
|
|
|
elif data[distro]["out_of_date_since"] is None: |
|
|
|
|
data[distro]["out_of_date_since"] = current_time |
|
|
|
|