예제 #1
0
def main():
    news = extractor.getNews()
    schedule = extractor.getSchedule()
    bellDay = extractor.getBellDay(schedule)
    date = extractor.getDate()
    return render_template('home.html',
                           news=news,
                           schedule=schedule,
                           bellDay=bellDay,
                           date=date)
예제 #2
0
def main():
    news     = extractor.getNews()
    schedule = extractor.getSchedule()
    bellDay  = extractor.getBellDay(schedule)
    date     = extractor.getDate()
    return render_template('home.html',
                           news=news,
                           schedule=schedule,
                           bellDay=bellDay,
                           date=date)
예제 #3
0
def main():
    data = extractor.loadStuySite()
    news = extractor.getNews(data[0])
    schedule = extractor.getSchedule(data[1], data[2])
    bellDay = extractor.getBellDay(schedule)
    gymDay = extractor.getGymDay(schedule)
    date = extractor.getDate()

    temp = Weather.getTemp()
    forecastCode = Weather.getForecast()
    forecastURL = url_for("static", filename="images/" + Weather.getForecastURL(forecastCode))
    forecastString = Weather.getForecastString(forecastCode)

    delays = []  # MTAService.getDelays(MTAService.getSubways())

    # detecting a mobile device
    user_agent_string = request.user_agent.string
    mobile_user_agent_families = [
        "Firefox Mobile",
        "Opera Mobile",
        "Opera Mini",
        "Mobile Safari",
        "webOS",
        "IE Mobile",
        "Playstation Portable",
        "Nokia",
        "Blackberry",
        "Palm",
        "Silk",
        "Android",
        "Maemo",
        "Obigo",
        "Netfront",
        "AvantGo",
        "Teleca",
        "SEMC-Browser",
        "Bolt",
        "Iris",
        "UP.Browser",
        "Symphony",
        "Minimo",
        "Bunjaloo",
        "Jasmine",
        "Dolfin",
        "Polaris",
        "BREW",
        "Chrome Mobile",
        "UC Browser",
        "Tizen Browser",
    ]
    mobile_os_families = ["Windows Phone 6.5", "Windows CE", "Symbian OS", "iOS"]
    ua_family = user_agent_parser.ParseUserAgent(user_agent_string)["family"]
    os_family = user_agent_parser.ParseOS(user_agent_string)["family"]

    if ua_family in mobile_user_agent_families or os_family in mobile_os_families:
        return render_template(
            "mobile.html",
            news=news,
            schedule=schedule,
            bellDay=bellDay,
            gymDay=gymDay,
            date=date,
            temp=temp,
            forecastURL=forecastURL,
            forecastString=forecastString,
            delays=delays,
        )

    else:
        return render_template(
            "home.html",
            news=news,
            schedule=schedule,
            bellDay=bellDay,
            gymDay=gymDay,
            date=date,
            temp=temp,
            forecastURL=forecastURL,
            forecastString=forecastString,
            delays=delays,
        )