From b094b7ba30a9199d86331e6e0fde9183684ccd3a Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 31 Dec 2020 11:37:38 -0500 Subject: [PATCH] Fix boxset sync on startup, simplify code --- jellyfin_kodi/full_sync.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jellyfin_kodi/full_sync.py b/jellyfin_kodi/full_sync.py index 57c5b33d..c82c137c 100644 --- a/jellyfin_kodi/full_sync.py +++ b/jellyfin_kodi/full_sync.py @@ -215,17 +215,23 @@ class FullSync(object): if library_id.startswith('Boxsets:'): boxset_library = {} - if library_id and library_id == 'Boxsets:Refresh': + # Initial library sync is 'Boxsets:' + # Refresh from the addon menu is 'Boxsets:Refresh' + # Incremental syncs are 'Boxsets:$library_id' + sync_id = library_id.split(':')[1] + + if not sync_id or sync_id == 'Refresh': libraries = self.get_libraries() else: - libraries = self.get_libraries(library_id.split('Boxsets:')[1]) + libraries = self.get_libraries(sync_id) + for entry in libraries: if entry[2] == 'boxsets': boxset_library = {'Id': entry[0], 'Name': entry[1]} break if boxset_library: - if library_id.endswith('Refresh'): + if sync_id == 'Refresh': self.refresh_boxsets(boxset_library) else: self.boxsets(boxset_library)