From a1f2a676fb83f4e315f3c7af765daed861e70948 Mon Sep 17 00:00:00 2001 From: croneter Date: Mon, 13 Sep 2021 14:35:58 +0200 Subject: [PATCH 1/2] Refactor usage of a media part's id --- resources/lib/playback_decision.py | 13 +++---------- resources/lib/plex_api/base.py | 6 ++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/lib/playback_decision.py b/resources/lib/playback_decision.py index 224d2850..8443efbe 100644 --- a/resources/lib/playback_decision.py +++ b/resources/lib/playback_decision.py @@ -328,19 +328,12 @@ def audio_subtitle_prefs(api, item): Returns None if user cancelled or we need to abort, True otherwise """ # Set media and part where we're at - if (api.mediastream is None and - api.mediastream_number() is None): + if api.mediastream is None and api.mediastream_number() is None: return - try: - mediastreams = api.plex_media_streams() - except (TypeError, IndexError): - LOG.error('Could not get media %s, part %s', - api.mediastream, api.part) - return - part_id = mediastreams.attrib['id'] if item.playmethod != v.PLAYBACK_METHOD_TRANSCODE: return True - return setup_transcoding_audio_subtitle_prefs(mediastreams, part_id) + return setup_transcoding_audio_subtitle_prefs(api.plex_media_streams(), + api.part_id()) def setup_transcoding_audio_subtitle_prefs(mediastreams, part_id): diff --git a/resources/lib/plex_api/base.py b/resources/lib/plex_api/base.py index 6cb6978c..c26d820f 100644 --- a/resources/lib/plex_api/base.py +++ b/resources/lib/plex_api/base.py @@ -262,6 +262,12 @@ class Base(object): """ return self.xml[self.mediastream][self.part] + def part_id(self): + """ + Returns the unique id of the currently active part [int] + """ + return int(self.xml[self.mediastream][self.part].attrib['id']) + def plot(self): """ Returns the plot or None. From e65ce668b7940a80587a36527175d10ec31c287a Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 19 Sep 2021 13:37:24 +0200 Subject: [PATCH 2/2] Remove some obsolete comments --- resources/lib/variables.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/lib/variables.py b/resources/lib/variables.py index 0da3dd67..c7351325 100644 --- a/resources/lib/variables.py +++ b/resources/lib/variables.py @@ -88,17 +88,14 @@ MIN_DB_VERSION = '3.2.1' # Supported databases - version numbers in tuples should decrease SUPPORTED_VIDEO_DB = { - # Kodi 19 - EXTREMLY EXPERIMENTAL! 19: (119, ), 20: (119, ), } SUPPORTED_MUSIC_DB = { - # Kodi 19 - EXTREMLY EXPERIMENTAL! 19: (82, ), 20: (82, ), } SUPPORTED_TEXTURE_DB = { - # Kodi 19 - EXTREMLY EXPERIMENTAL! 19: (13, ), 20: (13, ), }