Example #1
0
 def _make_false_event(self):
     event = BaseCalendarEvent('0')
     event.start_date = event.end_date = datetime.utcfromtimestamp(0)
     event.summary = u'NON EXISTING EVENT'
     event.status = STATUS.CANCELLED
     event.category = CATEGORIES.CONCERT
     event.transp = TRANSP.OPAQUE
     return event
Example #2
0
 def _make_false_event(self):
     event = BaseCalendarEvent('0')
     event.start_date = event.end_date = datetime.utcfromtimestamp(0)
     event.summary = u'NON EXISTING EVENT'
     event.status = STATUS.CANCELLED
     event.category = CATEGORIES.CONCERT
     event.transp = TRANSP.OPAQUE
     return event
Example #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
                        event.timezone = u'Europe/Paris'
                        yield event
Example #4
0
 def _make_event(self, d):
     event = BaseCalendarEvent(d['id'])
     event.city = u'Paris'
     event.url = d['url']
     event.start_date = d['datetime']
     event.end_date = datetime.combine(d['datetime'].date(), time.max)
     event.summary = d['summary']
     event.category = CATEGORIES.CONCERT
     event.description = d['description']
     event.status = STATUS.CONFIRMED
     event.transp = TRANSP.OPAQUE
     if 'price' in d:
         event.price = d['price']
     if 'address' in d:
         event.location = d['address']
     return event
Example #5
0
 def _make_event(self, d):
     event = BaseCalendarEvent(d['id'])
     event.city = u'Paris'
     event.url = d['url']
     event.start_date = d['datetime']
     event.end_date = datetime.combine(d['datetime'].date(), time.max)
     event.summary = d['summary']
     event.category = CATEGORIES.CONCERT
     event.description = d['description']
     event.status = STATUS.CONFIRMED
     event.transp = TRANSP.OPAQUE
     if 'price' in d:
         event.price = d['price']
     if 'address' in d:
         event.location = d['address']
     return event
Example #6
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
Example #7
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