예제 #1
0
    def _get_director_movies(self):
        if is_empty(self.get_id()):
            return None

        movies               = filter_movies_from_credits(self.get_movie_credits())

        if not is_empty(peek(movies)):
            return movies
        else:
            message = f"Cannot find any movies directed by {self.name}"
            logging.error(message); print(message)
            return None
예제 #2
0
    def _is_name_empty(self):
        if is_empty(self.name):
            message = "Person name cannot be empty"
            logging.error(message)
            print(message)

            return True
예제 #3
0
    def get_person_id(self):

        if not is_empty(self._data):
            return str(self._data[KEYS.ID])
        else:
            message = f"Cannot get Id for {self.name}"
            logging.error(message)
            print(message)
            return None
예제 #4
0
    def list_movies(self):
        if not is_empty(self.movies):
            print(f"List of movies directed by {self.name} \n")

            for movie in self.movies:
                print(movie)
        else:
            message = f"Cannot find any movies directed by {self.name}"
            logging.error(message); print(message)
예제 #5
0
    def parse_response(self):
        if not is_empty(self.data):
            result = json_parser(self.data.content)

            if not result:
                return None
            else:
                return result
        else:
            return None
예제 #6
0
    def parse_response(self):
        if not is_empty(self.data):
            result = json_parser(self.data.content)['results']

            if not result:
                return None
            else:
                return result[0]
        #                     ^
        #              We select the first (best) match out of list of people
        #              matching the search query
        else:
            return None
예제 #7
0
    def _get_person_movie_credits(self):
        if is_empty(self.id):
            return None

        return GetPersonMovieCreditsResponse(
            dao.get_person_movie_credits(self.id)).movie_credits
예제 #8
0
    def _get_person_id(self):
        if is_empty(self.data):
            return None

        return self.data.id