From b74986f9c34b58f25b4f7e08f07626c4b91d52ba Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 17 Apr 2022 19:45:10 -1000 Subject: [PATCH] Avoid importing distutils in plex (#70203) --- homeassistant/components/plex/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/plex/models.py b/homeassistant/components/plex/models.py index 0b77f450e7e..ffb6f791419 100644 --- a/homeassistant/components/plex/models.py +++ b/homeassistant/components/plex/models.py @@ -1,5 +1,4 @@ """Models to represent various Plex objects used in the integration.""" -from distutils.util import strtobool import logging from homeassistant.components.media_player.const import ( @@ -8,6 +7,7 @@ from homeassistant.components.media_player.const import ( MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO, ) +from homeassistant.helpers.template import result_as_boolean from homeassistant.util import dt as dt_util LIVE_TV_SECTION = "Live TV" @@ -162,7 +162,7 @@ class PlexMediaSearchResult: return offset * 1000 resume = self._params.get("resume", False) if isinstance(resume, str): - resume = bool(strtobool(resume)) + resume = result_as_boolean(resume) if resume: return self.media.viewOffset return 0 @@ -172,5 +172,5 @@ class PlexMediaSearchResult: """Return value of shuffle parameter.""" shuffle = self._params.get("shuffle", False) if isinstance(shuffle, str): - shuffle = bool(strtobool(shuffle)) + shuffle = result_as_boolean(shuffle) return shuffle