From d75e2a0109b1aeb411fb3724a9b3618af915f321 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 5 Oct 2019 11:29:08 +0200 Subject: [PATCH] Remember currently playing item directly --- resources/lib/app/playstate.py | 3 +++ resources/lib/kodimonitor.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/resources/lib/app/playstate.py b/resources/lib/app/playstate.py index 0266c65d..d5235ff4 100644 --- a/resources/lib/app/playstate.py +++ b/resources/lib/app/playstate.py @@ -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 diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 759ef7e3..8afde9be 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -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')