Ejemplo n.º 1
0
    def create_event(self, data):
        sequence = 1
        transp = TRANSP.TRANSPARENT
        status = STATUS.CONFIRMED
        category = CATEGORIES.CINE

        if 'theaterShowtimes' not in data['feed']:
            return

        for items in data['feed']['theaterShowtimes']:
            cinema = items['place']['theater']
            city = unicode(cinema['city'])
            location = u'%s, %s' % (cinema['name'], cinema['address'])
            postalCode = cinema['postalCode']
            cinemaCode = cinema['code']
            for show in items['movieShowtimes']:
                summary = unicode(show['onShow']['movie']['title'])
                movieCode = show['onShow']['movie']['code']
                for jour in show['scr']:
                    tdate = jour['d'].split('-')
                    year = int(tdate[0])
                    month = int(tdate[1])
                    day = int(tdate[2])
                    for seance in jour['t']:
                        ttime = seance['$'].split(':')
                        heure = int(ttime[0])
                        minute = int(ttime[1])
                        start_date = datetime(year=year,
                                              month=month,
                                              day=day,
                                              hour=heure,
                                              minute=minute)

                        seanceCode = seance['code']
                        _id = u'%s#%s#%s#%s' % (cinemaCode, postalCode,
                                                movieCode, seanceCode)
                        event = BaseCalendarEvent()
                        event.id = _id
                        event.sequence = sequence
                        event.transp = transp
                        event.status = status
                        event.category = category
                        event.city = city
                        event.location = location
                        event.start_date = start_date
                        event.summary = summary
                        event.timezone = u'Europe/Paris'
                        yield event
Ejemplo n.º 2
0
    def create_event(self, data):
        sequence = 1
        transp = TRANSP.TRANSPARENT
        status = STATUS.CONFIRMED
        category = CATEGORIES.CINE

        if 'theaterShowtimes' not in data['feed']:
            return

        for items in data['feed']['theaterShowtimes']:
            cinema = items['place']['theater']
            city = unicode(cinema['city'])
            location = u'%s, %s' % (cinema['name'], cinema['address'])
            postalCode = cinema['postalCode']
            cinemaCode = cinema['code']
            for show in items['movieShowtimes']:
                summary = unicode(show['onShow']['movie']['title'])
                movieCode = show['onShow']['movie']['code']
                for jour in show['scr']:
                    tdate = jour['d'].split('-')
                    year = int(tdate[0])
                    month = int(tdate[1])
                    day = int(tdate[2])
                    for seance in jour['t']:
                        ttime = seance['$'].split(':')
                        heure = int(ttime[0])
                        minute = int(ttime[1])
                        start_date = datetime(year=year, month=month, day=day,
                                              hour=heure, minute=minute)

                        seanceCode = seance['code']
                        _id = u'%s#%s#%s#%s' % (cinemaCode, postalCode, movieCode, seanceCode)
                        event = BaseCalendarEvent()
                        event.id = _id
                        event.sequence = sequence
                        event.transp = transp
                        event.status = status
                        event.category = category
                        event.city = city
                        event.location = location
                        event.start_date = start_date
                        event.summary = summary
                        event.timezone = u'Europe/Paris'
                        yield event
Ejemplo n.º 3
0
    def create_event(self, data):
        sequence = 1
        transp = TRANSP.TRANSPARENT
        status = STATUS.CONFIRMED
        category = CATEGORIES.CINE

        if "theaterShowtimes" not in data["feed"]:
            return

        for items in data["feed"]["theaterShowtimes"]:
            cinema = items["place"]["theater"]
            city = unicode(cinema["city"])
            location = u"%s, %s" % (cinema["name"], cinema["address"])
            postalCode = cinema["postalCode"]
            cinemaCode = cinema["code"]
            for show in items["movieShowtimes"]:
                summary = unicode(show["onShow"]["movie"]["title"])
                movieCode = show["onShow"]["movie"]["code"]
                for jour in show["scr"]:
                    tdate = jour["d"].split("-")
                    year = int(tdate[0])
                    month = int(tdate[1])
                    day = int(tdate[2])
                    for seance in jour["t"]:
                        ttime = seance["$"].split(":")
                        heure = int(ttime[0])
                        minute = int(ttime[1])
                        start_date = datetime(year=year, month=month, day=day, hour=heure, minute=minute)

                        seanceCode = seance["code"]
                        _id = u"%s#%s#%s#%s" % (cinemaCode, postalCode, movieCode, seanceCode)
                        event = BaseCalendarEvent()
                        event.id = _id
                        event.sequence = sequence
                        event.transp = transp
                        event.status = status
                        event.category = category
                        event.city = city
                        event.location = location
                        event.start_date = start_date
                        event.summary = summary
                        yield event