From f96c246244f6e72a7270e211b80fbf7f5f4a1ff6 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 9 Oct 2021 17:23:47 +0200 Subject: [PATCH] Add playback settings to let the user choose whether Plex or Kodi provides the default audio and subtitle streams on playback start --- resources/language/resource.language.en_gb/strings.po | 10 ++++++++++ resources/lib/kodimonitor.py | 6 +++++- resources/settings.xml | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index c83b1fe0..7493327f 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -665,6 +665,16 @@ msgctxt "#30546" msgid "Pick the first video if several versions are present" msgstr "" +# PKC Settings - Playback +msgctxt "#30547" +msgid "Who picks the audio stream on playback start?" +msgstr "" + +# PKC Settings - Playback +msgctxt "#30548" +msgid "Who picks subtitles on playback start?" +msgstr "" + # Welcome to Plex notification msgctxt "#33000" msgid "Welcome" diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 62e7e031..36617ff9 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -29,6 +29,7 @@ class KodiMonitor(xbmc.Monitor): """ PKC implementation of the Kodi Monitor class. Invoke only once. """ + def __init__(self): self._already_slept = False self._switched_to_plex_streams = True @@ -390,7 +391,10 @@ class KodiMonitor(xbmc.Monitor): if not self._switched_to_plex_streams: # We need to switch to the Plex streams ONCE upon playback start # after onavchange has been fired - item.switch_to_plex_streams() + if utils.settings('audioStreamPick') == '0': + item.switch_to_plex_stream('audio') + if utils.settings('subtitleStreamPick') == '0': + item.switch_to_plex_stream('subtitle') self._switched_to_plex_streams = True else: item.on_av_change(playerid) diff --git a/resources/settings.xml b/resources/settings.xml index bb6924db..400c3dfe 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -114,6 +114,8 @@ + +