A project to make a dashboard of meeting based on an ICS link
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CGI_ICS_Dashboard/CurrentMeeting.py

52 lines
1.4 KiB

#!/usr/bin/env python3
import cgitb
from ics import Calendar, Event, timeline
from urllib.request import urlopen
from datetime import datetime
import arrow
cgitb.enable()
URL = "ICS LINK"
CAL = Calendar(urlopen(URL).read().decode('iso-8859-1'))
TML = timeline.Timeline(CAL).now()
TMA = []
for each in TML:
TMA.append(each)
DN = datetime.now().strftime('%m-%d-%Y')
TN = datetime.now().strftime('%H:%M')
print('Content-Type: text/html;charset=utf-8')
print('Content-Type:text/html\r\n\r\n')
print('''
<html>
<meta http-equiv="refresh" content="30" />
<head>
<title>Current Meeting TestRoom</title>
</head>
''')
print('<body style="background-image:url(/DarkWood.jpg); background-repeat: no-repeat; background-size: cover;">')
print('<font face="Verdana" color="white">')
print('<p style="font-size: 7em; margin: 0; padding: 0;">')
print(TN)
print('</p>')
print('<p style="font-size: 4em; margin: 0; padding: 0; margin-bottom: 2em">')
print(DN)
print('</p>')
print('''
<div style="position: relative">
<p style="font-size: 7em; position: fixed; bottom: 0; width:100%; text-align: center">
''')
print('Current:<br>')
if len(TMA) > 0:
for item in TMA:
print('{}- {} {}<br>'.format(item.begin.format('HH:mm'), item.end.format('HH:mm'), item.name, item.description))
else:
print('Available')
print('</p></div>')
print('</font>')
print('</body>')
print('</html>')