Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    def run(self):
        # import json file to dict tree
        tree = json.loads(read_input(self.config['path']))

        # 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')))

        schedule = Schedule(conference=conference)
        rec_license = self.global_config.get('conference', 'license')
        day0 = parse_date(self.global_config.get('conference', 'start'))

        for b in tree:
            # filter for locations we want to import
            if b['genre'] not in ['Lecture', 'Workshop',
                                  'Podium']:  # todo move to config
                continue
            # one event (booking) can have multiple shows in proyektor. Most likely we will only have on per talk.
            # We need to look into all as the room (stage) is child of a show and we want to filter stages
            for show in b['shows']:
                if show['stage'] not in ['Content', 'Oase', 'Workshop-Hanger'
                                         ]:  # todo move to config
                    continue

                start = parse_datetime(show['start'])
                end = parse_datetime(show['end'])
                day = (start.date() - day0).days
                duration = end - start
                # build a description the dirty way. currently we dont know how many languages are possible
                description = ""
                if b['description_de']:
                    description += b['description_de']
                if b['description_en']:
                    if len(description) == 0:
                        description += b['description_en']
                    else:
                        description += "\n\n\n" + b['description_en']

                event = Event(
                    uid=b['booking_id'],
                    date=start,
                    start=start.time(),
                    duration=duration,
                    slug=show['name'].replace(" ", "_"),
                    title=show['name'],
                    description=description,
                    language=
                    'EN',  # we don't know that as the proyektor currently does not have that field
                    persons={1: b['artist_name']},
                    recording_license=rec_license,
                    event_type=b['genre'])

                schedule.add_room(show['stage'])
                schedule.add_event(day, show['stage'], event)

        return schedule
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
    def run(self):
        # import json file to dict tree
        tree = json.loads(read_input(self.config['path']))

        # 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')
        day0 = parse_date(self.global_config.get('conference', 'start'))

        for b in tree:
            # filter for locations we want to import
            #if b['genre'] not in ['Lecture', 'Workshop', 'Podium', 'Talk']:  # todo move to config
            #    continue
            # one event (booking) can have multiple shows in proyektor. Most likely we will only have on per talk.
            # We need to look into all as the room (stage) is child of a show and we want to filter stages
            for show in b['shows']:
                #if show['stage'] not in ['Content', 'Oase', 'Workshop-Hanger']:  # todo move to config
                #    continue

                start = parse_datetime(show['start'])
                end = parse_datetime(show['end'])
                day = (start.date() - day0).days + 1

                duration = end - start
                # build a description the dirty way. currently we don't know how many languages are possible
                description = ""
                if b.get('description_de'):
                    description += b.get('description_de')
                if b.get('description_en'):
                    if len(description) == 0:
                        description += b.get('description_en')
                    else:
                        description += "\n\n\n" + b.get('description_en')

                if "Language: EN" in description or "Language:EN" in description:
                    language = "en"
                elif "Language: DE" in description or "Language:DE" in description:
                    language = "de"
                else:
                    language = ""

                if "Recording: Yes" in description or "Recording:Yes" in description:
                    rec_optout = False
                else:
                    rec_optout = True

                if  b.get('artist_name'):
                    title = b.get('artist_name')
                else:
                    title = b['program_name']

                if not title:
                    continue

                if  b.get('program_name'):
                    persons_names = [x.strip() for x in b['program_name'].split(',')]
                    persons = dict(zip(range(len(persons_names)),persons_names))
                else:
                    persons = {}

                event = Event(
                    uid=b['booking_id'],
                    date=start,
                    start=start.time(),
                    duration=duration,
                    slug=slug,
                    title=title,
                    description=description.strip('\n'),
                    language=language,
                    persons=persons,
                    recording_license=rec_license,
                    recording_optout=rec_optout,
                    event_type=b['genre'],
                    download_url='https://content.kulturkosmos.de/'
                )

                schedule.add_room(show['stage'])
                schedule.add_event(day, show['stage'], event)

        return schedule