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,30 +323,48 @@ class WriteKodiMusicDB():
|
||||||
albumid = cursor.fetchone()[0] + 1
|
albumid = cursor.fetchone()[0] + 1
|
||||||
if kodiVersion == 15:
|
if kodiVersion == 15:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?)"
|
query = "INSERT INTO album(idAlbum, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?)"
|
||||||
cursor.execute(query, (albumid, artists, genre, year, dateadded, "single"))
|
cursor.execute(query, (albumid, genre, year, dateadded, "single"))
|
||||||
elif kodiVersion == 16:
|
elif kodiVersion == 16:
|
||||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, strReleaseType) values(?, ?, ?, ?, ?)"
|
query = "INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType) values(?, ?, ?, ?)"
|
||||||
cursor.execute(query, (albumid, artists, genre, year, "single"))
|
cursor.execute(query, (albumid, genre, year, "single"))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham and Helix
|
# Kodi Gotham and Helix
|
||||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded) values(?, ?, ?, ?, ?)"
|
query = "INSERT INTO album(idAlbum, strGenres, iYear, dateAdded) values(?, ?, ?, ?)"
|
||||||
cursor.execute(query, (albumid, artists, genre, year, dateadded))
|
cursor.execute(query, (albumid, genre, year, dateadded))
|
||||||
finally:
|
finally:
|
||||||
# Link album to artists
|
cursor.execute("SELECT strArtists FROM album WHERE idAlbum = ?", (albumid,))
|
||||||
if MBitem['AlbumArtists']:
|
result = cursor.fetchone()
|
||||||
album_artists = MBitem['AlbumArtists']
|
if result and result[0] == "":
|
||||||
else:
|
# Link album to artists
|
||||||
album_artists = MBitem['ArtistItems']
|
if MBitem['AlbumArtists']:
|
||||||
|
album_artists = MBitem['AlbumArtists']
|
||||||
for artist in album_artists:
|
|
||||||
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?", (artist['Id'],))
|
|
||||||
try:
|
|
||||||
artistid = cursor.fetchone()[0]
|
|
||||||
except: pass
|
|
||||||
else:
|
else:
|
||||||
query = "INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist) values(?, ?, ?)"
|
album_artists = MBitem['ArtistItems']
|
||||||
cursor.execute(query, (artistid, albumid, artist['Name']))
|
|
||||||
|
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]
|
||||||
|
except: pass
|
||||||
|
else:
|
||||||
|
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 #####
|
##### UPDATE THE SONG #####
|
||||||
|
|
|
@ -70,6 +70,7 @@ class Service():
|
||||||
utils.window('Server_status', clear=True)
|
utils.window('Server_status', clear=True)
|
||||||
utils.window('startup', clear=True)
|
utils.window('startup', clear=True)
|
||||||
utils.window('OnWakeSync', clear=True)
|
utils.window('OnWakeSync', clear=True)
|
||||||
|
utils.window('kodiScan', clear=True)
|
||||||
utils.window('minDBVersionCheck', clear=True)
|
utils.window('minDBVersionCheck', clear=True)
|
||||||
|
|
||||||
# Set min DB version
|
# Set min DB version
|
||||||
|
|
Loading…
Reference in a new issue