Merge pull request #1068 from croneter/fix-itemtypes

Improve sync resiliance when certain items are not to be synced to Kodi or PKC skipped an item in the past
This commit is contained in:
croneter 2019-11-30 16:26:23 +01:00 committed by GitHub
commit 71f5b7169b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 10 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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)