From 119ecaa39c3dc18f47bcca077939007750a05bca Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sun, 7 May 2017 18:32:34 -0500 Subject: [PATCH] Fix watched bug Try to catch kodi_id returning -1 and try to read the data returned by Kodi in that situation. --- resources/lib/kodimonitor.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 9c1d6a5f..7bef6ce4 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -92,16 +92,20 @@ class KodiMonitor(xbmc.Monitor): def _on_play_(self, data): # Set up report progress for emby playback try: + kodi_id = None + if KODI >= 17: item = xbmc.Player().getVideoInfoTag() kodi_id = item.getDbId() item_type = item.getMediaType() - log.info("kodi_id: %s item_type: %s", kodi_id, item_type) - else: + + if kodi_id is None or int(kodi_id) == -1: item = data['item'] kodi_id = item['id'] item_type = item['type'] - log.info("kodi_id: %s item_type: %s", kodi_id, item_type) + + log.info("kodi_id: %s item_type: %s", kodi_id, item_type) + except (KeyError, TypeError): log.info("Item is invalid for playstate update") else: