forked from public/mirror-checker
Redo ubuntu, double ubuntu_releases OOS interval
This commit is contained in:
parent
bd1573ed71
commit
dce2583550
|
@ -389,7 +389,7 @@
|
||||||
},
|
},
|
||||||
"ubuntu_releases": {
|
"ubuntu_releases": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": null,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 172800,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-release",
|
"upstream": "https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-release",
|
||||||
"file": ""
|
"file": ""
|
||||||
|
|
2
main.py
2
main.py
|
@ -36,7 +36,7 @@ if __name__ == "__main__":
|
||||||
if data[project].get('exclude', False):
|
if data[project].get('exclude', False):
|
||||||
continue
|
continue
|
||||||
checker_result = project_class.check(data, project, current_time)
|
checker_result = project_class.check(data, project, current_time)
|
||||||
if project in ["CPAN", "ubuntu", "ubuntu_releases", "manjaro", "mxlinux", "cran", "ctan", "gentooportage"]:
|
if project in ["CPAN", "ubuntu_releases", "manjaro", "mxlinux", "cran", "ctan", "gentooportage"]:
|
||||||
if checker_result:
|
if checker_result:
|
||||||
safe_print(f"Success: {project} up-to-date")
|
safe_print(f"Success: {project} up-to-date")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -17,9 +17,4 @@ class ubuntu(Project):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check(data, project, current_time):
|
def check(data, project, current_time):
|
||||||
page = requests.get(data[project]["upstream"]).text
|
page = requests.get(data[project]["upstream"]).text
|
||||||
indexOfFile = page.find("last verified")
|
return page.count("Up to date") == 21
|
||||||
matches = list(datefinder.find_dates(page[indexOfFile:]))
|
|
||||||
date = matches[0] # date is of type datetime.datetime
|
|
||||||
return(pd.to_datetime(current_time, unit='s') - date.replace(tzinfo=None) <= pd.to_timedelta(data[project]["out_of_sync_interval"], unit='s'))
|
|
||||||
|
|
||||||
# https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-archive
|
|
||||||
|
|
Loading…
Reference in New Issue