From ded8a59dd79ee20dc685061bb6959aa4806a2153 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 25 Nov 2018 20:57:16 +0100 Subject: [PATCH] Fix adding misisng artist on adding an album --- resources/lib/itemtypes/music.py | 20 +++++++++++++++----- resources/lib/itemtypes/tvshows.py | 21 +++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/resources/lib/itemtypes/music.py b/resources/lib/itemtypes/music.py index 1fcac64c..0e9345a1 100644 --- a/resources/lib/itemtypes/music.py +++ b/resources/lib/itemtypes/music.py @@ -238,7 +238,11 @@ class Album(MusicMixin, ItemBase): LOG.error('Could not get artist %s xml for %s', parent_id, xml.attrib) return - Artist(artist_xml[0], section_name, section_id) + Artist(self.last_sync, + plexdb=self.plexdb, + kodidb=self.kodidb).add_update(artist_xml[0], + section_name, + section_id) artist = self.plexdb.artist(parent_id) if not artist: LOG.error('Adding artist %s failed for %s', @@ -394,8 +398,11 @@ class Song(MusicMixin, ItemBase): LOG.error('Grandparent tvartist %s xml download failed for %s', artist_id, xml.attrib) return - Artist(self.last_sync, plexdb=self.plexdb, kodidb=self.kodidb).add_update( - artist_xml[0], section_name, section_id) + Artist(self.last_sync, + plexdb=self.plexdb, + kodidb=self.kodidb).add_update(artist_xml[0], + section_name, + section_id) artist = self.plexdb.artist(artist_id) if not artist: LOG.error('Still could not find grandparent artist %s for %s', @@ -447,8 +454,11 @@ class Song(MusicMixin, ItemBase): LOG.error('Parent album %s xml download failed for %s', album_id, xml.attrib) return - Album(self.last_sync, plexdb=self.plexdb, kodidb=self.kodidb).add_update( - album_xml[0], section_name, section_id) + Album(self.last_sync, + plexdb=self.plexdb, + kodidb=self.kodidb).add_update(album_xml[0], + section_name, + section_id) album = self.plexdb.album(album_id) if not album: LOG.error('Still could not find parent album %s for %s', diff --git a/resources/lib/itemtypes/tvshows.py b/resources/lib/itemtypes/tvshows.py index 41f8c4df..735b9587 100644 --- a/resources/lib/itemtypes/tvshows.py +++ b/resources/lib/itemtypes/tvshows.py @@ -302,8 +302,11 @@ class Season(ItemBase, TvShowMixin): except (TypeError, IndexError, AttributeError): LOG.error("Parent tvshow %s xml download failed", show_id) return False - Show(self.last_sync, plexdb=self.plexdb, kodidb=self.kodidb).add_update( - show_xml[0], section_name, section_id) + Show(self.last_sync, + plexdb=self.plexdb, + kodidb=self.kodidb).add_update(show_xml[0], + section_name, + section_id) show = self.plexdb.show(show_id) if not show: LOG.error('Still could not find parent tv show %s', show_id) @@ -373,8 +376,11 @@ class Episode(ItemBase, TvShowMixin): except (TypeError, IndexError, AttributeError): LOG.error("Grandparent tvshow %s xml download failed", show_id) return False - Show(self.last_sync, plexdb=self.plexdb, kodidb=self.kodidb).add_update( - show_xml[0], section_name, section_id) + Show(self.last_sync, + plexdb=self.plexdb, + kodidb=self.kodidb).add_update(show_xml[0], + section_name, + section_id) show = self.plexdb.show(show_id) if not show: LOG.error('Still could not find grandparent tv show %s', show_id) @@ -391,8 +397,11 @@ class Episode(ItemBase, TvShowMixin): except (TypeError, IndexError, AttributeError): LOG.error("Parent season %s xml download failed", season_id) return False - Season(self.last_sync, plexdb=self.plexdb, kodidb=self.kodidb).add_update( - season_xml[0], section_name, section_id) + Season(self.last_sync, + plexdb=self.plexdb, + kodidb=self.kodidb).add_update(season_xml[0], + section_name, + section_id) season = self.plexdb.season(season_id) if not season: LOG.error('Still could not find parent season %s', season_id)