diff --git a/resources/lib/itemtypes/movies.py b/resources/lib/itemtypes/movies.py index 6d00c839..71dc52a3 100644 --- a/resources/lib/itemtypes/movies.py +++ b/resources/lib/itemtypes/movies.py @@ -263,13 +263,15 @@ class Movie(ItemBase): """ Updates the Kodi watched state of the item from PMS. Also retrieves Plex resume points for movies in progress. + + Returns True if successful, False otherwise (e.g. item missing) """ api = API(xml_element) # Get key and db entry on the Kodi db side db_item = self.plexdb.item_by_id(api.plex_id(), plex_type) if not db_item: - LOG.error('Item not yet synced: %s', xml_element.attrib) - return + LOG.info('Item not yet synced: %s', xml_element.attrib) + return False # Grab the user's viewcount, resume points etc. from PMS' answer userdata = api.userdata() # Write to Kodi DB @@ -282,3 +284,4 @@ class Movie(ItemBase): self.kodidb.update_userrating(db_item['kodi_id'], db_item['kodi_type'], userdata['UserRating']) + return True diff --git a/resources/lib/itemtypes/music.py b/resources/lib/itemtypes/music.py index b7412632..300f32dc 100644 --- a/resources/lib/itemtypes/music.py +++ b/resources/lib/itemtypes/music.py @@ -37,13 +37,15 @@ class MusicMixin(object): """ Updates the Kodi watched state of the item from PMS. Also retrieves Plex resume points for movies in progress. + + Returns True if successful, False otherwise (e.g. item missing) """ api = API(xml_element) # Get key and db entry on the Kodi db side db_item = self.plexdb.item_by_id(api.plex_id(), plex_type) if not db_item: - LOG.error('Item not yet synced: %s', xml_element.attrib) - return + LOG.info('Item not yet synced: %s', xml_element.attrib) + return False # Grab the user's viewcount, resume points etc. from PMS' answer userdata = api.userdata() self.kodidb.update_userrating(db_item['kodi_id'], @@ -56,6 +58,7 @@ class MusicMixin(object): userdata['PlayCount'], userdata['LastPlayedDate'], plex_type) + return True def remove(self, plex_id, plex_type=None): """ diff --git a/resources/lib/itemtypes/tvshows.py b/resources/lib/itemtypes/tvshows.py index 1bfcf60f..9df90157 100644 --- a/resources/lib/itemtypes/tvshows.py +++ b/resources/lib/itemtypes/tvshows.py @@ -20,8 +20,8 @@ class TvShowMixin(object): # Get key and db entry on the Kodi db side db_item = self.plexdb.item_by_id(api.plex_id(), plex_type) if not db_item: - LOG.error('Item not yet synced: %s', xml_element.attrib) - return + LOG.info('Item not yet synced: %s', xml_element.attrib) + return False # Grab the user's viewcount, resume points etc. from PMS' answer userdata = api.userdata() self.kodidb.update_userrating(db_item['kodi_id'], @@ -34,6 +34,7 @@ class TvShowMixin(object): userdata['PlayCount'], userdata['LastPlayedDate'], plex_type) + return True def remove(self, plex_id, plex_type=None): """ diff --git a/resources/lib/library_sync/full_sync.py b/resources/lib/library_sync/full_sync.py index 46f9ac29..c2da8464 100644 --- a/resources/lib/library_sync/full_sync.py +++ b/resources/lib/library_sync/full_sync.py @@ -229,7 +229,11 @@ class FullSync(common.fullsync_mixin): for i, (last, xml_item) in enumerate(loop): if self.isCanceled(): return False - itemtype.update_userdata(xml_item, section['plex_type']) + if not itemtype.update_userdata(xml_item, section['plex_type']): + # Somehow did not sync this item yet + itemtype.add_update(xml_item, + section['section_name'], + section['section_id']) itemtype.plexdb.update_last_sync(int(xml_item.attrib['ratingKey']), section['plex_type'], self.current_sync)