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.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
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.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