diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index e5dfd50b..560e85e8 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -754,28 +754,35 @@ class API(object): artworks = {} if self.plex_type() == v.PLEX_TYPE_EPISODE: # Artwork lookup for episodes is broken for addon paths + # Episodes is a bit special, only get the thumb, because all + # the other artwork will be saved under season and show + art = self._one_artwork('thumb') + if art: + artworks['thumb'] = art if full_artwork: with plexdb.Get_Plex_DB() as plex_db: db_item = plex_db.getItem_byId(self.plex_id()) try: - kodi_id = db_item[0] + season_id = db_item[3] except TypeError: - pass - else: - with kodidb.GetKodiDB('video') as kodi_db: - return kodi_db.get_art(kodi_id, v.KODI_TYPE_EPISODE) - # If episode is not in Kodi DB - for kodi_artwork, plex_artwork \ - in v.KODI_TO_PLEX_ARTWORK_EPISODE.iteritems(): - art = self._one_artwork(plex_artwork) - if art: - artworks[kodi_artwork] = art - else: - # Episodes is a bit special, only get the thumb, because all - # the other artwork will be saved under season and show - art = self._one_artwork('thumb') - if art: - artworks['thumb'] = art + return artworks + # Grab artwork from the season + with kodidb.GetKodiDB('video') as kodi_db: + season_art = kodi_db.get_art(season_id, v.KODI_TYPE_SEASON) + for kodi_art in season_art: + artworks['season.%s' % kodi_art] = season_art[kodi_art] + # Get the show id + with plexdb.Get_Plex_DB() as plex_db: + db_item = plex_db.getItem_byId(self.grandparent_id()) + try: + show_id = db_item[0] + except TypeError: + return artworks + # Grab more artwork from the show + with kodidb.GetKodiDB('video') as kodi_db: + show_art = kodi_db.get_art(show_id, v.KODI_TYPE_SHOW) + for kodi_art in show_art: + artworks['tvshow.%s' % kodi_art] = show_art[kodi_art] return artworks if kodi_id: diff --git a/resources/lib/playback.py b/resources/lib/playback.py index 2973c5a6..60db0262 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -215,6 +215,9 @@ def _prep_playlist_stack(xml): # We will never store clips (trailers) in the Kodi DB. # Also set kodi_id to None for playback via PMS, so that we're # using add-on paths. + # Also do NOT associate episodes with library items for addon paths + # as artwork lookup is broken (episode path does not link back to + # season and show) kodi_id = None kodi_type = None for part, _ in enumerate(item[0]):