do not fail with empty/missing title

This commit is contained in:
MaZderMind 2015-05-28 14:18:29 +02:00
parent 3f4780b3cf
commit c1bf3aa080

View file

@ -209,7 +209,7 @@ def events(scheduleUrl, titlemap={}):
# yield a tupel with the event-id, event-title and person-names
yield {
'id': int(event.get('id')),
'title': titlemap[id] if id in titlemap else event.find('title').text.strip(),
'title': titlemap[id] if id in titlemap else (event.find('title').text.strip() if event.find('title') is not None and event.find('title').text is not None else ''),
'subtitle': event.find('subtitle').text.strip() if event.find('subtitle') is not None and event.find('subtitle').text is not None else '',
'persons': personnames,
'personnames': ', '.join(personnames)