Handle Plex Live TV sessions (#36919)

This commit is contained in:
jjlawren 2020-06-19 10:12:47 -05:00 committed by GitHub
parent e4df0481da
commit d445c16697
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 12 deletions

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}"