Merge pull request #325 from z3ntu/kodi-19-music

Add support for music database format v74
This commit is contained in:
Odd Stråbø 2020-07-23 00:38:46 +02:00 committed by GitHub
commit c9d3e7470b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 4 deletions

View File

@ -160,8 +160,10 @@ class Music(Kodi):
def update_album(self, *args):
if self.version_id < 72:
self.cursor.execute(QU.update_album, args)
else:
elif self.version_id < 74:
self.cursor.execute(QU.update_album72, args)
else:
self.cursor.execute(QU.update_album74, args)
def get_album_artist(self, album_id, artists):
@ -184,19 +186,26 @@ class Music(Kodi):
self.cursor.execute(QU.update_album_artist72, args)
def add_single(self, *args):
if self.version_id < 74:
self.cursor.execute(QU.add_single, args)
else:
self.cursor.execute(QU.add_single74, args)
def add_song(self, *args):
if self.version_id < 72:
self.cursor.execute(QU.add_song, args)
else:
elif self.version_id < 74:
self.cursor.execute(QU.add_song72, args)
else:
self.cursor.execute(QU.add_song74, args)
def update_song(self, *args):
if self.version_id < 72:
self.cursor.execute(QU.update_song, args)
else:
elif self.version_id < 74:
self.cursor.execute(QU.update_song72, args)
else:
self.cursor.execute(QU.update_song74, args)
def link_song_artist(self, *args):
self.cursor.execute(QU.update_song_artist, args)

View File

@ -104,6 +104,10 @@ add_single = """
INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType)
VALUES (?, ?, ?, ?)
"""
add_single74 = """
INSERT INTO album(idAlbum, strGenres, strReleaseDate, strReleaseType)
VALUES (?, ?, ?, ?)
"""
add_single_obj = ["{AlbumId}", "{Genre}", "{Year}", "single"]
add_song = """
INSERT INTO song(idSong, idAlbum, idPath, strArtists, strGenres, strTitle, iTrack,
@ -117,6 +121,12 @@ INSERT INTO song(idSong, idAlbum, idPath, strArtistDisp, strGenres, strTitle
rating, comment, dateAdded)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_song74 = """
INSERT INTO song(idSong, idAlbum, idPath, strArtistDisp, strGenres, strTitle, iTrack,
iDuration, strReleaseDate, strFileName, strMusicBrainzTrackID, iTimesPlayed, lastplayed,
rating, comment, dateAdded)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_song_obj = ["{SongId}", "{AlbumId}", "{PathId}", "{Artists}", "{Genre}", "{Title}", "{Index}",
"{Runtime}", "{Year}", "{Filename}", "{UniqueId}", "{PlayCount}", "{DatePlayed}", "{Rating}",
"{Comment}", "{DateAdded}"]
@ -171,6 +181,12 @@ SET strArtistDisp = ?, iYear = ?, strGenres = ?, strReview = ?, strImage
iUserrating = ?, lastScraped = ?, bScrapedMBID = 1, strReleaseType = ?
WHERE idAlbum = ?
"""
update_album74 = """
UPDATE album
SET strArtistDisp = ?, strReleaseDate = ?, strGenres = ?, strReview = ?, strImage = ?,
iUserrating = ?, lastScraped = ?, bScrapedMBID = 1, strReleaseType = ?
WHERE idAlbum = ?
"""
update_album_obj = ["{Artists}", "{Year}", "{Genre}", "{Bio}", "{Thumb}", "{Rating}", "{LastScraped}", "album", "{AlbumId}"]
update_album_artist = """
UPDATE album
@ -196,6 +212,13 @@ SET idAlbum = ?, strArtistDisp = ?, strGenres = ?, strTitle = ?, iTrack
rating = ?, comment = ?, dateAdded = ?
WHERE idSong = ?
"""
update_song74 = """
UPDATE song
SET idAlbum = ?, strArtistDisp = ?, strGenres = ?, strTitle = ?, iTrack = ?,
iDuration = ?, strReleaseDate = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?,
rating = ?, comment = ?, dateAdded = ?
WHERE idSong = ?
"""
update_song_obj = ["{AlbumId}", "{Artists}", "{Genre}", "{Title}", "{Index}", "{Runtime}", "{Year}",
"{Filename}", "{PlayCount}", "{DatePlayed}", "{Rating}", "{Comment}",
"{DateAdded}", "{SongId}"]