26 lines
886 B
Python
26 lines
886 B
Python
"""
|
|
Contains slackware class
|
|
"""
|
|
|
|
import os
|
|
from project import Project
|
|
from shared import CSC_MIRROR
|
|
import requests
|
|
import datefinder # another date finding library
|
|
from datetime import timedelta
|
|
from datetime import datetime
|
|
import re
|
|
import pandas as pd
|
|
|
|
class slackware(Project):
|
|
"""slackware class"""
|
|
@staticmethod
|
|
def check(data, project, current_time):
|
|
page = requests.get(data[project]["upstream"]).text
|
|
if (page.find("mirror.csclub.uwaterloo.ca/slackware/") != -1):
|
|
indexOfFile = page.find("Last Updated:")
|
|
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'))
|
|
else:
|
|
return False |