Skip to content

Commit

Permalink
Bring back code to use season images for TVDB API (#7460)
Browse files Browse the repository at this point in the history
* Bring back code to use season images for TVDB API

* Optimize code
  • Loading branch information
medariox authored Dec 8, 2019
1 parent a8a265c commit d1befd3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions medusa/indexers/tvdbv2/tvdbv2_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d1befd3

Please sign in to comment.