Use api method for parent id

This commit is contained in:
croneter 2018-03-10 14:53:39 +01:00
parent 44073a3201
commit 04f94f0828

View file

@ -745,7 +745,7 @@ class TVShows(Items):
artwork = self.artwork artwork = self.artwork
seasonnum = api.season_number() seasonnum = api.season_number()
# Get parent tv show Plex id # Get parent tv show Plex id
plexshowid = item.attrib.get('parentRatingKey') plexshowid = api.parent_plex_id()
# Get Kodi showid # Get Kodi showid
plex_dbitem = plex_db.getItem_byId(plexshowid) plex_dbitem = plex_db.getItem_byId(plexshowid)
try: try:
@ -1473,7 +1473,7 @@ class Music(Items):
studio, albumid)) studio, albumid))
# Associate the parentid for plex reference # Associate the parentid for plex reference
parent_id = item.attrib.get('parentRatingKey') parent_id = api.parent_plex_id()
if parent_id is not None: if parent_id is not None:
plex_dbartist = plex_db.getItem_byId(parent_id) plex_dbartist = plex_db.getItem_byId(parent_id)
try: try:
@ -1674,8 +1674,7 @@ class Music(Items):
try: try:
# Get the album # Get the album
plex_dbalbum = plex_db.getItem_byId( plex_dbalbum = plex_db.getItem_byId(api.parent_plex_id())
item.attrib.get('parentRatingKey'))
albumid = plex_dbalbum[0] albumid = plex_dbalbum[0]
except KeyError: except KeyError:
# Verify if there's an album associated. # Verify if there's an album associated.
@ -1700,7 +1699,7 @@ class Music(Items):
except TypeError: except TypeError:
# No album found. Let's create it # No album found. Let's create it
LOG.info("Album database entry missing.") LOG.info("Album database entry missing.")
plex_album_id = item.attrib.get('parentRatingKey') plex_album_id = api.parent_plex_id()
album = GetPlexMetadata(plex_album_id) album = GetPlexMetadata(plex_album_id)
if album is None or album == 401: if album is None or album == 401:
LOG.error('Could not download album, abort') LOG.error('Could not download album, abort')