mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Merge pull request #490 from mcarlton00/recently-added-albums
Fix recently added albums in Kodi 19
This commit is contained in:
commit
83e7031da6
3 changed files with 17 additions and 2 deletions
|
@ -158,8 +158,10 @@ class Music(Kodi):
|
||||||
album_id = album_id or self.create_entry_album()
|
album_id = album_id or self.create_entry_album()
|
||||||
if self.version_id < 72:
|
if self.version_id < 72:
|
||||||
self.cursor.execute(QU.add_album, (album_id,) + args)
|
self.cursor.execute(QU.add_album, (album_id,) + args)
|
||||||
else:
|
elif self.version_id < 82:
|
||||||
self.cursor.execute(QU.add_album72, (album_id,) + args)
|
self.cursor.execute(QU.add_album72, (album_id,) + args)
|
||||||
|
else:
|
||||||
|
self.cursor.execute(QU.add_album82, (album_id,) + args)
|
||||||
return album_id
|
return album_id
|
||||||
|
|
||||||
def update_album(self, *args):
|
def update_album(self, *args):
|
||||||
|
|
|
@ -54,6 +54,7 @@ FROM album
|
||||||
WHERE strMusicBrainzAlbumID = ?
|
WHERE strMusicBrainzAlbumID = ?
|
||||||
"""
|
"""
|
||||||
get_album_obj = ["{AlbumId}", "{Title}", "{UniqueId}", "{Artists}", "album"]
|
get_album_obj = ["{AlbumId}", "{Title}", "{UniqueId}", "{Artists}", "album"]
|
||||||
|
get_album_obj82 = ["{AlbumId}", "{Title}", "{UniqueId}", "{Artists}", "album", "{DateAdded}"]
|
||||||
get_album_by_name = """
|
get_album_by_name = """
|
||||||
SELECT idAlbum, strArtists
|
SELECT idAlbum, strArtists
|
||||||
FROM album
|
FROM album
|
||||||
|
@ -100,6 +101,10 @@ add_album72 = """
|
||||||
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType, bScrapedMBID)
|
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType, bScrapedMBID)
|
||||||
VALUES (?, ?, ?, ?, 1)
|
VALUES (?, ?, ?, ?, 1)
|
||||||
"""
|
"""
|
||||||
|
add_album82 = """
|
||||||
|
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType, bScrapedMBID, DateAdded)
|
||||||
|
VALUES (?, ?, ?, ?, 1, ?)
|
||||||
|
"""
|
||||||
add_single = """
|
add_single = """
|
||||||
INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType)
|
INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
|
|
|
@ -153,6 +153,10 @@ class Music(KodiDb):
|
||||||
obj['Artists'] = " / ".join(obj['Artists'] or [])
|
obj['Artists'] = " / ".join(obj['Artists'] or [])
|
||||||
obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'ArtworkMusic'), True)
|
obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'ArtworkMusic'), True)
|
||||||
obj['Thumb'] = obj['Artwork']['Primary']
|
obj['Thumb'] = obj['Artwork']['Primary']
|
||||||
|
obj['DateAdded'] = item.get('DateCreated')
|
||||||
|
|
||||||
|
if obj['DateAdded']:
|
||||||
|
obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
|
||||||
|
|
||||||
if obj['Thumb']:
|
if obj['Thumb']:
|
||||||
obj['Thumb'] = "<thumb>%s</thumb>" % obj['Thumb']
|
obj['Thumb'] = "<thumb>%s</thumb>" % obj['Thumb']
|
||||||
|
@ -173,7 +177,11 @@ class Music(KodiDb):
|
||||||
|
|
||||||
''' Add object to kodi.
|
''' Add object to kodi.
|
||||||
'''
|
'''
|
||||||
obj['AlbumId'] = self.get_album(*values(obj, QU.get_album_obj))
|
if self.version_id >= 82:
|
||||||
|
obj_values = values(obj, QU.get_album_obj82)
|
||||||
|
else:
|
||||||
|
obj_values = values(obj, QU.get_album_obj)
|
||||||
|
obj['AlbumId'] = self.get_album(*obj_values)
|
||||||
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_album_obj))
|
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_album_obj))
|
||||||
LOG.debug("ADD album [%s] %s: %s", obj['AlbumId'], obj['Title'], obj['Id'])
|
LOG.debug("ADD album [%s] %s: %s", obj['AlbumId'], obj['Title'], obj['Id'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue