added some distros

This commit is contained in:
Tom 2021-09-11 22:06:55 -07:00
parent 8c305397b9
commit debbbde293
2 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,10 @@
["OpenBSD", "", "", "timestamp"],
["kernel", "", "", "sha256sums.asc"],
["debian", "", "", "master"]
["debian", "", "", "master"],
["GNU", "", "", "mirror-updated-timestamp.txt"],
["almalinux", "", "", "TIME"],
["alpine", "", "", "last-updated"],
["Apache", "", "", "time.txt"],
["CentOS", "", "", "timestamp.txt"]

View File

@ -19,6 +19,7 @@ import json # import json to read distro info stored in json file
import datefinder # another date finding library
# checker: gets the timestamp of the file inside the directory at the specified URL and returns it as a string
def checker(directory_URL, file_name):
page = requests.get(directory_URL).text
indexOfFile = page.find(file_name)
@ -52,10 +53,20 @@ if __name__ == "__main__":
except requests.exceptions.RequestException as err:
print(f"Error: {}\n{err}")"""
# the implementation to check timestamps in distro mirror directory:
distros = json.load(open('distros.json',))
# print(distros)
for distro in distros:
print(distro[0] + ":")
print("CSC mirror: " + checker(distro[1], distro[3]))
print("Official distro: " + checker(distro[2], distro[3]))
print("Official distro: " + checker(distro[2], distro[3]))
# for eclipse, i couldn't find a directory from the official website, so i decided to temporarily cheat a little bit and peek at another person's mirror for explipse
# i just realized that my method doesn't just work for scraping html directories but everything returned by a URL (websites, files storing a time)
# i think i'll put checking arch, ceph, ecplipse on hold because it's more proper to check them using as.Date(17383, origin="1970-01-01") where the date is stored in
# a file as a number, but this would require another function and me looping through different functions. i think i'll do this later
# corresponding jsons: ["Eclipse", "", "", "TIME"],
# ["Ceph", "", "", "timestamp"],
# i don't know what to do with damnsmalllinux, it seems like an abandoned project. useful link:
# the other function is probably probing mirror status sites like this:
# maybe i can make a column in json that specifies the method for checking the particular mirror and that identifier will find a specific function to check the update