Fix trailers not playing

This commit is contained in:
croneter 2018-02-06 20:12:44 +01:00
parent a2c2649bc9
commit d8de492d97
2 changed files with 18 additions and 14 deletions

View file

@ -139,20 +139,21 @@ def playback_init(plex_id, plex_type, playqueue):
else: else:
trailers = True trailers = True
LOG.info('Playing trailers: %s', trailers) LOG.info('Playing trailers: %s', trailers)
# Post to the PMS to create a playqueue - in any case due to Plex Companion
xml = init_plex_playqueue(plex_id,
xml.attrib.get('librarySectionUUID'),
mediatype=plex_type,
trailers=trailers)
if xml is None:
LOG.error('Could not get a playqueue xml for plex id %s, UUID %s',
plex_id, xml.attrib.get('librarySectionUUID'))
# "Play error"
dialog('notification', lang(29999), lang(30128), icon='{error}')
return
# Should already be empty, but just in case
playqueue.clear() playqueue.clear()
PL.get_playlist_details_from_xml(playqueue, xml) if plex_type != v.PLEX_TYPE_CLIP:
# Post to the PMS to create a playqueue - in any case due to Companion
xml = init_plex_playqueue(plex_id,
xml.attrib.get('librarySectionUUID'),
mediatype=plex_type,
trailers=trailers)
if xml is None:
LOG.error('Could not get a playqueue xml for plex id %s, UUID %s',
plex_id, xml.attrib.get('librarySectionUUID'))
# "Play error"
dialog('notification', lang(29999), lang(30128), icon='{error}')
return
# Should already be empty, but just in case
PL.get_playlist_details_from_xml(playqueue, xml)
stack = _prep_playlist_stack(xml) stack = _prep_playlist_stack(xml)
# Sleep a bit to let setResolvedUrl do its thing - bit ugly # Sleep a bit to let setResolvedUrl do its thing - bit ugly
sleep(200) sleep(200)

View file

@ -284,7 +284,10 @@ def playlist_item_from_xml(playlist, xml_video_element, kodi_id=None,
api = API(xml_video_element) api = API(xml_video_element)
item.plex_id = api.getRatingKey() item.plex_id = api.getRatingKey()
item.plex_type = api.getType() item.plex_type = api.getType()
item.id = xml_video_element.attrib['%sItemID' % playlist.kind] try:
item.id = xml_video_element.attrib['%sItemID' % playlist.kind]
except KeyError:
pass
item.guid = xml_video_element.attrib.get('guid') item.guid = xml_video_element.attrib.get('guid')
if item.guid is not None: if item.guid is not None:
item.guid = escape_html(item.guid) item.guid = escape_html(item.guid)