From 064a02ad3c890414d8e86b858fe3b8244dad165c Mon Sep 17 00:00:00 2001 From: Peter Fern Date: Tue, 21 Nov 2023 17:07:36 +1100 Subject: [PATCH 1/2] Fix uncaught exception in Player.report_playback() --- jellyfin_kodi/player.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/player.py b/jellyfin_kodi/player.py index e8a92985a..104f3901d 100644 --- a/jellyfin_kodi/player.py +++ b/jellyfin_kodi/player.py @@ -326,7 +326,11 @@ def report_playback(self, report=True): if not report: previous = item['CurrentPosition'] - item['CurrentPosition'] = int(self.getTime()) + + try: + item['CurrentPosition'] = int(self.getTime()) + except Exception: # at this point we should be playing and if not then bail out + return if int(item['CurrentPosition']) == 1: return From 248b49c86937a1af89909d4d9d844f3baedaa8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Wed, 7 Feb 2024 08:54:53 +0100 Subject: [PATCH 2/2] Log when catching generic exceptions --- jellyfin_kodi/player.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/player.py b/jellyfin_kodi/player.py index 104f3901d..bb6a8bea7 100644 --- a/jellyfin_kodi/player.py +++ b/jellyfin_kodi/player.py @@ -329,7 +329,9 @@ def report_playback(self, report=True): try: item['CurrentPosition'] = int(self.getTime()) - except Exception: # at this point we should be playing and if not then bail out + except Exception as e: + # getTime() raises RuntimeError if nothing is playing + LOG.debug("Failed to get playback position: %s", e) return if int(item['CurrentPosition']) == 1: