Fix TypeError for trailers

You need to resync the Kodi database
This commit is contained in:
croneter 2018-02-06 07:43:22 +01:00
parent 01cbc0d6cb
commit a2c2649bc9
2 changed files with 12 additions and 19 deletions

View file

@ -1729,7 +1729,7 @@ class API():
5: Behind the scenes 5: Behind the scenes
Output: list of dicts with one entry of the form: Output: list of dicts with one entry of the form:
'key': e.g. /library/metadata/xxxx 'ratingKey': e.g. '12345'
'title': 'title':
'thumb': artwork 'thumb': artwork
'duration': 'duration':
@ -1744,27 +1744,20 @@ class API():
for extra in extras: for extra in extras:
try: try:
extraType = int(extra.attrib['extraType']) extraType = int(extra.attrib['extraType'])
except: except (KeyError, TypeError):
extraType = None extraType = None
if extraType != 1: if extraType != 1:
continue continue
key = extra.attrib.get('key', None)
title = extra.attrib.get('title', None)
thumb = extra.attrib.get('thumb', None)
duration = float(extra.attrib.get('duration', 0.0)) duration = float(extra.attrib.get('duration', 0.0))
year = extra.attrib.get('year', None) elements.append({
originallyAvailableAt = extra.attrib.get( 'ratingKey': extra.attrib.get('ratingKey'),
'originallyAvailableAt', None) 'title': extra.attrib.get('title'),
elements.append( 'thumb': extra.attrib.get('thumb'),
{ 'duration': int(duration * v.PLEX_TO_KODI_TIMEFACTOR),
'key': key, 'extraType': extraType,
'title': title, 'originallyAvailableAt': extra.attrib.get('originallyAvailableAt'),
'thumb': thumb, 'year': extra.attrib.get('year')
'duration': int(duration * v.PLEX_TO_KODI_TIMEFACTOR), })
'extraType': extraType,
'originallyAvailableAt': originallyAvailableAt,
'year': year
})
break break
return elements return elements

View file

@ -256,7 +256,7 @@ class Movies(Items):
if extra['extraType'] == 1: if extra['extraType'] == 1:
trailer = ("plugin://plugin.video.plexkodiconnect?" trailer = ("plugin://plugin.video.plexkodiconnect?"
"plex_id=%s&plex_type=%s&mode=play" "plex_id=%s&plex_type=%s&mode=play"
% (extra['key'], v.PLEX_TYPE_CLIP)) % (extra['ratingKey'], v.PLEX_TYPE_CLIP))
break break
# GET THE FILE AND PATH ##### # GET THE FILE AND PATH #####