From e0f1225c21513658aaa0087399d21c6e258d9666 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sat, 6 Jan 2018 12:55:24 +0100 Subject: [PATCH] Move plex_playbackProbs to state.py --- resources/lib/playbackutils.py | 15 +++++++-------- resources/lib/player.py | 2 +- service.py | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index d140feef..03afcb8c 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -113,8 +113,8 @@ class PlaybackUtils(): # We need to ensure we add the intro and additional parts only once. # Otherwise we get a loop. - if not v.PLAYBACK_SETUP_DONE: - v.PLAYBACK_SETUP_DONE = True + if not state.PLAYBACK_SETUP_DONE: + state.PLAYBACK_SETUP_DONE = True LOG.info("Setting up properties in playlist.") # Where will the player need to start? # Do we need to get trailers? @@ -139,7 +139,6 @@ class PlaybackUtils(): get_playlist_details_from_xml(playqueue, xml=xml) except KeyError: return - playqueue.items.append(playlist_item_from_xml(playqueue, xml[0])) if (not homeScreen and not seektime and sizePlaylist < 2 and window('plex_customplaylist') != "true" and @@ -199,7 +198,7 @@ class PlaybackUtils(): api.set_listitem_artwork(listitem) add_listitem_to_Kodi_playlist( playqueue, - self.currentPosition+1, + self.currentPosition, convert_PKC_to_listitem(listitem), file=playurl, kodi_item={'id': kodi_id, 'type': kodi_type}) @@ -207,7 +206,7 @@ class PlaybackUtils(): # Full metadata$ add_item_to_kodi_playlist( playqueue, - self.currentPosition+1, + self.currentPosition, kodi_id, kodi_type) self.currentPosition += 1 @@ -231,9 +230,9 @@ class PlaybackUtils(): return result # We just skipped adding properties. Reset flag for next time. - elif v.PLAYBACK_SETUP_DONE: + elif state.PLAYBACK_SETUP_DONE: LOG.debug("Resetting properties playback flag.") - v.PLAYBACK_SETUP_DONE = False + state.PLAYBACK_SETUP_DONE = False # SETUP MAIN ITEM ########## # For transcoding only, ask for audio/subs pref @@ -276,7 +275,7 @@ class PlaybackUtils(): Play all items contained in the xml passed in. Called by Plex Companion """ LOG.info("Playbackutils play_all called") - v.PLAYBACK_SETUP_DONE = True + state.PLAYBACK_SETUP_DONE = True self.currentPosition = 0 for item in self.xml: api = API(item) diff --git a/resources/lib/player.py b/resources/lib/player.py index 1df9bf24..1e13d431 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -268,7 +268,7 @@ class PKC_Player(Player): # We might have saved a transient token from a user flinging media via # Companion (if we could not use the playqueue to store the token) state.PLEX_TRANSIENT_TOKEN = None - v.PLAYBACK_SETUP_DONE = False + state.PLAYBACK_SETUP_DONE = False LOG.debug("Cleared playlist properties.") def onPlayBackEnded(self): diff --git a/service.py b/service.py index 8f7e6a38..06dd1ab9 100644 --- a/service.py +++ b/service.py @@ -108,7 +108,7 @@ class Service(): "plex_online", "plex_serverStatus", "plex_onWake", "plex_kodiScan", "plex_shouldStop", "plex_dbScan", - "plex_initialScan", "plex_customplayqueue", + "plex_initialScan", "plex_customplayqueue", "plex_playbackProps", "pms_token", "plex_token", "pms_server", "plex_machineIdentifier", "plex_servername", "plex_authenticated", "PlexUserImage", "useDirectPaths",