Grab existing Kodi artwork for episodes
This commit is contained in:
parent
4d2b040c08
commit
19770240aa
2 changed files with 27 additions and 17 deletions
|
@ -754,28 +754,35 @@ class API(object):
|
||||||
artworks = {}
|
artworks = {}
|
||||||
if self.plex_type() == v.PLEX_TYPE_EPISODE:
|
if self.plex_type() == v.PLEX_TYPE_EPISODE:
|
||||||
# Artwork lookup for episodes is broken for addon paths
|
# 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:
|
if full_artwork:
|
||||||
with plexdb.Get_Plex_DB() as plex_db:
|
with plexdb.Get_Plex_DB() as plex_db:
|
||||||
db_item = plex_db.getItem_byId(self.plex_id())
|
db_item = plex_db.getItem_byId(self.plex_id())
|
||||||
try:
|
try:
|
||||||
kodi_id = db_item[0]
|
season_id = db_item[3]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
return artworks
|
||||||
else:
|
# Grab artwork from the season
|
||||||
with kodidb.GetKodiDB('video') as kodi_db:
|
with kodidb.GetKodiDB('video') as kodi_db:
|
||||||
return kodi_db.get_art(kodi_id, v.KODI_TYPE_EPISODE)
|
season_art = kodi_db.get_art(season_id, v.KODI_TYPE_SEASON)
|
||||||
# If episode is not in Kodi DB
|
for kodi_art in season_art:
|
||||||
for kodi_artwork, plex_artwork \
|
artworks['season.%s' % kodi_art] = season_art[kodi_art]
|
||||||
in v.KODI_TO_PLEX_ARTWORK_EPISODE.iteritems():
|
# Get the show id
|
||||||
art = self._one_artwork(plex_artwork)
|
with plexdb.Get_Plex_DB() as plex_db:
|
||||||
if art:
|
db_item = plex_db.getItem_byId(self.grandparent_id())
|
||||||
artworks[kodi_artwork] = art
|
try:
|
||||||
else:
|
show_id = db_item[0]
|
||||||
# Episodes is a bit special, only get the thumb, because all
|
except TypeError:
|
||||||
# the other artwork will be saved under season and show
|
return artworks
|
||||||
art = self._one_artwork('thumb')
|
# Grab more artwork from the show
|
||||||
if art:
|
with kodidb.GetKodiDB('video') as kodi_db:
|
||||||
artworks['thumb'] = art
|
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
|
return artworks
|
||||||
|
|
||||||
if kodi_id:
|
if kodi_id:
|
||||||
|
|
|
@ -215,6 +215,9 @@ def _prep_playlist_stack(xml):
|
||||||
# We will never store clips (trailers) in the Kodi DB.
|
# We will never store clips (trailers) in the Kodi DB.
|
||||||
# Also set kodi_id to None for playback via PMS, so that we're
|
# Also set kodi_id to None for playback via PMS, so that we're
|
||||||
# using add-on paths.
|
# 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_id = None
|
||||||
kodi_type = None
|
kodi_type = None
|
||||||
for part, _ in enumerate(item[0]):
|
for part, _ in enumerate(item[0]):
|
||||||
|
|
Loading…
Reference in a new issue