Exemplo n.º 1
0
    def _cache_image_from_indexer(self, show_obj, img_type, force=False):
        """
        Retrieves an image of the type specified from indexer and saves it to the cache folder

        :param show_obj: TVShow object that we want to cache an image for
        :param img_type: BANNER or POSTER or FANART
        :return: bool representing success
        """

        # generate the path based on the type & indexer_id
        if img_type == self.POSTER:
            dest_path = self.poster_path(show_obj.indexer_id)
        elif img_type == self.BANNER:
            dest_path = self.banner_path(show_obj.indexer_id)
        elif img_type == self.FANART:
            dest_path = self.fanart_path(show_obj.indexer_id)
        elif img_type == self.POSTER_THUMB:
            dest_path = self.poster_thumb_path(show_obj.indexer_id)
        elif img_type == self.BANNER_THUMB:
            dest_path = self.banner_thumb_path(show_obj.indexer_id)
        elif img_type == self.FANART_THUMB:
            dest_path = self.fanart_thumb_path(show_obj.indexer_id)
        else:
            sickrage.app.log.error("Invalid cache image type: {}".format(img_type))
            return False

        # retrieve the image from indexer using the generic metadata class
        metadata_generator = GenericMetadata()
        img_data = metadata_generator._retrieve_show_image(self.IMAGE_TYPES[img_type], show_obj)
        result = metadata_generator._write_image(img_data, dest_path, force)

        return result
Exemplo n.º 2
0
    def _cache_image_from_indexer(self, show_obj, img_type):
        """
        Retrieves an image of the type specified from indexer and saves it to the cache folder

        :param show_obj: TVShow object that we want to cache an image for
        :param img_type: BANNER or POSTER or FANART
        :return: bool representing success
        """

        # generate the path based on the type & indexer_id
        if img_type == self.POSTER:
            img_type_name = 'poster'
            dest_path = self.poster_path(show_obj.indexerid)
        elif img_type == self.BANNER:
            img_type_name = 'banner'
            dest_path = self.banner_path(show_obj.indexerid)
        elif img_type == self.POSTER_THUMB:
            img_type_name = 'poster_thumb'
            dest_path = self.poster_thumb_path(show_obj.indexerid)
        elif img_type == self.BANNER_THUMB:
            img_type_name = 'banner_thumb'
            dest_path = self.banner_thumb_path(show_obj.indexerid)
        elif img_type == self.FANART:
            img_type_name = 'fanart'
            dest_path = self.fanart_path(show_obj.indexerid)
        else:
            sickrage.srCore.srLogger.error("Invalid cache image type: " + str(img_type))
            return False

        # retrieve the image from indexer using the generic metadata class
        metadata_generator = GenericMetadata()
        img_data = metadata_generator._retrieve_show_image(img_type_name, show_obj)
        result = metadata_generator._write_image(img_data, dest_path)

        return result
Exemplo n.º 3
0
    def _cache_image_from_indexer(self, show_obj, img_type):
        """
        Retrieves an image of the type specified from indexer and saves it to the cache folder

        :param show_obj: TVShow object that we want to cache an image for
        :param img_type: BANNER or POSTER or FANART
        :return: bool representing success
        """

        # generate the path based on the type & indexer_id
        if img_type == self.POSTER:
            img_type_name = 'poster'
            dest_path = self.poster_path(show_obj.indexerid)
        elif img_type == self.BANNER:
            img_type_name = 'banner'
            dest_path = self.banner_path(show_obj.indexerid)
        elif img_type == self.POSTER_THUMB:
            img_type_name = 'poster_thumb'
            dest_path = self.poster_thumb_path(show_obj.indexerid)
        elif img_type == self.BANNER_THUMB:
            img_type_name = 'banner_thumb'
            dest_path = self.banner_thumb_path(show_obj.indexerid)
        elif img_type == self.FANART:
            img_type_name = 'fanart'
            dest_path = self.fanart_path(show_obj.indexerid)
        else:
            sickrage.srCore.srLogger.error("Invalid cache image type: " + str(img_type))
            return False

        # retrieve the image from indexer using the generic metadata class
        metadata_generator = GenericMetadata()
        img_data = metadata_generator._retrieve_show_image(img_type_name, show_obj)
        result = metadata_generator._write_image(img_data, dest_path)

        return result