Skip to content

Commit

Permalink
fix: multiseason art for tv shows
Browse files Browse the repository at this point in the history
  • Loading branch information
Varstahl committed Nov 6, 2019
1 parent 66fcb48 commit 76284aa
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions plugin.video.amazon-test/resources/lib/primevideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,11 @@ def Browse(self, path, forceSort=None):
folderType = 0 if 'root' == path else 1
for key in [k for k in node if k not in ['ref', 'verb', 'title', 'metadata', 'parent', 'siblings', 'children']]:
url = self._g.pluginid
entry = (node if key not in self._videodata else self._videodata)[key]
if key in self._videodata:
from copy import deepcopy
entry = deepcopy(self._videodata[key])
else:
entry = node[key]
title = entry['title'] if 'title' in entry else nodeName
itemPathURI = '{}{}{}'.format(path, self._separator, quote_plus(key.encode('utf-8')))

Expand Down Expand Up @@ -478,24 +482,24 @@ def Browse(self, path, forceSort=None):
# Log('Encoded PrimeVideo refresh URL: pv/refresh/{}'.format(itemPathURI), Log.DEBUG)
item.addContextMenuItems([('Refresh', 'RunPlugin({}pv/refresh/{})'.format(self._g.pluginid, itemPathURI))])

folder = True
"""
# In case of series find the oldest series and apply its art, also update metadata in case of squashed series
if ('metadata' not in entry) and ('children' in entry) and (0 < len(entry['children'])):
if 1 == len(entry['children']):
entry['metadata'] = {'artmeta': self._videodata[entry['children'][0]]['metadata']['artmeta'],
'videometa': self._videodata[entry['children'][0]]['metadata']['videometa']}
else:
sn = 90001
# In case of tv shows find the oldest season and apply its art
try:
if ('tvshow' == entry['metadata']['videometa']['mediatype']) and (1 < len(entry['children'])):
sn = None
snid = None
for child in entry['children']:
if ('season' in self._videodata[child]['metadata']['videometa']) and (sn > self._videodata[child]['metadata']['videometa']['season']):
sn = self._videodata[child]['metadata']['videometa']['season']
snid = child
if None is not snid:
entry['metadata'] = {'artmeta': self._videodata[snid]['metadata']['artmeta'], 'videometa': {'mediatype': 'tvshow'}}
"""
try:
childsn = self._videodata[child]['metadata']['videometa']['season']
if (None is sn) or (sn > childsn):
sn = childsn
snid = child
except: pass
if snid:
entry['metadata']['artmeta'] = self._videodata[snid]['metadata']['artmeta']
entry['metadata']['videometa']['plot'] = getString(30253).format(len(entry['children'])) # "# series" as plot/description
except: pass

folder = True
if 'metadata' in entry:
m = entry['metadata']
if 'artmeta' in m:
Expand Down

0 comments on commit 76284aa

Please sign in to comment.