From 1fcc0d97e352b625e3d7a134b364c8d221042c0f Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 2 Apr 2022 21:23:11 -0400 Subject: [PATCH] Add setting to disable remote control --- jellyfin_kodi/jellyfin/ws_client.py | 34 ++++++++++--------- .../resource.language.en_gb/strings.po | 4 +++ .../resource.language.en_us/strings.po | 4 +++ resources/settings.xml | 1 + 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/jellyfin_kodi/jellyfin/ws_client.py b/jellyfin_kodi/jellyfin/ws_client.py index 9913fe82..f99b24dd 100644 --- a/jellyfin_kodi/jellyfin/ws_client.py +++ b/jellyfin_kodi/jellyfin/ws_client.py @@ -9,7 +9,7 @@ import time from kodi_six import xbmc -from ..helper import LazyLogger +from ..helper import LazyLogger, settings # If numpy is installed, the websockets library tries to use it, and then # kodi hard crashes for reasons I don't even want to pretend to understand @@ -79,21 +79,23 @@ class WSClient(threading.Thread): def on_open(self, ws): LOG.info("--->[ websocket ]") - self.client.jellyfin.post_capabilities({ - 'PlayableMediaTypes': "Audio,Video", - 'SupportsMediaControl': True, - 'SupportedCommands': ( - "MoveUp,MoveDown,MoveLeft,MoveRight,Select," - "Back,ToggleContextMenu,ToggleFullscreen,ToggleOsdMenu," - "GoHome,PageUp,NextLetter,GoToSearch," - "GoToSettings,PageDown,PreviousLetter,TakeScreenshot," - "VolumeUp,VolumeDown,ToggleMute,SendString,DisplayMessage," - "SetAudioStreamIndex,SetSubtitleStreamIndex," - "SetRepeatMode," - "Mute,Unmute,SetVolume," - "Play,Playstate,PlayNext,PlayMediaSource" - ), - }) + if settings('remoteControl.bool'): + self.client.jellyfin.post_capabilities({ + 'PlayableMediaTypes': "Audio,Video", + 'SupportsMediaControl': True, + 'SupportedCommands': ( + "MoveUp,MoveDown,MoveLeft,MoveRight,Select," + "Back,ToggleContextMenu,ToggleFullscreen,ToggleOsdMenu," + "GoHome,PageUp,NextLetter,GoToSearch," + "GoToSettings,PageDown,PreviousLetter,TakeScreenshot," + "VolumeUp,VolumeDown,ToggleMute,SendString,DisplayMessage," + "SetAudioStreamIndex,SetSubtitleStreamIndex," + "SetRepeatMode,Mute,Unmute,SetVolume," + "Play,Playstate,PlayNext,PlayMediaSource" + ), + }) + else: + self.client.jellyfin.post_capabilities({}) # Reinitialize the retry counter after successful connection self.retry_count = 0 diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 7d86542b..145aa82c 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -689,6 +689,10 @@ msgctxt "#33124" msgid "Include people (slow)" msgstr "Include people (slow)" +msgctxt "#33125" +msgid "Enable remote control" +msgstr "Enable remote control" + msgctxt "#33128" msgid "Failed to retrieve latest content updates. No content updates will be applied until Kodi is restarted. If this issue persists, please report on the Jellyfin for Kodi forums, with your Kodi log." msgstr "" diff --git a/resources/language/resource.language.en_us/strings.po b/resources/language/resource.language.en_us/strings.po index 876777fd..8053e1f9 100644 --- a/resources/language/resource.language.en_us/strings.po +++ b/resources/language/resource.language.en_us/strings.po @@ -653,6 +653,10 @@ msgctxt "#33124" msgid "Include people (slow)" msgstr "Include people (slow)" +msgctxt "#33125" +msgid "Enable remote control" +msgstr "Enable remote control" + msgctxt "#33128" msgid "Failed to retrieve latest content updates. No content updates will be applied until Kodi is restarted. If this issue persists, please report on the Jellyfin for Kodi forums, with your Kodi log." msgstr "" diff --git a/resources/settings.xml b/resources/settings.xml index ad337517..ec2c0267 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -92,6 +92,7 @@ +