diff --git a/pychromecast/controllers/plex.py b/pychromecast/controllers/plex.py index c3260df91..96089edf5 100644 --- a/pychromecast/controllers/plex.py +++ b/pychromecast/controllers/plex.py @@ -108,6 +108,8 @@ def media_to_chromecast_command( # pylint: disable=invalid-name, too-many-local dict: Returs a dict formatted correctly to start playback on a Chromecast. """ + machineIdentifier = None + token = None if media is not None: # Lets set some params for the user if they use plexapi. server: PlexServer = ( diff --git a/pychromecast/socket_client.py b/pychromecast/socket_client.py index 2b375b503..1d8eac10b 100644 --- a/pychromecast/socket_client.py +++ b/pychromecast/socket_client.py @@ -617,8 +617,6 @@ def _run_once(self) -> int: self.port, exc, ) - else: - data = _dict_from_message_payload(message) if self.wakeup_selector_key in can_read: # Clear the socket's buffer @@ -633,6 +631,7 @@ def _run_once(self) -> int: return 0 # See if any handlers will accept this message + data = _dict_from_message_payload(message) self._route_message(message, data) if REQUEST_ID in data and data[REQUEST_ID] in self._request_callbacks: