From c20c701abdbbb6f03c6739f74c7d28eddaaa42c1 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 11 Apr 2016 17:50:56 +0200 Subject: [PATCH] Fix endless trailer loop --- resources/lib/playbackutils.py | 12 +++++------- resources/lib/player.py | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 6ff8d57e..9131a849 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -60,8 +60,8 @@ class PlaybackUtils(): if not playurl: return xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem) - if dbid is None or dbid == '999999999': - # Item is not in Kodi database + if dbid in (None, '999999999'): + # Item is not in Kodi database or is a trailer playmethod = window('emby_%s.playmethod' % playurl) if playmethod == "Transcode": window('emby_%s.playmethod' % playurl, clear=True) @@ -144,10 +144,8 @@ class PlaybackUtils(): if len(item[0][0]) > 1: # Only add to the playlist after intros have played for counter, part in enumerate(item[0][0]): - # Playlist items don't fail on their first call - skip them - # here, otherwise we'll get two 1st parts - if (counter == 0 and - window('emby_customPlaylist') == "true"): + # Never add first part + if counter == 0: continue # Set listitem and properties for each additional parts API.setPartNumber(counter) @@ -213,7 +211,7 @@ class PlaybackUtils(): added """ # Failure when downloading trailer playQueue - if xml is None: + if xml in (None, 401): return False # Failure when getting trailers, e.g. when no plex pass if xml.attrib.get('size') == '1': diff --git a/resources/lib/player.py b/resources/lib/player.py index 4611e764..abfca980 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -454,7 +454,6 @@ class Player(xbmc.Player): window('Plex_currently_playing_itemid', clear=True) window('emby_customPlaylist', clear=True) window('emby_customPlaylist.seektime', clear=True) - window('emby_playbackProps', clear=True) window('emby_customPlaylist.seektime', clear=True) log("Clear playlist properties.", 1)