Exemplo n.º 1
0
    def _build_attraction(self, attraction):
        attraction_obj = Ride()

        attraction_obj.setName(attraction['name'])
        self._waitTime(attraction_obj, attraction)

        self.addRide(attraction_obj)
Exemplo n.º 2
0
    def _build_attraction(self, attraction):
        attraction_obj = Ride()

        attraction_obj.setName(attraction['name'])
        self._waitTime(attraction_obj, attraction)

        self.addRide(attraction_obj)
Exemplo n.º 3
0
    def _make_attr(self, array):
        if array[0] not in strings:
            return

        else:
            attr_doc = Ride()
            attr_doc.setName(strings[array[0]])
            if array[3] == 1:
                attr_doc.setOpen()
            else:
                attr_doc.setClosed()

            attr_doc.setTime(array[4])
            self.addRide(attr_doc)
Exemplo n.º 4
0
    def _build_attraction(self, attr, time, names):
        try:
            name = names[attr['text']]
        except:
            name = attr['text']

        attraction = Ride()
        attraction.setName(name)

        if time == 'CLOSED':
            attraction.setClosed()
        else:
            attraction.setOpen()
            attraction.setTime(time)
        
        self.addRide(attraction)
Exemplo n.º 5
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)
Exemplo n.º 6
0
    def _make_attr(self, array):
        if array[0] not in strings:
            return

        else:
            attr_doc = Ride()
            attr_doc.setName(strings[array[0]])
            if array[3] == 1:
                attr_doc.setOpen()
            else:
                attr_doc.setClosed()

            attr_doc.setTime(array[4])
            self.addRide(attr_doc)
Exemplo n.º 7
0
    def _build_attraction(self, attr, time, names):
        try:
            name = names[attr['text']]
        except:
            print unicode(attr['text'])
            name = attr['text']

        attraction = Ride()
        attraction.setName(name)

        if time == 'CLOSED':
            attraction.setClosed()
        else:
            attraction.setOpen()
            attraction.setTime(time)
        
        self.addRide(attraction)
Exemplo n.º 8
0
    def _make_attraction(self, ride):
        attraction = Ride()
        attraction.setName(ride['MblDisplayName'])

        if ride['WaitTime'] is None:
            attraction.setClosed()
        else:
            attraction.setOpen()

        if ride['WaitTime'] == -50:
            attraction.setTime(0)

        elif ride['WaitTime'] < 0:
            attraction.setClosed()

        elif ride['WaitTime'] is not None:
            attraction.setTime(ride['WaitTime'])

        self.addRide(attraction)
Exemplo n.º 9
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)
Exemplo n.º 10
0
 def test_addRide(self):
     park = Park()
     ride = Ride()
     park.addRide(ride)
     self.assertEqual(len(park.rides()), 1)
Exemplo n.º 11
0
 def test_setOpen(self):
     ride = Ride()
     ride.setOpen()
     self.assertEqual(ride['isOpen'], True)
Exemplo n.º 12
0
 def test_setTimeInt(self):
     ride = Ride()
     test_time_str = '10'
     test_time_int = int(test_time_str)
     ride.setTime(test_time_int)
     self.assertEquals(ride['wait'], test_time_int)
Exemplo n.º 13
0
 def test_isOpen(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride.isOpen(), False)
Exemplo n.º 14
0
 def test_setClosed(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride['isOpen'], False)
Exemplo n.º 15
0
 def test_isOpen(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride.isOpen(), False)
Exemplo n.º 16
0
    def _build_ride(self, row):
        # Create dictionary with attraction information
        result = Ride()
        if "label" in row:
            result.setName(row["label"])
        else:
            return

        if row["status"]["isOpen"]:
            result.setOpen()
        else:
            result.setClosed()

        if "waitTime" in row["status"]:
            result.setTime(row["status"]["waitTime"])
        elif result.isOpen():
            result.setTime(0)

        self.addRide(result)
Exemplo n.º 17
0
 def test_setTimeInt(self):
     ride = Ride()
     test_time_str = '10'
     test_time_int = int(test_time_str)
     ride.setTime(test_time_int)
     self.assertEquals(ride['wait'], test_time_int)
Exemplo n.º 18
0
    def _build_ride(self, row):
        # Create dictionary with attraction information
        result = Ride()
        if 'label' in row:
            result.setName(row['label'])
        else:
            return

        if row['status']['isOpen']:
            result.setOpen()
        else:
            result.setClosed()
        
        if 'waitTime' in row['status']:
            result.setTime(row['status']['waitTime'])
        elif result.isOpen():
            result.setTime(0)

        self.addRide(result)
Exemplo n.º 19
0
 def test_setOpen(self):
     ride = Ride()
     ride.setOpen()
     self.assertEqual(ride['isOpen'], True)
Exemplo n.º 20
0
    def _build_attr(self, row, wait_page):
        # Create dictionary with attraction information
        result = Ride()

        result.setName(row['name'])        
        result.setOpen()
        result.setTime(0)

        if 'wait' in wait_page:
            for wait_dict in wait_page['wait']:
                if wait_dict['id'] == row['id']:
                    result.setTime(wait_dict['wait'])

        if 'closed' in wait_page:
            for wait in wait_page['closed']:
                if wait == row['id']:
                    result.setClosed()

        if 'wait' in wait_page and len(wait_page['wait']) == 0:
            result.setClosed()

        self.addRide(result)
Exemplo n.º 21
0
    def _make_attraction(self, ride):
        attraction = Ride()
        attraction.setName(ride['MblDisplayName'])

        if ride['WaitTime'] is None:
            attraction.setClosed()
        else:
            attraction.setOpen()

        if ride['WaitTime'] == -50:
            attraction.setTime(0)

        elif ride['WaitTime'] < 0:
            attraction.setClosed()

        elif ride['WaitTime'] is not None:
            attraction.setTime(ride['WaitTime'])

        self.addRide(attraction)
Exemplo n.º 22
0
 def test_setClosed(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride['isOpen'], False)