Fix IntegrityError when adding missing album

- Should fix #395
This commit is contained in:
croneter 2018-02-05 18:20:33 +01:00
parent 6cb69ada3f
commit 66cdd4b176

View file

@ -1360,7 +1360,8 @@ class Music(Items):
artwork.addArtwork(artworks, artistid, v.KODI_TYPE_ARTIST, kodicursor) artwork.addArtwork(artworks, artistid, v.KODI_TYPE_ARTIST, kodicursor)
@CatchExceptions(warnuser=True) @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 children: list of child xml's, so in this case songs
""" """
@ -1550,8 +1551,9 @@ class Music(Items):
# Update artwork # Update artwork
artwork.addArtwork(artworks, albumid, v.KODI_TYPE_ALBUM, kodicursor) artwork.addArtwork(artworks, albumid, v.KODI_TYPE_ALBUM, kodicursor)
# Add all children - all tracks # Add all children - all tracks
for child in children: if scan_children:
self.add_updateSong(child, viewtag, viewid) for child in children:
self.add_updateSong(child, viewtag, viewid)
@CatchExceptions(warnuser=True) @CatchExceptions(warnuser=True)
def add_updateSong(self, item, viewtag=None, viewid=None): def add_updateSong(self, item, viewtag=None, viewid=None):
@ -1716,7 +1718,9 @@ class Music(Items):
if album is None or album == 401: if album is None or album == 401:
log.error('Could not download album, abort') log.error('Could not download album, abort')
return 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) plex_dbalbum = plex_db.getItem_byId(plex_albumId)
try: try:
albumid = plex_dbalbum[0] albumid = plex_dbalbum[0]