Commit 7310f886 authored by echel0n's avatar echel0n

Fixed issue with retrieving images for cache

parent 9763fa5b
......@@ -247,22 +247,16 @@ class ImageCache(object):
# generate the path based on the type & indexer_id
if img_type == self.POSTER:
img_thumb = False
dest_path = self.poster_path(show_obj.indexer_id)
elif img_type == self.BANNER:
img_thumb = False
dest_path = self.banner_path(show_obj.indexer_id)
elif img_type == self.FANART:
img_thumb = False
dest_path = self.fanart_path(show_obj.indexer_id)
elif img_type == self.POSTER_THUMB:
img_thumb = True
dest_path = self.poster_thumb_path(show_obj.indexer_id)
elif img_type == self.BANNER_THUMB:
img_thumb = True
dest_path = self.banner_thumb_path(show_obj.indexer_id)
elif img_type == self.FANART_THUMB:
img_thumb = True
dest_path = self.fanart_thumb_path(show_obj.indexer_id)
else:
sickrage.app.log.error("Invalid cache image type: {}".format(img_type))
......@@ -270,7 +264,7 @@ class ImageCache(object):
# 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], img_thumb, show_obj)
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
......
......@@ -589,7 +589,7 @@ class GenericMetadata(object):
return True
def _retrieve_show_image(self, image_type, image_thumb, show_obj, which=0):
def _retrieve_show_image(self, image_type, show_obj, which=0):
"""
Gets an image URL from theTVDB.com and fanart.tv, downloads it and returns the data.
......@@ -625,10 +625,11 @@ class GenericMetadata(object):
sickrage.app.log.debug("Indexer " + IndexerApi(show_obj.indexer).name + " maybe experiencing some problems. Try again later")
return None
is_image_thumb = '_thumb' in image_type
image_types = {
'{}'.format(image_type): {
'indexer': lambda: t.images(show_obj.indexer_id, key_type=image_type.replace('_thumb', ''))[which][('filename', 'thumbnail')[image_thumb]],
'fanart': lambda: self._retrieve_show_images_from_fanart(show_obj, image_type.replace('_thumb', ''), image_thumb)
'indexer': lambda: t.images(show_obj.indexer_id, key_type=image_type.replace('_thumb', ''))[which][('filename', 'thumbnail')[is_image_thumb]],
'fanart': lambda: self._retrieve_show_images_from_fanart(show_obj, image_type.replace('_thumb', ''), is_image_thumb)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment