mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Check KodiSyncQueue GetPluginSettings endpoint
to determine whether the plugin is enabled or not Fixes #861
This commit is contained in:
parent
fbc8a99b0f
commit
4c6b69abf6
2 changed files with 8 additions and 25 deletions
|
@ -254,37 +254,20 @@ class API(object):
|
||||||
'ParentId': parent_id
|
'ParentId': parent_id
|
||||||
})
|
})
|
||||||
|
|
||||||
def get_plugins(self):
|
def check_companion_enabled(self):
|
||||||
return self._get("Plugins")
|
|
||||||
|
|
||||||
def check_companion_installed(self):
|
|
||||||
"""
|
"""
|
||||||
|
True = Enabled
|
||||||
|
False = Not enabled
|
||||||
None = Unknown
|
None = Unknown
|
||||||
True = Installed, but possibly not loaded right now
|
|
||||||
False = Not installed, scheduled for uninstalling or disabled
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
kodi_sync_queue = [
|
plugin_settings = self._get("Jellyfin.Plugin.KodiSyncQueue/GetPluginSettings") or {}
|
||||||
x
|
return plugin_settings.get('IsEnabled')
|
||||||
for x in self.get_plugins()
|
|
||||||
if x.get("Id") == "771e19d653854cafb35c28a0e865cf63"
|
|
||||||
]
|
|
||||||
|
|
||||||
LOG.debug("KodiSyncQueue Plugins result: %s", kodi_sync_queue)
|
|
||||||
|
|
||||||
kodi_sync_queue_filtered = [
|
|
||||||
x
|
|
||||||
for x in kodi_sync_queue
|
|
||||||
if x.get("Status")
|
|
||||||
in ["Active", "Restart", "Malfunctioned", "NotSupported"]
|
|
||||||
]
|
|
||||||
|
|
||||||
if kodi_sync_queue_filtered:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
LOG.warning("Error checking companion installed state: %s", e)
|
LOG.warning("Error checking companion installed state: %s", e)
|
||||||
|
if e.response.status_code == 404:
|
||||||
|
return False
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ class Library(threading.Thread):
|
||||||
'kodiCompanion.bool'
|
'kodiCompanion.bool'
|
||||||
):
|
):
|
||||||
# None == Unknown
|
# None == Unknown
|
||||||
if self.server.jellyfin.check_companion_installed() is not False:
|
if self.server.jellyfin.check_companion_enabled() is not False:
|
||||||
|
|
||||||
if not self.fast_sync():
|
if not self.fast_sync():
|
||||||
dialog("ok", "{jellyfin}", translate(33128))
|
dialog("ok", "{jellyfin}", translate(33128))
|
||||||
|
|
Loading…
Reference in a new issue