Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
 def test_isOpen(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride.isOpen(), False)
Ejemplo n.º 12
0
 def test_setClosed(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride['isOpen'], False)
Ejemplo n.º 13
0
 def test_isOpen(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride.isOpen(), False)
Ejemplo n.º 14
0
 def test_setClosed(self):
     ride = Ride()
     ride.setClosed()
     self.assertEqual(ride['isOpen'], False)