From d8de492d97eeab33035c4c4c0c05b9abd02cc853 Mon Sep 17 00:00:00 2001 From: croneter Date: Tue, 6 Feb 2018 20:12:44 +0100 Subject: [PATCH] Fix trailers not playing --- resources/lib/playback.py | 27 ++++++++++++++------------- resources/lib/playlist_func.py | 5 ++++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index e10f578c..1dfcafc2 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -139,20 +139,21 @@ def playback_init(plex_id, plex_type, playqueue): else: trailers = True 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() - 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) # Sleep a bit to let setResolvedUrl do its thing - bit ugly sleep(200) diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index 4c42fa4a..0bb0c984 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -284,7 +284,10 @@ def playlist_item_from_xml(playlist, xml_video_element, kodi_id=None, api = API(xml_video_element) item.plex_id = api.getRatingKey() 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') if item.guid is not None: item.guid = escape_html(item.guid)