def run(self): conference = Conference(title="DENOG8", acronym="denog16", day_count=2, start=parse_date("2016-11-23"), end=parse_date("2016-11-24"), time_slot_duration=parse_duration("00:10")) slug = StandardSlugGenerator(conference) schedule = Schedule(conference=conference) schedule.add_room("darmstadtium") schedule.add_event( 1, "darmstadtium", Event(uid=4001, date=parse_datetime("2016-11-23T13:00:00"), start=parse_time("13:00"), duration=parse_duration("00:15"), slug=slug, title="Opening", language="en", persons={1: "DENOG ORGA"})) schedule.add_event( 2, "darmstadtium", Event(uid=4002, date=parse_datetime("2016-11-24T19:00:00"), start=parse_time("19:00"), duration=parse_duration("00:15"), slug=slug, title="Closing", language="en", persons={1: "DENOG ORGA"})) return schedule
def run(self): # create the conference object conference = Conference( title=self.global_config.get('conference', 'title'), acronym=self.global_config.get('conference', 'acronym'), day_count=int(self.global_config.get('conference', 'day_count')), start=parse_date(self.global_config.get('conference', 'start')), end=parse_date(self.global_config.get('conference', 'end')), time_slot_duration=parse_duration( self.global_config.get('conference', 'time_slot_duration'))) slug = StandardSlugGenerator(conference) schedule = Schedule(conference=conference) rec_license = self.global_config.get('conference', 'license') content = read_input(self.config['path']) with StringIO(content) as csv_file: reader = csv.DictReader(csv_file, delimiter=',') for row in reader: if row['Room'] == '' and row['ID'] == '' and row['Title'] == '': continue schedule.add_room(row['Room']) speakers = {} for pair in row['Speakers'].split('|'): uid, _, name = pair.partition(":") speakers[int(uid)] = name schedule.add_event( int(row['Day']), row['Room'], Event(uid=row['ID'], date=parse_datetime(row['Date'] + 'T' + row['Start'] + ':00'), start=parse_time(row['Start']), duration=parse_duration(row['Duration']), slug=slug, title=row['Title'], description=row.get('Description', ''), abstract=row.get('Abstract', ''), language=row['Language'], persons=speakers, download_url=row.get('File URL', ''), recording_license=rec_license)) return schedule
def run(self): # import json file to dict tree tree = json.loads(read_input(self.config['path'])) # handy references to subtrees conf_tree = tree['schedule']['conference'] # create the conference object conference = Conference( title=conf_tree['title'], acronym=conf_tree['acronym'], day_count=0, # do not automatically generate days start=parse_date(conf_tree['start']), end=parse_date(conf_tree['end']), time_slot_duration=parse_duration(conf_tree['timeslot_duration'])) schedule = Schedule(conference=conference, version=tree['schedule']['version']) for day_tree in conf_tree['days']: day = Day(index=day_tree['index'], date=parse_date(day_tree['date']), start=parse_datetime(day_tree['start']), end=parse_datetime(day_tree['end'])) schedule.add_day(day) for room_name, room_talks in day_tree['rooms'].items(): day.add_room(Room(room_name)) for talk in room_talks: persons = {} for person_info in talk['persons']: name = person_info['full_public_name'] # generate some hopefully unique ids if they are 0 uid = person_info['id'] or (crc32(name.encode()) & 0xffffffff) persons[uid] = name links = {} for link_info in talk.get('links', []): title = link_info['title'] # generate some hopefully unique ids if they are 0 url = link_info['url'] links[url] = title attachments = {} for attachment_info in talk.get('attachments', []): title = attachment_info['title'] # generate some hopefully unique ids if they are 0 url = attachment_info['url'] attachments[url] = title day.add_event( room_name, Event(uid=talk['id'], date=parse_datetime(talk['date']), start=parse_time(talk['start']), duration=parse_duration(talk['duration']), slug=talk['slug'], title=talk['title'], description=talk.get('description', ''), abstract=talk.get('abstract', ''), language=talk['language'], persons=persons, download_url=talk.get('download_url', ''), recording_license=talk.get( 'recording_license', ''), recording_optout=talk['do_not_record'], subtitle=talk.get('subtitle', ''), track=talk.get('track', ''), event_type=talk.get('type', ''), logo=talk.get('logo', ''), links=links, attachments=attachments)) assert conference.day_count == conf_tree['daysCount'] return schedule