-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
102 lines (78 loc) · 2.67 KB
/
main.py
File metadata and controls
102 lines (78 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
from icalendar import Calendar, Event
from datetime import datetime, timedelta
from datetime import date
from datetime import time
from pytz import UTC # timezone
import urllib.request
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
with open ("/Users/antonhavekes/python-docs-hello-world/agendaurl.txt", "r") as myfile:
agendadata=myfile.read().replace('\n', '')
local_filename, headers = urllib.request.urlretrieve(agendadata)
g = open(local_filename)
gcal = Calendar.from_ical(g.read())
strTable = """
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
background-color:#202020;
padding: 15px;
font-size: 35px;
}
th, td {
padding: 15px;
text-align: left;
border: 0px solid black;
}
tr {
border: 5px solid black;
}
th {
padding: 30px;
text-align: center;
font-size: 70px;
}
.desc td {
color:#C8C8C8;
}
</style>
<STYLE TYPE="text/css">
<!--
TD{font-family: Air Americana; font-size: 7}
--->
</STYLE>
</head>
strTable = strTable +"<body style='background-color:black'><table style='width:100%; color: white'><tr><th colspan='3'><font face='Air Americana'>Demo's vandaag</font></th></tr><tr><th style='background-color:black' colspan='3'></th></tr>"
"""
rowcount = 0
for component in gcal.walk():
if component.name == "VEVENT":
summary = component.get('summary')
start = component.get('dtstart')
description = component.get('description')
location = component.get('location')
sttime = start.dt
sttime = sttime + timedelta(hours=1) #+1 uur tijdverschil
if sttime.date() == datetime.today().date():
if sttime.time() > datetime.today().time():
startdemo = str(sttime.strftime('%H:%M'))
strRW1 = "<tr><td width='20%'>"+startdemo+"</td><td width='55%'>"+summary+"</td><td width='25%'>"+location+"</td></tr>"
strRW2 = "<tr><td class=desc colspan='3' STYLE='font-size: 25px; color: #C8C8C8;'>"+description+"</td></tr>"
strTable = strTable+strRW1+strRW2
rowcount = rowcount + 1
print(summary +":" +location)
if rowcount == 0:
strRW0 = "<tr><td colspan='3'>No sprintdemo's today</td></tr>"
strTable = strTable+strRW0
g.close()
strTable = strTable+"</table>hi!!</body></html>"
eenvar = 'testtesttest'
return strTable
if __name__ == '__main__':
app.run()