Fix adding misisng artist on adding an album

This commit is contained in:
croneter 2018-11-25 20:57:16 +01:00
parent 202d33d7c0
commit ded8a59dd7
2 changed files with 30 additions and 11 deletions

View file

@ -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',

View file

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