示例#1
0
    def _make_show(self, show):
        show_obj = Show()
        show_obj.setName(show['MblDisplayName'])
        for time in show['StartTimes']:
            show_obj.addTime(time)

        self.addShow(show_obj)
示例#2
0
    def _build_show(self, row):
        result = Show()

        if "title" in row:
            result.setName(row["title"])
        else:
            return

        for time_dict in row["schedule"]["entries"]:
            format_string = "YYYY-MM-DDTHH:MM:SS.mmmmmm"
            time_obj = parse(time_dict["start"])
            result.addTime(time_obj)

        self.addShow(result)
示例#3
0
    def _build_show(self, show, names):
        try:
            name = names[show['text']]
        except:
            print unicode(show['text'])
            name = show['text']

        attraction = Show()
        attraction.setName(name)

        showtimes = show['schedule'].replace('/', ' ').split()
        for show in showtimes:
            time_obj = dateutil.parser.parse(show)
            attraction.setTime(time_obj)

        self.addShow(attraction)
示例#4
0
    def _make_show(self, show):
        show_obj = Show()
        show_obj.setName(show['MblDisplayName'])
        for time in show['StartTimes']:
            show_obj.addTime(time)

        self.addShow(show_obj)
示例#5
0
    def _build_attraction(self, name, time):
        attraction = Ride()
        attraction.setName(name)

        if 'CLOSED' in time:
            attraction.setClosed()
        elif 'OPENS' in time or 'OPENING SOON' in time:
            attraction.setClosed()
        else:
            attraction.setOpen()

        if 'LAST SHOW' in time:
            attraction = Show()
            attr_time = time.split()[-2:]
            attr_time = ''.join(attr_time)
            attr_time = datetime.date.today().strftime("%B %d, %Y") + ' ' + attr_time
            attr_time = dateutil.parser.parse(attr_time)
            attraction.addTime(attr_time)
        elif 'AM' in time or 'PM' in time:
            try:
                attraction = Show()
                time2 = time[0:2]
                time_obj = dateutil.parser.parse(time2)
                attraction.setTime(time_obj)
            except:
                attraction = Show()
                time_obj = dateutil.parser.parse(time)
                attraction.setTime(time_obj)

        else:
            waittime = int(time.split()[0])
            attraction.setTime(waittime)

        if isinstance(attraction, Show):
            self.addShow(attraction)
        else:
            self.addRide(attraction)
示例#6
0
    def _build_show(self, row):
        result = Show()

        if 'title' in row:
            result.setName(row['title'])
        else:
            return

        for time_dict in row['schedule']['entries']:
            format_string = 'YYYY-MM-DDTHH:MM:SS.mmmmmm'
            time_obj = parse(time_dict['start'])
            result.addTime(time_obj)

        self.addShow(result)
示例#7
0
    def _build_show(self, show, names):
        try:
            name = names[show['text']]
        except:
            name = show['text']

        attraction = Show()
        attraction.setName(name)

        showtimes = show['schedule'].replace('/', ' ').split()
        for show in showtimes:
            time_obj = dateutil.parser.parse(show)
            attraction.setTime(time_obj)

        self.addShow(attraction)
示例#8
0
    def _build_attr(self, attraction):
        print(attraction.contenttype.text)
        if attraction.contenttype.text == 'USSShow':
            document = Show()
            document.setName(attraction.find('name').text)
            if 'ashx' in attraction.showtime.text:
                return

            showtimes = self.get_showtimes(attraction.showtime.text)
            for show in showtimes:
                try:
                    time_obj = dateutil.parser.parse(show)
                    document.addTime(time_obj)
                except:
                    pass
            self.addShow(document)

        if attraction.contenttype.text == 'Ride':
            document = Ride()
            document.setName(attraction.find('name').text)
            document.setRide()
            if 'Guests' in attraction.queuetime.text:
                document.setTime(0)
            else:
                document.setTime(attraction.queuetime.text)

            if attraction.availability.text == 'True':
                document.setOpen()
            else:
                document.setClosed()

            self.addRide(document)
示例#9
0
 def test_addShow(self):
     park = Park()
     show = Show()
     park.addShow(show)
     self.assertEqual(len(park.shows()), 1)
示例#10
0
 def test_showtimeKey(self):
     show_obj = Show()
     self.assertEqual('showtimes' in show_obj.attributes(), True)
示例#11
0
 def test_addTime(self):
     show_obj = Show()
     show_obj.addTime('12:00 PM')
     self.assertEqual(len(show_obj.getTimes()), 1)