Exemplo n.º 1
0
    def get_series_images_count(self, id, language='en'):
        """Get the images count (for all image_type values) of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :return: the series images counts object
        :rtype: tvdb_api.models.series_images_counts.SeriesImagesCounts
        """
        return SeriesApi(self.api_client).series_id_images_get(id, accept_language=language)
Exemplo n.º 2
0
    def get_series(self, id, language='en'):
        """Get the details of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :param language: the desired language in which to return the result
        :type language: str
        :return: the series data object
        :rtype: tvdb_api.models.series_data.SeriesData
        """
        return SeriesApi(self.api_client).series_id_get(id, accept_language=language)
Exemplo n.º 3
0
    def get_series_episodes(self, id, page=1):
        """Get all the episodes of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :param page: the page of the results to fetch (100 results per page)
        :type page: str
        :return: the series episodes object
        :rtype: tvdb_api.models.series_episodes.SeriesEpisodes
        """
        return SeriesApi(self.api_client).series_id_episodes_get(id, page=page)
Exemplo n.º 4
0
    def get_series_episodes_summary(self, id):
        """Get the summary of the episodes and seasons of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :return: the series episodes summary object
        :rtype: tvdb_api.models.series_episodes_summary.SeriesEpisodesSummary
        """
        # Manual parsing because the generated object is not in sync with the object model!
        params = {'id': id, '_preload_content': False}
        return parser.parse_series_episodes_summary(SeriesApi(self.api_client).series_id_episodes_summary_get(**params))
Exemplo n.º 5
0
    def get_series_images(self, id, image_type='poster', language='en'):
        """Get all the images (of the specified image type) of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :param image_type: the image type (possible types are: 'fanart', 'poster', 'season', 'seasonwide', 'series')
        :type image_type: str
        :param language: the desired language in which to return the result
        :type language: str
        :return: the series image query results object
        :rtype: tvdb_api.models.series_image_query_results.SeriesImageQueryResults
        """
        return SeriesApi(self.api_client).series_id_images_query_get(id, key_type=image_type, accept_language=language)
Exemplo n.º 6
0
    def get_series_episode_by_absolute_number(self, id, absolute_number, language='en'):
        """Get a single episode of a series by it's absolute number.

        :param id: the id of the series on tvdb
        :type id: int
        :param absolute_number: the absolute number
        :type absolute_number: str
        :param language: the desired language in which to return the result
        :type language: str
        :return: the series episodes query object
        :rtype: tvdb_api.models.series_episodes_query.SeriesEpisodesQuery
        """
        return SeriesApi(self.api_client).series_id_episodes_query_get(id, absolute_number=absolute_number,
                                                                       accept_language=language)
Exemplo n.º 7
0
    def get_series_episodes_by_season(self, id, season, language='en'):
        """Get all the episodes belonging to a season of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :param season: the season number
        :type season: str
        :param language: the desired language in which to return the result
        :type language: str
        :return: the series episodes object
        :rtype: tvdb_api.models.series_episodes_query.SeriesEpisodesQuery
        """
        return SeriesApi(self.api_client).series_id_episodes_query_get(id, aired_season=season,
                                                                       accept_language=language)
Exemplo n.º 8
0
    def get_series_highest_rated_image(self, id, image_type='poster', language='en'):
        """Get the highest rated image (of the specified image type) of a series.

        :param id: the id of the series on tvdb
        :type id: int
        :param image_type: the image type (possible types are: 'fanart', 'poster', 'season', 'seasonwide', 'series')
        :type image_type: str
        :param language: the desired language in which to return the result
        :type language: str
        :return: the series image query results object
        :rtype: tvdb_api.models.series_image_query_result.SeriesImageQueryResult
        """
        highest_rated_image = None
        images = SeriesApi(self.api_client).series_id_images_query_get(id, key_type=image_type,
                                                                       accept_language=language)
        if images.data:
            # Sort by multiplying the rating average with the number of ratings
            images_sorted = sorted(images.data, key=lambda x: x.ratings_info.average * x.ratings_info.count,
                                   reverse=True)
            highest_rated_image = images_sorted[0] if len(images_sorted) > 0 else None
        return highest_rated_image