Music and parentid changes

Verify for artists on albums without musicbrainzid with same name
This commit is contained in:
angelblue05 2018-09-13 02:08:30 -05:00
parent eb83cfb6a4
commit dc7cfd54c3
4 changed files with 26 additions and 18 deletions

View file

@ -121,14 +121,18 @@ class Music(Kodi):
except TypeError:
return
def get_album(self, album_id, name, musicbrainz, *args):
if musicbrainz is not None:
self.cursor.execute(QU.get_album, (musicbrainz,))
else:
self.cursor.execute(QU.get_album_by_name, (name,))
def get_album(self, album_id, name, musicbrainz, artists=None, *args):
try:
if musicbrainz is not None:
self.cursor.execute(QU.get_album, (musicbrainz,))
else:
self.cursor.execute(QU.get_album_by_name, (name,))
album = self.cursor.fetchone()
if album[1] and album[1] not in artists.split(' / '):
raise TypeError
album_id = self.cursor.fetchone()[0]
except TypeError:
album_id = self.add_album(*(album_id, name, musicbrainz,) + args)

View file

@ -47,9 +47,9 @@ get_album = """ SELECT idAlbum
FROM album
WHERE strMusicBrainzAlbumID = ?
"""
get_album_obj = [ "{AlbumId}","{Title}","{UniqueId}","album"
get_album_obj = [ "{AlbumId}","{Title}","{UniqueId}","{Artists}","album"
]
get_album_by_name = """ SELECT idAlbum
get_album_by_name = """ SELECT idAlbum, strArtists
FROM album
WHERE strAlbum = ?
"""

View file

@ -167,9 +167,6 @@ class Music(KodiDb):
def album_add(self, obj):
''' Add object to kodi.
safety checks: It looks like Emby supports the same artist multiple times.
Kodi doesn't allow that. In case that happens we just merge the artist entries.
'''
obj['AlbumId'] = self.get_album(*values(obj, QU.get_album_obj))
self.emby_db.add_reference(*values(obj, QUEM.add_reference_album_obj))

View file

@ -39,7 +39,8 @@
"Subtitles": "MediaSources/0/MediaStreams:?Type=Subtitle$Language",
"Audio": "MediaSources/0/MediaStreams:?Type=Audio",
"Video": "MediaSources/0/MediaStreams:?Type=Video",
"Container": "MediaSources/0/Container"
"Container": "MediaSources/0/Container",
"EmbyParentId": "ParentId"
},
"MovieUserData": {
"Id": "Id",
@ -74,7 +75,8 @@
"Studios": "Studios:?$Name",
"Tags": "Tags",
"Favorite": "UserData/IsFavorite",
"RecursiveCount": "RecursiveItemCount"
"RecursiveCount": "RecursiveItemCount",
"EmbyParentId": "ParentId"
},
"Season": {
"Id": "Id",
@ -114,7 +116,8 @@
"Audio": "MediaSources/0/MediaStreams:?Type=Audio",
"Video": "MediaSources/0/MediaStreams:?Type=Video",
"Container": "MediaSources/0/Container",
"Location": "LocationType"
"Location": "LocationType",
"EmbyParentId": "ParentId"
},
"EpisodeUserData": {
"Id": "Id",
@ -154,7 +157,8 @@
"Tags": "Tags",
"Played": "UserData/Played",
"Favorite": "UserData/IsFavorite",
"Directors": "People:?Type=Director$Name"
"Directors": "People:?Type=Director$Name",
"EmbyParentId": "ParentId"
},
"MusicVideoUserData": {
"Id": "Id",
@ -170,7 +174,8 @@
"Name": "Name",
"UniqueId": "ProviderIds/MusicBrainzArtist",
"Genres": "Genres",
"Bio": "Overview"
"Bio": "Overview",
"EmbyParentId": "ParentId"
},
"Album": {
"Id": "Id",
@ -181,7 +186,8 @@
"Bio": "Overview",
"AlbumArtists": "AlbumArtists",
"Artists": "AlbumArtists:?$Name",
"ArtistItems": "ArtistItems"
"ArtistItems": "ArtistItems",
"EmbyParentId": "ParentId"
},
"Song": {
"Id": "Id",
@ -203,7 +209,8 @@
"AlbumArtists": "AlbumArtists",
"Album": "Album",
"SongAlbumId": "AlbumId",
"Container": "MediaSources/0/Container"
"Container": "MediaSources/0/Container",
"EmbyParentId": "ParentId"
},
"SongUserData": {
"Id": "Id",