Wrap possible I/O in executor (#37688)

pull/37801/head
jjlawren 2020-07-12 17:09:47 -05:00 committed by GitHub
parent 6fe54e31cc
commit 5c28919fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -116,8 +116,9 @@ class PlexSensor(Entity):
# "picture_of_last_summer_camp (2015)"
# "The Incredible Hulk (2008)"
now_playing_title = sess.title
if sess.year is not None:
now_playing_title += f" ({sess.year})"
year = await self.hass.async_add_executor_job(getattr, sess, "year")
if year is not None:
now_playing_title += f" ({year})"
now_playing.append((now_playing_user, now_playing_title))
self._state = len(self.sessions)