From bafd3545f4a965c97744608c43650c2694924102 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 24 Nov 2019 14:01:42 +0100 Subject: [PATCH] Improve sync resiliance when certain items are not to be synced to Kodi --- resources/lib/itemtypes/movies.py | 4 ++-- resources/lib/itemtypes/music.py | 14 ++++++++++++-- resources/lib/itemtypes/tvshows.py | 12 ++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/resources/lib/itemtypes/movies.py b/resources/lib/itemtypes/movies.py index f9193c88..54758444 100644 --- a/resources/lib/itemtypes/movies.py +++ b/resources/lib/itemtypes/movies.py @@ -20,10 +20,10 @@ class Movie(ItemBase): Process single movie """ api = API(xml) - if not self.sync_this_item(api.library_section_id()): + if not self.sync_this_item(section_id or api.library_section_id()): LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' 'Kodi', api.plex_type, api.plex_id, api.title(), - api.library_section_id()) + section_id or api.library_section_id()) return plex_id = api.plex_id movie = self.plexdb.movie(plex_id) diff --git a/resources/lib/itemtypes/music.py b/resources/lib/itemtypes/music.py index 61b16003..f609829a 100644 --- a/resources/lib/itemtypes/music.py +++ b/resources/lib/itemtypes/music.py @@ -159,10 +159,10 @@ class Artist(MusicMixin, ItemBase): Process a single artist """ api = API(xml) - if not self.sync_this_item(api.library_section_id()): + if not self.sync_this_item(section_id or api.library_section_id()): LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' 'Kodi', api.plex_type, api.plex_id, api.title(), - api.library_section_id()) + section_id or api.library_section_id()) return plex_id = api.plex_id artist = self.plexdb.artist(plex_id) @@ -225,6 +225,11 @@ class Album(MusicMixin, ItemBase): avoid infinite loops """ api = API(xml) + if not self.sync_this_item(section_id or api.library_section_id()): + LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' + 'Kodi', api.plex_type, api.plex_id, api.title(), + section_id or api.library_section_id()) + return plex_id = api.plex_id album = self.plexdb.album(plex_id) if album: @@ -387,6 +392,11 @@ class Song(MusicMixin, ItemBase): Process single song/track """ api = API(xml) + if not self.sync_this_item(section_id or api.library_section_id()): + LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' + 'Kodi', api.plex_type, api.plex_id, api.title(), + section_id or api.library_section_id()) + return plex_id = api.plex_id song = self.plexdb.song(plex_id) if song: diff --git a/resources/lib/itemtypes/tvshows.py b/resources/lib/itemtypes/tvshows.py index 61d8d050..f52a03f1 100644 --- a/resources/lib/itemtypes/tvshows.py +++ b/resources/lib/itemtypes/tvshows.py @@ -148,10 +148,10 @@ class Show(TvShowMixin, ItemBase): Process a single show """ api = API(xml) - if not self.sync_this_item(api.library_section_id()): + if not self.sync_this_item(section_id or api.library_section_id()): LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' 'Kodi', api.plex_type, api.plex_id, api.title(), - api.library_section_id()) + section_id or api.library_section_id()) return plex_id = api.plex_id show = self.plexdb.show(plex_id) @@ -303,10 +303,10 @@ class Season(TvShowMixin, ItemBase): Process a single season of a certain tv show """ api = API(xml) - if not self.sync_this_item(api.library_section_id()): + if not self.sync_this_item(section_id or api.library_section_id()): LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' 'Kodi', api.plex_type, api.plex_id, api.title(), - api.library_section_id()) + section_id or api.library_section_id()) return plex_id = api.plex_id season = self.plexdb.season(plex_id) @@ -372,10 +372,10 @@ class Episode(TvShowMixin, ItemBase): Process single episode """ api = API(xml) - if not self.sync_this_item(api.library_section_id()): + if not self.sync_this_item(section_id or api.library_section_id()): LOG.debug('Skipping sync of %s %s: %s - section %s not synched to ' 'Kodi', api.plex_type, api.plex_id, api.title(), - api.library_section_id()) + section_id or api.library_section_id()) return plex_id = api.plex_id episode = self.plexdb.episode(plex_id)