Remember currently playing item directly

This commit is contained in:
croneter 2019-10-05 11:29:08 +02:00
parent ae0e121b13
commit d75e2a0109
2 changed files with 6 additions and 0 deletions

View file

@ -53,6 +53,9 @@ class PlayState(object):
}
self.played_info = {}
# Currently playing PKC item, a PlaylistItem()
self.item = None
# Set by SpecialMonitor - did user choose to resume playback or start from the
# beginning?
# Set to None if resume dialog has not been shown

View file

@ -422,6 +422,8 @@ class KodiMonitor(xbmc.Monitor):
container_key = '/playQueues/%s' % playqueue.id
else:
container_key = '/library/metadata/%s' % plex_id
# Remember the currently playing item
app.PLAYSTATE.item = item
# Remember that this player has been active
app.PLAYSTATE.active_players.add(playerid)
status.update(info)
@ -469,6 +471,7 @@ def _playback_cleanup(ended=False):
app.PLAYSTATE.player_states[playerid] = copy.deepcopy(app.PLAYSTATE.template)
# As all playback has halted, reset the players that have been active
app.PLAYSTATE.active_players = set()
app.PLAYSTATE.item = None
LOG.info('Finished PKC playback cleanup')