hackertours-schedule/voc/generic.py
2025-11-18 19:05:41 +01:00

25 lines
766 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from voc.event import EventSourceInterface
from .schedule import Schedule, ScheduleException
from urllib.parse import urlparse
class GenericConference(dict, EventSourceInterface):
schedule_url = None
options = {}
timeout = 10
def __init__(self, url, data, options={}):
self.origin_system = urlparse(url).netloc
self.schedule_url = url
self.options = options
self['url'] = url
dict.__init__(self, data)
def __str__(self):
return self['name']
def schedule(self, *args) -> Schedule:
if not self.schedule_url or self.schedule_url == 'TBD':
raise ScheduleException(' has no schedule url yet ignoring')
return Schedule.from_url(self.schedule_url, self.timeout)