OVea version
This commit is contained in:
+9
-2
@@ -20,7 +20,8 @@ import csv
|
||||
import calendar
|
||||
from datetime import date, datetime, timezone
|
||||
import pytz
|
||||
|
||||
from urllib.parse import unquote
|
||||
import re
|
||||
|
||||
class EventRow():
|
||||
|
||||
@@ -170,7 +171,7 @@ def get_all_events(config, calendars_find):
|
||||
elif field == "LOCATION":
|
||||
event_row.set_location(event_field[1])
|
||||
elif field == "DESCRIPTION":
|
||||
event_row.set_description(event_field[1])
|
||||
event_row.set_description(clean_description(event_field[1]))
|
||||
event_rows.append(event_row)
|
||||
|
||||
sorted_rows = sorted(event_rows, key=lambda l: datetime.strptime(str(l.start_date)+'T'+str(l.start_time), "%Y-%m-%dT%H:%M:%S"))
|
||||
@@ -179,6 +180,12 @@ def get_all_events(config, calendars_find):
|
||||
|
||||
return calendars_to_write
|
||||
|
||||
def clean_description(value):
|
||||
if value.startswith("text/html,"):
|
||||
value = value[len("text/html,"):]
|
||||
value = unquote(value)
|
||||
value = re.sub(r'<[^>]+>', '', value)
|
||||
return value.strip().strip('"')
|
||||
|
||||
def write_csv(filename, rows):
|
||||
"""Write CSV file"""
|
||||
|
||||
Reference in New Issue
Block a user