From 96b06a686bcaaf8a9801f9d8478743983bbcb281 Mon Sep 17 00:00:00 2001 From: boyska Date: Sun, 24 Jun 2018 00:48:40 +0200 Subject: [PATCH] ICS: refactoring --- plugins/talks.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/talks.py b/plugins/talks.py index fa18898..de73917 100644 --- a/plugins/talks.py +++ b/plugins/talks.py @@ -326,7 +326,8 @@ def talk_to_ics(talk): if 'time' not in talk or 'duration' not in talk: return None e = ics.Event( - uid="%s@%d.hackmeeting.org\n" % (talk['id'], talk['day'].year), + uid="%s@%d.hackmeeting.org" % (talk['id'], + get_global_data()['startdate'].year), name=talk['id'], begin=talk['time'], duration=datetime.timedelta(minutes=talk['duration']), @@ -335,9 +336,11 @@ def talk_to_ics(talk): # ics.py has some problems with unicode # unidecode replaces letters with their most similar ASCII counterparts # (ie: accents get stripped) - e.description = unidecode.unidecode(talk['text']) - + if 'text' in talk: + e.description = unidecode.unidecode(talk['text']) e.url = pelican.settings['SCHEDULEURL'] + '#talk-' + talk['id'] + if 'room' in talk: + e.location = talk['room'] return e