From 797a58a3d583ef6db2b38fd1d4b701ac3465c735 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 7 Apr 2019 13:33:00 +0200 Subject: [PATCH] Rewire plex.playlist.audio --- resources/lib/app/playstate.py | 3 +++ resources/lib/kodimonitor.py | 4 ++-- resources/lib/playstrm.py | 2 +- resources/lib/webservice.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/lib/app/playstate.py b/resources/lib/app/playstate.py index e44b21a1..1e63bece 100644 --- a/resources/lib/app/playstate.py +++ b/resources/lib/app/playstate.py @@ -59,6 +59,9 @@ class PlayState(object): self.resume_playback = None # Don't ask user whether to resume but immediatly resume self.autoplay = False + # Are we using the Kodi audio playlist (=True, e.g. for videos when + # starting from a widget!) or video playlist (=False)? + self.audioplaylist = None # Was the playback initiated by the user using the Kodi context menu? self.context_menu_play = False # Set by context menu - shall we force-transcode the next playing item? diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 827adb71..67b6afca 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -184,9 +184,9 @@ class KodiMonitor(xbmc.Monitor): ''' if data['position'] == 0: if data['playlistid'] == 0: - utils.window('plex.playlist.audio', value='true') + app.PLAYSTATE.audioplaylist = True else: - utils.window('plex.playlist.audio', clear=True) + app.PLAYSTATE.audioplaylist = False self.playlistid = data['playlistid'] if utils.window('plex.playlist.start') and data['position'] == int(utils.window('plex.playlist.start')) + 1: LOG.info('Playlist ready') diff --git a/resources/lib/playstrm.py b/resources/lib/playstrm.py index 7fa81f4e..8c86caa9 100644 --- a/resources/lib/playstrm.py +++ b/resources/lib/playstrm.py @@ -52,7 +52,7 @@ class PlayStrm(object): self.transcode = params.get('transcode') if self.transcode is None: self.transcode = utils.settings('playFromTranscode.bool') if utils.settings('playFromStream.bool') else None - if utils.window('plex.playlist.audio'): + if app.PLAYSTATE.audioplaylist: LOG.debug('Audio playlist detected') self.playqueue = PQ.get_playqueue_from_type(v.KODI_TYPE_AUDIO) else: diff --git a/resources/lib/webservice.py b/resources/lib/webservice.py index dd854438..c345cbf0 100644 --- a/resources/lib/webservice.py +++ b/resources/lib/webservice.py @@ -330,7 +330,7 @@ class QueuePlay(backgroundthread.KillableThread): utils.window('plex.playlist.ready', clear=True) utils.window('plex.playlist.start', clear=True) - utils.window('plex.playlist.audio', clear=True) + app.PLAYSTATE.audioplaylist = None self.server.threads.remove(self) self.server.pending = [] LOG.info('##===---- QueuePlay Stopped ----===##')