From 4fbcdcac7f2d7ebba17bfa4383ecf7a7db9ce4e2 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 14 Dec 2018 19:51:30 +0100 Subject: [PATCH] Fix episodes not being synced to due a missing season - Partially fixes #566 --- resources/lib/itemtypes/tvshows.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/lib/itemtypes/tvshows.py b/resources/lib/itemtypes/tvshows.py index 0d5195e8..a24fcc7c 100644 --- a/resources/lib/itemtypes/tvshows.py +++ b/resources/lib/itemtypes/tvshows.py @@ -55,7 +55,8 @@ class TvShowMixin(object): # Delete episode, verify season and tvshow self.remove_episode(db_item['kodi_id'], db_item['kodi_fileid']) # Season verification - if not self.plexdb.season_has_episodes(db_item['season_id']): + if (db_item['season_id'] and + not self.plexdb.season_has_episodes(db_item['season_id'])): # No episode left for this season - so delete the season self.remove_season(db_item['parent_id']) self.plexdb.remove(db_item['season_id'], v.PLEX_TYPE_SEASON) @@ -389,7 +390,7 @@ class Episode(TvShowMixin, ItemBase): # The parent Season season = self.plexdb.season(season_id) - if not season: + if not season and season_id: LOG.warn('Parent season %s not found in DB, adding it', season_id) season_xml = PF.GetPlexMetadata(season_id) try: @@ -406,7 +407,7 @@ class Episode(TvShowMixin, ItemBase): if not season: LOG.error('Still could not find parent season %s', season_id) return - parent_id = season['kodi_id'] + parent_id = season['kodi_id'] if season else None # GET THE FILE AND PATH ##### do_indirect = not app.SYNC.direct_paths