Move propertiesPlayback from window to state.py

This commit is contained in:
tomkat83 2018-01-03 17:50:01 +01:00
parent ec4a5d2b7c
commit 546e79d925
4 changed files with 11 additions and 8 deletions

View file

@ -97,7 +97,6 @@ class PlaybackUtils():
startPos = max(playqueue.kodi_pl.getposition(), 0)
self.currentPosition = startPos
propertiesPlayback = window('plex_playbackProps') == "true"
introsPlaylist = False
dummyPlaylist = False
@ -114,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 propertiesPlayback:
window('plex_playbackProps', value="true")
if not v.PLAYBACK_SETUP_DONE:
v.PLAYBACK_SETUP_DONE = True
LOG.info("Setting up properties in playlist.")
# Where will the player need to start?
# Do we need to get trailers?
@ -232,9 +231,9 @@ class PlaybackUtils():
return result
# We just skipped adding properties. Reset flag for next time.
elif propertiesPlayback:
elif v.PLAYBACK_SETUP_DONE:
LOG.debug("Resetting properties playback flag.")
window('plex_playbackProps', clear=True)
v.PLAYBACK_SETUP_DONE = False
# SETUP MAIN ITEM ##########
# For transcoding only, ask for audio/subs pref
@ -277,7 +276,7 @@ class PlaybackUtils():
Play all items contained in the xml passed in. Called by Plex Companion
"""
LOG.info("Playbackutils play_all called")
window('plex_playbackProps', value="true")
v.PLAYBACK_SETUP_DONE = True
self.currentPosition = 0
for item in self.xml:
api = API(item)

View file

@ -263,12 +263,12 @@ class PKC_Player(Player):
for item in ('plex_currently_playing_itemid',
'plex_customplaylist',
'plex_customplaylist.seektime',
'plex_playbackProps',
'plex_forcetranscode'):
window(item, clear=True)
# 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
LOG.debug("Cleared playlist properties.")
def onPlayBackEnded(self):

View file

@ -117,6 +117,10 @@ PLAYER_STATES = {
# paths for playback (since we're not receiving a Kodi id)
PLEX_IDS = {}
PLAYED_INFO = {}
# Former playbackProps; used by playbackutils.py and set to True if initial
# playback setup has been done (and playbackutils will be called again
# subsequently)
PLAYBACK_SETUP_DONE = False
# Kodi webserver details
WEBSERVER_PORT = 8080

View file

@ -108,7 +108,7 @@ class Service():
"plex_online", "plex_serverStatus", "plex_onWake",
"plex_kodiScan",
"plex_shouldStop", "plex_dbScan",
"plex_initialScan", "plex_customplayqueue", "plex_playbackProps",
"plex_initialScan", "plex_customplayqueue",
"pms_token", "plex_token",
"pms_server", "plex_machineIdentifier", "plex_servername",
"plex_authenticated", "PlexUserImage", "useDirectPaths",