From 2f1b104b41d68aeeb2ec76be00cd1ce54ffc3868 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 6 Nov 2016 14:45:37 +0100 Subject: [PATCH] Fix playlist being cleared when it shouldn't --- resources/lib/playbackutils.py | 9 +++++++-- resources/lib/playlist.py | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 8fed0d56..86426e41 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -91,15 +91,20 @@ class PlaybackUtils(): homeScreen = (xbmc.getCondVisibility('Window.IsActive(home)') or contextmenu_play) kodiPl = self.pl.playlist - # Can return -1 - startPos = max(kodiPl.getposition(), 0) sizePlaylist = kodiPl.size() + if contextmenu_play: + # Need to start with the items we're inserting here + startPos = sizePlaylist + else: + # Can return -1 + startPos = max(kodiPl.getposition(), 0) self.currentPosition = startPos propertiesPlayback = window('plex_playbackProps') == "true" introsPlaylist = False dummyPlaylist = False + log.info("Playing from contextmenu: %s" % contextmenu_play) log.info("Playlist start position: %s" % startPos) log.info("Playlist plugin position: %s" % self.currentPosition) log.info("Playlist size: %s" % sizePlaylist) diff --git a/resources/lib/playlist.py b/resources/lib/playlist.py index 5406562e..f6886a9c 100644 --- a/resources/lib/playlist.py +++ b/resources/lib/playlist.py @@ -82,7 +82,6 @@ class Playlist(): log.info('Empty playlist initiated') if self.playlist is not None: self.playlistId = self.playlist.getPlayListId() - self.playlist.clear() @lockMethod.decorate def getQueueIdFromPosition(self, playlistPosition):