From 9a9b84c66c42aab2d254fb41106c8b1d2ef10fe5 Mon Sep 17 00:00:00 2001 From: TrueTechy Date: Thu, 12 Sep 2019 05:39:00 +0100 Subject: [PATCH] Change companion detection to endpoint check #23 --- resources/lib/jellyfin/core/api.py | 7 +++++++ resources/lib/library.py | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/lib/jellyfin/core/api.py b/resources/lib/jellyfin/core/api.py index e364e2dc..ffb1fad4 100644 --- a/resources/lib/jellyfin/core/api.py +++ b/resources/lib/jellyfin/core/api.py @@ -238,6 +238,13 @@ class API(object): def get_plugins(self): return self._get("Plugins") + def check_companion_installed(self): + try: + self._get("/Jellyfin.Plugin.KodiSyncQueue/GetServerDateTime") + return True + except Exception: + return False + def get_seasons(self, show_id): return self.shows("/%s/Seasons" % show_id, params={ 'UserId': "{UserId}", diff --git a/resources/lib/library.py b/resources/lib/library.py index bf801a5f..c63563d9 100644 --- a/resources/lib/library.py +++ b/resources/lib/library.py @@ -348,8 +348,7 @@ class Library(threading.Thread): if settings('SyncInstallRunDone.bool'): if settings('kodiCompanion.bool'): - for plugin in self.server.jellyfin.get_plugins(): - if plugin['Name'] in ("Jellyfin.Kodi Sync Queue", "Kodi companion", "Kodi Sync Queue"): + if self.server.jellyfin.check_companion_installed(): if not self.fast_sync(): dialog("ok", heading="{jellyfin}", line1=_(33128)) @@ -358,7 +357,6 @@ class Library(threading.Thread): LOG.info("--<[ retrieve changes ]") - break else: raise LibraryException('CompanionMissing')