From 66cdd4b176e348d367c5cd49a61499ba76406659 Mon Sep 17 00:00:00 2001 From: croneter Date: Mon, 5 Feb 2018 18:20:33 +0100 Subject: [PATCH] Fix IntegrityError when adding missing album - Should fix #395 --- resources/lib/itemtypes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 63c83910..45f4b7da 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -1360,7 +1360,8 @@ class Music(Items): artwork.addArtwork(artworks, artistid, v.KODI_TYPE_ARTIST, kodicursor) @CatchExceptions(warnuser=True) - def add_updateAlbum(self, item, viewtag=None, viewid=None, children=None): + def add_updateAlbum(self, item, viewtag=None, viewid=None, children=None, + scan_children=True): """ children: list of child xml's, so in this case songs """ @@ -1550,8 +1551,9 @@ class Music(Items): # Update artwork artwork.addArtwork(artworks, albumid, v.KODI_TYPE_ALBUM, kodicursor) # Add all children - all tracks - for child in children: - self.add_updateSong(child, viewtag, viewid) + if scan_children: + for child in children: + self.add_updateSong(child, viewtag, viewid) @CatchExceptions(warnuser=True) def add_updateSong(self, item, viewtag=None, viewid=None): @@ -1716,7 +1718,9 @@ class Music(Items): if album is None or album == 401: log.error('Could not download album, abort') return - self.add_updateAlbum(album[0], children=[item]) + self.add_updateAlbum(album[0], + children=[item], + scan_children=False) plex_dbalbum = plex_db.getItem_byId(plex_albumId) try: albumid = plex_dbalbum[0]