Skip to content
Snippets Groups Projects
Commit deca14be authored by Dirk Sarpe's avatar Dirk Sarpe
Browse files

start to work on issue #12

- filter should work
- endtime is in list now, but html needs to be adapted
parent fe51b2cc
No related branches found
No related tags found
No related merge requests found
...@@ -14,12 +14,13 @@ period = (now.floor('day'), now.replace(weeks=+2)) ...@@ -14,12 +14,13 @@ period = (now.floor('day'), now.replace(weeks=+2))
c = Calendar(requests.get(url).text) c = Calendar(requests.get(url).text)
my_list = [] my_list = []
for e in c.events: for e in c.events:
if e.begin > period[0] and e.begin < period[1]: if e.end > period[0] and e.begin < period[1]:
my_list.append((e.name, e.begin.format('DD-MM-YYYY HH:mm:ss'), e.location)) my_list.append((e.name, e.begin.format('DD-MM-YYYY HH:mm:ss'), e.end.format('DD-MM-YYYY HH:mm:ss'), e.location))
event = [my_list[0][0],my_list[1][0],my_list[2][0]] event = [my_list[0][0], my_list[1][0], my_list[2][0]]
begin = [my_list[0][1],my_list[1][1],my_list[2][1]] begin = [my_list[0][1], my_list[1][1], my_list[2][1]]
location = [my_list[0][2],my_list[1][2],my_list[2][2]] end = [my_list[0][2], my_list[1][2], my_list[2][2]]
location = [my_list[0][3], my_list[1][3], my_list[2][3]]
html_page = """<html xmlns="http://www.w3.org/1999/xhtml"> html_page = """<html xmlns="http://www.w3.org/1999/xhtml">
...@@ -72,7 +73,7 @@ html_page = """<html xmlns="http://www.w3.org/1999/xhtml"> ...@@ -72,7 +73,7 @@ html_page = """<html xmlns="http://www.w3.org/1999/xhtml">
</div> </div>
</body> </body>
</html>""" % (event[0], location[0], begin[0], event[1], location[1], begin[1], event[2], location[2], begin[2]) </html>""" % (event[0], location[0], begin[0], end[0], event[1], location[1], begin[1], end[1], event[2], location[2], begin[2], end[2])
out_file = open("/home/eventviewer/events/events.html", "w") out_file = open("/home/eventviewer/events/events.html", "w")
out_file.write(html_page.encode("utf8")) out_file.write(html_page.encode("utf8"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment