From d1befd33e89cc46d122f84282852393754ef2ce6 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 8 Dec 2019 17:51:41 +0100 Subject: [PATCH] Bring back code to use season images for TVDB API (#7460) * Bring back code to use season images for TVDB API * Optimize code --- medusa/indexers/tvdbv2/tvdbv2_api.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/medusa/indexers/tvdbv2/tvdbv2_api.py b/medusa/indexers/tvdbv2/tvdbv2_api.py index 50cc84afba..c0f4077fa9 100644 --- a/medusa/indexers/tvdbv2/tvdbv2_api.py +++ b/medusa/indexers/tvdbv2/tvdbv2_api.py @@ -481,9 +481,18 @@ def _parse_images(self, sid): image_attributes = self._object_to_dict(image, key_mapping) bid = image_attributes.pop('id') - if bid not in _images[image_type][resolution]: - _images[image_type][resolution][bid] = {} - base_path = _images[image_type][resolution][bid] + + if image_type in ['season', 'seasonwide']: + sub_key = int(image.sub_key) + if sub_key not in _images[image_type][resolution]: + _images[image_type][resolution][sub_key] = {} + if bid not in _images[image_type][resolution][sub_key]: + _images[image_type][resolution][sub_key][bid] = {} + base_path = _images[image_type][resolution][sub_key][bid] + else: + if bid not in _images[image_type][resolution]: + _images[image_type][resolution][bid] = {} + base_path = _images[image_type][resolution][bid] for k, v in viewitems(image_attributes): if k is None or v is None: