add support for latest kodi 18 music db changes

This commit is contained in:
im85288 2017-11-04 14:08:12 +00:00
parent 8041273c05
commit 7be8c49b14
4 changed files with 79 additions and 8 deletions

View file

@ -198,6 +198,16 @@ class KodiMusic(KodiItems):
))
self.cursor.execute(query, (args))
def update_album_18(self, *args):
query = ' '.join((
"UPDATE album",
"SET strArtistsDisp = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iUserrating = ?, lastScraped = ?, strReleaseType = ?",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (args))
def update_album_17(self, *args):
query = ' '.join((
@ -246,11 +256,33 @@ class KodiMusic(KodiItems):
if curr_artists != artists:
self._update_album_artist(album_id, artists)
def get_album_artist_18(self, album_id, artists):
query = ' '.join((
"SELECT strArtistDisp",
"FROM album",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (album_id,))
try:
curr_artists = self.cursor.fetchone()[0]
except TypeError:
return
if curr_artists != artists:
self._update_album_artist_18(album_id, artists)
def _update_album_artist(self, album_id, artists):
query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?"
self.cursor.execute(query, (artists, album_id))
def _update_album_artist_18(self, album_id, artists):
query = "UPDATE album SET strArtistDisp = ? WHERE idAlbum = ?"
self.cursor.execute(query, (artists, album_id))
def add_single(self, *args):
query = (
'''
@ -295,6 +327,19 @@ class KodiMusic(KodiItems):
)
self.cursor.execute(query, (args))
def add_song_18(self, *args):
query = (
'''
INSERT INTO song(
idSong, idAlbum, idPath, strArtistDisp, strGenres, strTitle, iTrack,
iDuration, iYear, strFileName, strMusicBrainzTrackID, iTimesPlayed, lastplayed,
rating)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def update_song(self, *args):
query = ' '.join((
@ -306,6 +351,17 @@ class KodiMusic(KodiItems):
))
self.cursor.execute(query, (args))
def update_song_18(self, *args):
query = ' '.join((
"UPDATE song",
"SET idAlbum = ?, strArtistDisp = ?, strGenres = ?, strTitle = ?, iTrack = ?,",
"iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?,",
"rating = ?, comment = ?",
"WHERE idSong = ?"
))
self.cursor.execute(query, (args))
def link_song_artist(self, kodi_id, song_id, index, artist):
if self.kodi_version > 16: