Music support for Leia

This commit is contained in:
angelblue05 2018-03-07 16:53:24 -06:00
parent 76dde9f8dd
commit 307bb772b3
3 changed files with 40 additions and 54 deletions

View file

@ -25,10 +25,6 @@ KODI = xbmc.getInfoLabel('System.BuildVersion')[:2]
def video_database():
db_version = {
'13': 78, # Gotham
'14': 90, # Helix
'15': 93, # Isengard
'16': 99, # Jarvis
'17': 107,# Krypton
'18': 109 # Leia
}
@ -38,12 +34,8 @@ def video_database():
def music_database():
db_version = {
'13': 46, # Gotham
'14': 48, # Helix
'15': 52, # Isengard
'16': 56, # Jarvis
'17': 60, # Krypton
'18': 68 # Leia
'18': 70 # Leia
}
return xbmc.translatePath("special://database/MyMusic%s.db"
% db_version.get(KODI, "")).decode('utf-8')

View file

@ -131,6 +131,16 @@ class KodiMusic(KodiItems):
))
self.cursor.execute(query, (args))
def update_artist_18(self, *args):
query = ' '.join((
"UPDATE artist",
"SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?,",
"lastScraped = ?",
"WHERE idArtist = ?"
))
self.cursor.execute(query, (args))
def link_artist(self, kodi_id, album_id, name):
query = (
'''
@ -168,7 +178,6 @@ class KodiMusic(KodiItems):
def _add_album(self, name, musicbrainz):
album_id = self.create_entry_album()
if self.kodi_version > 14:
query = (
'''
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType)
@ -176,15 +185,6 @@ class KodiMusic(KodiItems):
'''
)
self.cursor.execute(query, (album_id, name, musicbrainz, "album"))
else:
# TODO: Remove Helix code when Krypton is RC
query = (
'''
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID)
VALUES (?, ?, ?)
'''
)
self.cursor.execute(query, (album_id, name, musicbrainz))
return album_id
@ -192,7 +192,17 @@ class KodiMusic(KodiItems):
query = ' '.join((
"UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"SET strArtist = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iUserrating = ?, lastScraped = ?, strReleaseType = ?",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (args))
def update_album_18(self, *args):
query = ' '.join((
"UPDATE album",
"SET strArtistDisp = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iUserrating = ?, lastScraped = ?, strReleaseType = ?",
"WHERE idAlbum = ?"
))
@ -252,27 +262,6 @@ class KodiMusic(KodiItems):
)
self.cursor.execute(query, (args))
def add_single_15(self, *args):
query = (
'''
INSERT INTO album(idAlbum, strGenres, iYear, dateAdded, strReleaseType)
VALUES (?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def add_single_14(self, *args):
# TODO: Remove Helix code when Krypton is RC
query = (
'''
INSERT INTO album(idAlbum, strGenres, iYear, dateAdded)
VALUES (?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def add_song(self, *args):
query = (
'''

View file

@ -234,10 +234,10 @@ class Music(Items):
emby_db.addReference(itemid, artistid, artisttype, "artist", checksum=checksum)
# Process the artist
if self.kodi_version > 15:
self.kodi_db.update_artist_16(genres, bio, thumb, fanart, lastScraped, artistid)
else:
if self.kodi_version > 18:
self.kodi_db.update_artist(genres, bio, thumb, fanart, lastScraped, dateadded, artistid)
else:
self.kodi_db.update_artist_18(genres, bio, thumb, fanart, lastScraped, artistid)
# Update artwork
artwork.add_artwork(artworks, artistid, "artist", kodicursor)
@ -303,8 +303,12 @@ class Music(Items):
emby_db.addReference(itemid, albumid, "MusicAlbum", "album", checksum=checksum)
# Process the album info
if self.kodi_version > 18:
self.kodi_db.update_album(artistname, year, genre, bio, thumb, rating, lastScraped,
"album", albumid)
else:
self.kodi_db.update_album_18(artistname, year, genre, bio, thumb, rating, lastScraped,
"album", albumid)
# Assign main artists to album
for artist in item['AlbumArtists']:
@ -340,6 +344,7 @@ class Music(Items):
self.kodi_db.add_discography(artistid, name, year)
# Add genres
if self.kodi_version > 18:
self.kodi_db.add_genres(albumid, genres, "album")
# Update artwork
artwork.add_artwork(artworks, albumid, "album", kodicursor)