mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Use fallback artists
If album artists is missing
This commit is contained in:
parent
6156557b7d
commit
3431b5d28d
2 changed files with 38 additions and 19 deletions
|
@ -323,23 +323,28 @@ class WriteKodiMusicDB():
|
|||
albumid = cursor.fetchone()[0] + 1
|
||||
if kodiVersion == 15:
|
||||
# Kodi Isengard
|
||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (albumid, artists, genre, year, dateadded, "single"))
|
||||
query = "INSERT INTO album(idAlbum, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (albumid, genre, year, dateadded, "single"))
|
||||
elif kodiVersion == 16:
|
||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, strReleaseType) values(?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (albumid, artists, genre, year, "single"))
|
||||
query = "INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType) values(?, ?, ?, ?)"
|
||||
cursor.execute(query, (albumid, genre, year, "single"))
|
||||
else:
|
||||
# Kodi Gotham and Helix
|
||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded) values(?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (albumid, artists, genre, year, dateadded))
|
||||
query = "INSERT INTO album(idAlbum, strGenres, iYear, dateAdded) values(?, ?, ?, ?)"
|
||||
cursor.execute(query, (albumid, genre, year, dateadded))
|
||||
finally:
|
||||
cursor.execute("SELECT strArtists FROM album WHERE idAlbum = ?", (albumid,))
|
||||
result = cursor.fetchone()
|
||||
if result and result[0] == "":
|
||||
# Link album to artists
|
||||
if MBitem['AlbumArtists']:
|
||||
album_artists = MBitem['AlbumArtists']
|
||||
else:
|
||||
album_artists = MBitem['ArtistItems']
|
||||
|
||||
MBartists = []
|
||||
for artist in album_artists:
|
||||
MBartists.append(artist['Name'])
|
||||
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?", (artist['Id'],))
|
||||
try:
|
||||
artistid = cursor.fetchone()[0]
|
||||
|
@ -348,6 +353,19 @@ class WriteKodiMusicDB():
|
|||
query = "INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist) values(?, ?, ?)"
|
||||
cursor.execute(query, (artistid, albumid, artist['Name']))
|
||||
|
||||
artists_onalbum = " / ".join(MBartists)
|
||||
if kodiVersion == 15:
|
||||
# Kodi Isengard
|
||||
query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?"
|
||||
cursor.execute(query, (artists_onalbum, albumid))
|
||||
elif kodiVersion == 16:
|
||||
query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?"
|
||||
cursor.execute(query, (artists_onalbum, albumid))
|
||||
else:
|
||||
# Kodi Gotham and Helix
|
||||
query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?"
|
||||
cursor.execute(query, (artists_onalbum, albumid))
|
||||
|
||||
|
||||
##### UPDATE THE SONG #####
|
||||
if songid:
|
||||
|
|
|
@ -70,6 +70,7 @@ class Service():
|
|||
utils.window('Server_status', clear=True)
|
||||
utils.window('startup', clear=True)
|
||||
utils.window('OnWakeSync', clear=True)
|
||||
utils.window('kodiScan', clear=True)
|
||||
utils.window('minDBVersionCheck', clear=True)
|
||||
|
||||
# Set min DB version
|
||||
|
|
Loading…
Reference in a new issue