Music: scrape Studio/Label

This commit is contained in:
tomkat83 2016-03-28 09:56:22 +02:00
parent fb1bc7c555
commit 2ff7f7fa5c
2 changed files with 19 additions and 9 deletions

View file

@ -1801,6 +1801,9 @@ class API():
""" """
return self.item.attrib.get('originallyAvailableAt', None) return self.item.attrib.get('originallyAvailableAt', None)
def getMusicStudio(self):
return self.item.attrib.get('studio', '')
def getStudios(self): def getStudios(self):
""" """
Returns a list with a single entry for the studio, or an empty list Returns a list with a single entry for the studio, or an empty list

View file

@ -1820,6 +1820,7 @@ class Music(Items):
genre = API.joinList(genres) genre = API.joinList(genres)
bio = API.getPlot() bio = API.getPlot()
rating = userdata['UserRating'] rating = userdata['UserRating']
studio = API.getMusicStudio()
# artists = item['AlbumArtists'] # artists = item['AlbumArtists']
# if not artists: # if not artists:
# artists = item['ArtistItems'] # artists = item['ArtistItems']
@ -1862,45 +1863,51 @@ class Music(Items):
"UPDATE album", "UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,", "SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iUserrating = ?, lastScraped = ?, strReleaseType = ?", "iUserrating = ?, lastScraped = ?, strReleaseType = ?, "
"strLabel = ? ",
"WHERE idAlbum = ?" "WHERE idAlbum = ?"
)) ))
kodicursor.execute(query, (artistname, year, genre, bio, thumb, kodicursor.execute(query, (artistname, year, genre, bio, thumb,
rating, lastScraped, "album", albumid)) rating, lastScraped, "album", studio,
albumid))
elif kodiversion == 16: elif kodiversion == 16:
# Kodi Jarvis # Kodi Jarvis
query = ' '.join(( query = ' '.join((
"UPDATE album", "UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,", "SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iRating = ?, lastScraped = ?, strReleaseType = ?", "iRating = ?, lastScraped = ?, strReleaseType = ?, "
"strLabel = ? ",
"WHERE idAlbum = ?" "WHERE idAlbum = ?"
)) ))
kodicursor.execute(query, (artistname, year, genre, bio, thumb, kodicursor.execute(query, (artistname, year, genre, bio, thumb,
rating, lastScraped, "album", albumid)) rating, lastScraped, "album", studio,
albumid))
elif kodiversion == 15: elif kodiversion == 15:
# Kodi Isengard # Kodi Isengard
query = ' '.join(( query = ' '.join((
"UPDATE album", "UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,", "SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iRating = ?, lastScraped = ?, dateAdded = ?, strReleaseType = ?", "iRating = ?, lastScraped = ?, dateAdded = ?, "
"strReleaseType = ?, strLabel = ? ",
"WHERE idAlbum = ?" "WHERE idAlbum = ?"
)) ))
kodicursor.execute(query, (artistname, year, genre, bio, thumb, kodicursor.execute(query, (artistname, year, genre, bio, thumb,
rating, lastScraped, dateadded, rating, lastScraped, dateadded,
"album", albumid)) "album", studio, albumid))
else: else:
# Kodi Helix # Kodi Helix
query = ' '.join(( query = ' '.join((
"UPDATE album", "UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,", "SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iRating = ?, lastScraped = ?, dateAdded = ?", "iRating = ?, lastScraped = ?, dateAdded = ?, "
"strLabel = ? ",
"WHERE idAlbum = ?" "WHERE idAlbum = ?"
)) ))
kodicursor.execute(query, (artistname, year, genre, bio, thumb, kodicursor.execute(query, (artistname, year, genre, bio, thumb,
rating, lastScraped, dateadded, rating, lastScraped, dateadded, studio,
albumid)) albumid))
# Associate the parentid for emby reference # Associate the parentid for emby reference
@ -1914,7 +1921,7 @@ class Music(Items):
% parentId, 1) % parentId, 1)
artist = GetPlexMetadata(parentId) artist = GetPlexMetadata(parentId)
# Item may not be an artist, verification necessary. # Item may not be an artist, verification necessary.
if artist: if artist is not None:
if artist[0].attrib.get('type') == "artist": if artist[0].attrib.get('type') == "artist":
# Update with the parentId, for remove reference # Update with the parentId, for remove reference
emby_db.addReference( emby_db.addReference(