Fix music

Fix multiple albums being created due to missing musicbrainzid.
This commit is contained in:
angelblue05 2018-03-11 21:50:52 -05:00
parent 18666ad27d
commit 6329ead9d3
2 changed files with 19 additions and 9 deletions

View file

@ -126,7 +126,7 @@ class KodiMusic(KodiItems):
"UPDATE artist",
"SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?,",
"lastScraped = ?, dateAdded = ?",
"lastScraped = ?",
"WHERE idArtist = ?"
))
self.cursor.execute(query, (args))
@ -159,8 +159,9 @@ class KodiMusic(KodiItems):
)
self.cursor.execute(query, (kodi_id, album, year))
def get_album(self, name, musicbrainz):
def get_album(self, name, musicbrainz=None):
if musicbrainz is not None:
query = ' '.join((
"SELECT idAlbum",
@ -168,6 +169,15 @@ class KodiMusic(KodiItems):
"WHERE strMusicBrainzAlbumID = ?"
))
self.cursor.execute(query, (musicbrainz,))
else:
query = ' '.join((
"SELECT idAlbum",
"FROM album",
"WHERE strMusicBrainzAlbumID = ?"
))
self.cursor.execute(query, (name,))
try:
album_id = self.cursor.fetchone()[0]
except TypeError:

View file

@ -235,7 +235,7 @@ class Music(Items):
# Process the artist
if self.kodi_version < 18:
self.kodi_db.update_artist(genres, bio, thumb, fanart, lastScraped, dateadded, artistid)
self.kodi_db.update_artist(genres, bio, thumb, fanart, lastScraped, artistid)
else:
self.kodi_db.update_artist_18(genres, bio, thumb, fanart, lastScraped, artistid)