From 20f5d9d561e71e5b1f04faa2961c2cc9f6db7865 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 22 Oct 2021 14:36:13 +0200 Subject: [PATCH] Fix Kodi JSON racing condition on playback startup and KeyError --- resources/lib/kodimonitor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index eae5f77e..95765a59 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -390,6 +390,10 @@ class KodiMonitor(xbmc.Monitor): if not self._switched_to_plex_streams: # We need to switch to the Plex streams ONCE upon playback start # after onavchange has been fired + # Wait a bit because JSON responses won't be ready otherwise + if app.APP.monitor.waitForAbort(2): + # In case PKC needs to quit + return item.init_kodi_streams() item.switch_to_plex_stream('video') if utils.settings('audioStreamPick') == '0':