Fix playstates not being copied/reset correctly
This commit is contained in:
parent
8943083533
commit
93e3d42e23
3 changed files with 7 additions and 5 deletions
|
@ -4,6 +4,7 @@ PKC Kodi Monitoring implementation
|
|||
from logging import getLogger
|
||||
from json import loads
|
||||
from threading import Thread
|
||||
import copy
|
||||
|
||||
from xbmc import Monitor, Player, sleep, getCondVisibility, getInfoLabel, \
|
||||
getLocalizedString
|
||||
|
@ -60,8 +61,8 @@ class KodiMonitor(Monitor):
|
|||
self.xbmcplayer = Player()
|
||||
Monitor.__init__(self)
|
||||
for playerid in state.PLAYER_STATES:
|
||||
state.PLAYER_STATES[playerid] = dict(state.PLAYSTATE)
|
||||
state.OLD_PLAYER_STATES[playerid] = dict(state.PLAYSTATE)
|
||||
state.PLAYER_STATES[playerid] = copy.deepcopy(state.PLAYSTATE)
|
||||
state.OLD_PLAYER_STATES[playerid] = copy.deepcopy(state.PLAYSTATE)
|
||||
LOG.info("Kodi monitor started.")
|
||||
|
||||
def onScanStarted(self, library):
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
###############################################################################
|
||||
from logging import getLogger
|
||||
import copy
|
||||
|
||||
from xbmc import Player
|
||||
|
||||
|
@ -23,9 +24,9 @@ def playback_cleanup():
|
|||
"""
|
||||
PKC cleanup after playback ends/is stopped
|
||||
"""
|
||||
LOG.debug('playback_cleanup called')
|
||||
# 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)
|
||||
LOG.debug('playback_cleanup called')
|
||||
state.PLEX_TRANSIENT_TOKEN = None
|
||||
for playerid in state.ACTIVE_PLAYERS:
|
||||
status = state.PLAYER_STATES[playerid]
|
||||
|
@ -38,7 +39,7 @@ def playback_cleanup():
|
|||
'{server}/video/:/transcode/universal/stop',
|
||||
parameters={'session': v.PKC_MACHINE_IDENTIFIER})
|
||||
# Reset the player's status
|
||||
status = dict(state.PLAYSTATE)
|
||||
status = copy.deepcopy(state.PLAYSTATE)
|
||||
# As all playback has halted, reset the players that have been active
|
||||
state.ACTIVE_PLAYERS = []
|
||||
LOG.debug('Finished PKC playback cleanup')
|
||||
|
|
|
@ -108,7 +108,7 @@ OLD_PLAYER_STATES = {
|
|||
1: {},
|
||||
2: {}
|
||||
}
|
||||
# "empty" dict for the PLAYER_STATES above
|
||||
# "empty" dict for the PLAYER_STATES above. Use copy.deepcopy to duplicate!
|
||||
PLAYSTATE = {
|
||||
'type': None,
|
||||
'time': {
|
||||
|
|
Loading…
Reference in a new issue