def parse_speakers():
    with current_app.app_context():
        with open('open_event/tools/fossasia/speakers.json', 'r+') as f:
            a =  json.load(f)
            for spek in a['speakers']:

                    sp = get_or_create(Speaker,
                                        name=spek['name'],
                                        organisation=spek['organisation'],
                                        email="",
                                        country="",
                                        photo="",
                                        web="",
                                        event_id=event_id,
                                        )
                    # sp.email = spek['email']
                    sp.country = spek['country']
                    sp.photo = spek['photo']
                    sp.web = spek['web']
                    sp.photo = spek['photo']
                    sp.twitter = spek['twitter']
                    sp.linkedin = spek['linkedin']
                    sp.github = spek['github']
                    sp.organisation = spek['organisation']
                    sp.biography = spek['biography']
                    save_to_db(sp, "Speaker")
Example #2
0
    def _save(self, row):
        name = row['name']
        photo = row['photo']
        biography = row['biography']
        email = ""
        web = row['url']
        twitter = None
        facebook = None
        github = None
        linkedin = None
        organisation = row['organization']
        position = None
        country = ""
        event_id = self.event_id
        sessions = None

        with current_app.app_context():
            new_speaker = get_or_create(Speaker,
                          name=name,
                          photo=photo,
                          biography=biography,
                          email=email,
                          web=web,
                          event_id=event_id,
                          twitter=twitter,
                          facebook=facebook,
                          github=github,
                          linkedin=linkedin,
                          organisation=organisation,
                          position=position,
                          country=country)
    def _save(self, row):
        title = row["title"]
        subtitle = None
        description = row["description"]
        try:

            start_time = row["begin"].split('.')[0]
            end_time = row["end"].split('.')[0]
            event_id = self.event_id
            abstract = row["abstract"]
            format = None
            level = None
            speakers = []
            track = None

            with current_app.app_context():
                level = get_or_create(Level, name=row["level"]["id"], label_en=row["level"]["label_en"],
                                      event_id=event_id)
                format = get_or_create(Format, name=row["format"]["id"], label_en=row["format"]["label_en"],
                                       event_id=event_id)
                lang = get_or_create(Language, name=row["lang"]["id"], label_en=row["lang"]["label_en"],
                                     label_de=row["lang"]["label_en"], event_id=event_id)
                for speaker in row['speakers']:
                    speakers.append(Speaker.query.filter_by(name=speaker['name']).first())

                new_session = get_or_create(Session,
                                            title=title,
                                            subtitle=subtitle,
                                            description=description,
                                            start_time=datetime.strptime(start_time, '%Y-%m-%dT%H:%M:%S'),
                                            end_time=datetime.strptime(end_time, '%Y-%m-%dT%H:%M:%S'),
                                            event_id=event_id,
                                            abstract=abstract,
                                            level=level,
                                            format=format,
                                            language=lang)
                new_session.speakers = speakers
                new_session.track = Track.query.filter_by(name=row['track']['label_en']).first()
                save_to_db(new_session, "Session Updated")
        except Exception as e:
            print e
Example #4
0
    def _save(self, row):
        name = row['label_en']
        description = ""
        track_image_url = None
        event_id = self.event_id

        with current_app.app_context():
            track = get_or_create(Track,
                                  name=name,
                                  description=description,
                                  event_id=event_id,
                                  track_image_url=track_image_url)
    def _save(self):
        speakers = []

        try:
            session_date, session_time, name, fam_name, company, email, web, mobile_phone, github, bitbucket, twitter, linkedin, country, city, photo, type, topic, __, abstract, bio = self._get_values()

            if name == "" and fam_name == "" and company == "" and email == "":
                return

            with current_app.app_context():

                sp = get_or_create(Speaker,
                                    name=name + ' ' + fam_name,
                                    email=email,
                                    photo=photo,
                                    web=web,
                                    event_id=self.event_id,
                                    twitter=twitter,
                                    github=github,
                                    linkedin=linkedin,
                                    organisation=company,
                                    country=country)

                speakers.append(sp)

                new_session = get_or_create(Session,
                                            title=topic,
                                            event_id=self.event_id,
                                            is_accepted=True,
                                            description = bio,
                                            start_time = datetime.strptime(self.date, "%Y %A %B %d %H:%M"),
                                            end_time = datetime.strptime(self.end_time, "%Y %A %B %d %H:%M"),
                                            abstract = abstract)


                new_session.speakers = speakers
                new_session.track = get_or_create(Track, name=self.track_name, description="", event_id=self.event_id, track_image_url="")
                save_to_db(new_session, "Session Updated")
        except Exception as e:
            logging.error('Error during session updation %s' % e)
Example #6
0
    def _save(self, row):
        title = row['title']
        url = row['url']
        date = row['date']
        locations = row['locations'][0]

        with current_app.app_context():
            owner = User.query.filter_by(login=self.owner_login).first()
            event = get_or_create(Event,
                          name=title,
                          url=url,
                          start_time=datetime.strptime(date[0], '%Y-%m-%d'),
                          end_time=datetime.strptime(date[1], '%Y-%m-%d'),
                          latitude=locations['coords'][0],
                          longitude=locations['coords'][1],
                          location_name=locations["label"],
                          )
            self.event_id = event.id
    event_id = sys.argv[1]
    # sessions_json = sys.argv[2]
    sessions = get_sessions()

    try:
        for session_json in sessions:
            with current_app.app_context():
                speakers = []

                for spk in session_json['speakers']:

                    sp = get_or_create(Speaker,
                                        name=spk['name'],
                                        organisation=spk['organisation'],
                                        email="",
                                        country="",
                                        photo="",
                                        web="",
                                        event_id=event_id,
                                        )
                    save_to_db(sp, "Speaker")
                    speakers.append(sp)

                new_session = get_or_create(Session,
                                        title=session_json['title'],
                                        event_id=event_id,
                                        is_accepted=True,
                                        description=session_json['description'],
                                        start_time=parse(session_json['start_time']),
                                        end_time=parse(session_json['end_time']))
                new_session.speakers = speakers