parent
0bb4a26c33
commit
50860573fa
2 changed files with 16 additions and 6 deletions
|
@ -1709,11 +1709,13 @@ class API():
|
||||||
|
|
||||||
def getExtras(self):
|
def getExtras(self):
|
||||||
"""
|
"""
|
||||||
|
Currently ONLY returns the very first trailer found!
|
||||||
|
|
||||||
Returns a list of trailer and extras from PMS XML. Returns [] if
|
Returns a list of trailer and extras from PMS XML. Returns [] if
|
||||||
no extras are found.
|
no extras are found.
|
||||||
Extratypes:
|
Extratypes:
|
||||||
'1': Trailer
|
1: Trailer
|
||||||
'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
|
'key': e.g. /library/metadata/xxxx
|
||||||
|
@ -1725,14 +1727,21 @@ class API():
|
||||||
'year':
|
'year':
|
||||||
"""
|
"""
|
||||||
elements = []
|
elements = []
|
||||||
for extra in self.item.findall('Extras'):
|
extras = self.item.find('Extras')
|
||||||
# Trailer:
|
if extras is None:
|
||||||
|
return elements
|
||||||
|
for extra in extras:
|
||||||
|
try:
|
||||||
|
extraType = int(extra.attrib['extraType'])
|
||||||
|
except:
|
||||||
|
extraType = None
|
||||||
|
if extraType != 1:
|
||||||
|
continue
|
||||||
key = extra.attrib.get('key', None)
|
key = extra.attrib.get('key', None)
|
||||||
title = extra.attrib.get('title', None)
|
title = extra.attrib.get('title', None)
|
||||||
thumb = extra.attrib.get('thumb', 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)
|
year = extra.attrib.get('year', None)
|
||||||
extraType = extra.attrib.get('extraType', None)
|
|
||||||
originallyAvailableAt = extra.attrib.get(
|
originallyAvailableAt = extra.attrib.get(
|
||||||
'originallyAvailableAt', None)
|
'originallyAvailableAt', None)
|
||||||
elements.append(
|
elements.append(
|
||||||
|
@ -1745,6 +1754,7 @@ class API():
|
||||||
'originallyAvailableAt': originallyAvailableAt,
|
'originallyAvailableAt': originallyAvailableAt,
|
||||||
'year': year
|
'year': year
|
||||||
})
|
})
|
||||||
|
break
|
||||||
return elements
|
return elements
|
||||||
|
|
||||||
def getMediaStreams(self):
|
def getMediaStreams(self):
|
||||||
|
|
|
@ -383,7 +383,7 @@ class Movies(Items):
|
||||||
extras = API.getExtras()
|
extras = API.getExtras()
|
||||||
for extra in extras:
|
for extra in extras:
|
||||||
# Only get 1st trailer element
|
# Only get 1st trailer element
|
||||||
if extra['extraType'] == '1':
|
if extra['extraType'] == 1:
|
||||||
trailer = ("plugin://plugin.video.plexkodiconnect/trailer/?"
|
trailer = ("plugin://plugin.video.plexkodiconnect/trailer/?"
|
||||||
"id=%s&mode=play") % extra['key']
|
"id=%s&mode=play") % extra['key']
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue