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

View file

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