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/ConferenceSchedule.py

67 lines
2.3 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'))
TMLT = timeline.Timeline(CAL).today(strict=True)
TMLN = timeline.Timeline(CAL).now()
TMA = []
for each in TMLN:
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="60" />
<head>
<title>Current Meeting TestRoom</title>
</head>
''')
#Display time
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: 8em; 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>')
#Display daily events
print('<center style="font-size: 5em; margin-bottom: 10%;">ROOM NAME</center>')
print('<p style="font-size: 4em; padding: 0;">')
for item in TMLT:
print("{}-{}<br> {}<br><br>".format(item.begin.format('HH:mm'), item.end.format('HH:mm'), item.name))
print('</p>')
#Conditional In use or available statements
if len(TMA) > 0:
print('''
<div style=" left:0; right:0; position: absolute; bottom: 0px; margin-right: 10px; margin-left: 10px; margin-bottom: 5%; height: 10%; background: rgba(204,0,0,.3);">
<div style="position: relative">
<p style="font-size: 5em; position: fixed; bottom: 0; margin-bottom: 10%; width:100%; text-align: center; opacity: 1;">
In Use
''')
else:
print('''
<div style=" left:0; right:0; position: absolute; bottom: 0; margin-right: 10px; margin-left: 10px; margin-bottom: 5%; height: 10%; background: rgba(0,204,0,.2);">
<div style="position: relative">
<p style="font-size: 5em; position: fixed; bottom: 0; margin-bottom: 10%; width:100%; text-align: center">
Available
''')
print('</p></div></div>')
print('</font>')
print('</body>')
print('</html>')