Skip to content
Snippets Groups Projects
Commit a7f97469 authored by Noé Le Cam's avatar Noé Le Cam
Browse files

Implemented ADE scraping

parent 69606d78
Branches
No related merge requests found
......@@ -2,14 +2,21 @@ main > form {
display: flex;
flex-direction: column;
gap: 0.5rem;
background: var(--smoke);
/* border: 1px solid rgba(255, 255, 255, 0.1); */
box-shadow: 0 0 20px rgb(0, 0, 0, 0.5);
box-sizing: border-box;
width: 28rem;
padding: 1.5rem;
border-radius: 10px;
max-width: 100vw;
margin: 10px 10px;
}
@media screen and (min-width: 768px) {
main > form {
max-width: 28rem;
}
}
label {
......
......@@ -11,9 +11,11 @@
}
body {
height: 100vh;
background: url("../img/bg-classroom.jpg");
background-size: cover;
background-size: 100vh cover;
background-repeat: no-repeat;
background-position: center;
}
main {
......@@ -28,22 +30,48 @@ main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
justify-content: flex-start;
gap: 1rem;
}
@media screen and (min-width: 576px) {
main {
justify-content: center;
}
}
header * {
font-family: 'Roboto Mono', sans-serif;
font-family: "Roboto Mono", sans-serif;
}
header {
max-width: 100vw;
}
header > h1 {
letter-spacing: 0.5em;
word-wrap: break-word;
text-indent: 0.25em;
letter-spacing: 0.3em;
text-align: center;
font-size: 4rem;
font-weight: 700;
padding-left: 1.5rem;
font-weight: 800;
}
@media screen and (min-width: 576px) {
header {
max-width: 40rem;
}
header > h1 {
text-indent: 0.45em;
letter-spacing: 0.5em;
}
}
header > p {
text-align: center;
font-weight: 300;
......@@ -64,6 +92,8 @@ button {
padding-left: auto;
padding-right: auto;
cursor: pointer;
/* Transition */
transition: filter 0.2s, background 0.2s;
}
......
import sys
import re
import requests
import sqlite3
from ics import Calendar
url: str = "https://adecons.unistra.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?resources=5242&projectId=8&calType=ical&nbWeeks=4"
database = sqlite3.connect("assets/ufhour.sqlite")
rooms_tp = [
('T01', 0, 0),
('T02', 0, 0),
('T03', 0, 0),
('T11', 0, 1),
('T20', 0, 2),
('T21', 0, 2),
('T22', 0, 2),
('T23', 0, 2),
('T24', 0, 2),
]
def main():
init_tables()
import_schedule()
def import_schedule():
cursor = database.cursor()
cal = Calendar(requests.get(url, allow_redirects=True).text)
events = [(re.match('([A-Z]\d+)', e.location).group(1),
e.begin.format("DD-MM-YYYY"),
e.begin.shift(hours=+2).format("HH:mm"),
e.end.shift(hours=+2).format("HH:mm"))
for e in cal.events]
cursor.executemany("INSERT OR IGNORE INTO schedule VALUES (?,?,?,?)", events)
database.commit()
def init_tables():
cursor = database.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS rooms (
id TEXT PRIMARY KEY,
type INTEGER NOT NULL,
location INTEGER NOT NULL
)""")
cursor.execute("""CREATE TABLE IF NOT EXISTS schedule (
id TEXT NOT NULL,
date TEXT NOT NULL,
start_time TEXT NOT NULL,
end_time TEXT NOT NULL,
FOREIGN KEY(id) REFERENCES rooms(id)
)""")
cursor.executemany("INSERT OR IGNORE INTO rooms VALUES (?,?,?)", rooms_tp)
database.commit()
if __name__ == "__main__":
main()
File added
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment