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
|
||||||
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]
|
|
||||||
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
|
# Episodes is a bit special, only get the thumb, because all
|
||||||
# the other artwork will be saved under season and show
|
# the other artwork will be saved under season and show
|
||||||
art = self._one_artwork('thumb')
|
art = self._one_artwork('thumb')
|
||||||
if art:
|
if art:
|
||||||
artworks['thumb'] = 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:
|
||||||
|
season_id = db_item[3]
|
||||||
|
except TypeError:
|
||||||
|
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
|
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