def update(self):
        """Retrieve latest state."""
        self._players = self._get_players()

        if self._players is not None and len(self._players) > 0:
            player_id = self._players[0]['playerid']

            assert isinstance(player_id, int)

            self._properties = self._server.Player.GetProperties(
                player_id,
                ['time', 'totaltime', 'speed']
            )

            self._item = self._server.Player.GetItem(
                player_id,
                ['title', 'file', 'uniqueid', 'thumbnail', 'artist']
            )['item']

            self._app_properties = self._server.Application.GetProperties(
                ['volume', 'muted']
            )
        else:
            self._properties = None
            self._item = None
            self._app_properties = None
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/media_player/kodi.py/KodiDevice.update/original