From a3d654c65c1ceeaf2183a8f9ad8585c56e6d7792 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 7 Feb 2021 13:00:58 +0100 Subject: [PATCH] Fix KeyError: u'game' if Plex Arcade has been activated --- resources/lib/library_sync/sections.py | 3 +++ resources/lib/variables.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/resources/lib/library_sync/sections.py b/resources/lib/library_sync/sections.py index 04acbbad..481beae5 100644 --- a/resources/lib/library_sync/sections.py +++ b/resources/lib/library_sync/sections.py @@ -650,6 +650,9 @@ def _sync_from_pms(pick_libraries): sections = [] old_sections = [] for i, xml_element in enumerate(xml.findall('Directory')): + api = API(xml_element) + if api.plex_type in v.UNSUPPORTED_PLEX_TYPES: + continue sections.append(Section(index=i, xml_element=xml_element)) with PlexDB() as plexdb: for section_db in plexdb.all_sections(): diff --git a/resources/lib/variables.py b/resources/lib/variables.py index b6fd59e8..19b1c174 100644 --- a/resources/lib/variables.py +++ b/resources/lib/variables.py @@ -189,9 +189,15 @@ PLEX_TYPE_PHOTO = 'photo' PLEX_TYPE_PLAYLIST = 'playlist' PLEX_TYPE_CHANNEL = 'channel' +PLEX_TYPE_GAME = 'game' + # E.g. PMS answer when hitting the PMS endpoint /hubs/search PLEX_TYPE_TAG = 'tag' +# PlexKodiConnect does not support all (content) types +# e.g. Plex Arcade games +UNSUPPORTED_PLEX_TYPES = (PLEX_TYPE_GAME, ) + # Used for /:/timeline XML messages PLEX_PLAYLIST_TYPE_VIDEO = 'video' PLEX_PLAYLIST_TYPE_AUDIO = 'music'