From 2a67cb2da5fb9eaca8ada5de9af4e1d5e2904bbb Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 2 Nov 2017 22:34:55 -0500 Subject: [PATCH] Add a retry to detect playback --- resources/lib/kodimonitor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 12163e20..a224f08e 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -25,6 +25,7 @@ KODI = int(xbmc.getInfoLabel('System.BuildVersion')[:2]) class KodiMonitor(xbmc.Monitor): + retry = True def __init__(self): @@ -108,6 +109,11 @@ class KodiMonitor(xbmc.Monitor): except (KeyError, TypeError): log.info("Item is invalid for playstate update") + # Retry once, sometimes xbmc.Player().isPlayingVideo() will return false when played from widget. + if self.retry: + self.retry = False + xbmc.sleep(200) + return self._on_play_(data) else: if ((settings('useDirectPaths') == "1" and not item_type == "song") or (item_type == "song" and settings('enableMusic') == "true")):