Handle Plex Live TV sessions (#36919)

This commit is contained in:
jjlawren authored and GitHub committed 2020-06-19 17:12:47 +02:00
1 parent e4df0481da
commit d445c16697
3 files changed
+33 -12

No files matched your search

+9 -4
View File
@@ -87,14 +87,19 @@ class PlexSensor(Entity):
# "Supernatural (2005) - s01e13 - Route 666"
def sync_io_attributes(session):
return (session.show(), session.seasonEpisode)
year = None
try:
year = session.show().year
except TypeError:
pass
return (year, session.seasonEpisode)
show, season_episode = await self.hass.async_add_executor_job(
year, season_episode = await self.hass.async_add_executor_job(
sync_io_attributes, sess
)
season_title = sess.grandparentTitle
if show.year is not None:
season_title += f" ({show.year!s})"
if year is not None:
season_title += f" ({year!s})"
episode_title = sess.title
now_playing_title = (
f"{season_title} - {season_episode} - {episode_title}"