Prevent Pandora component from crashing or hanging during shutdown. (#4255)
* Prevent Pandora component from crashing or hanging during shutdown. * Update pandora.py * Update pandora.pypull/4364/merge
parent
801a69be3a
commit
ec8969351d
|
@ -120,7 +120,7 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
||||||
self.update_playing_status()
|
self.update_playing_status()
|
||||||
|
|
||||||
self._player_state = STATE_IDLE
|
self._player_state = STATE_IDLE
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self):
|
||||||
"""Turn the media player off."""
|
"""Turn the media player off."""
|
||||||
|
@ -138,24 +138,24 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
||||||
_LOGGER.info('Killed Pianobar subprocess')
|
_LOGGER.info('Killed Pianobar subprocess')
|
||||||
self._pianobar = None
|
self._pianobar = None
|
||||||
self._player_state = STATE_OFF
|
self._player_state = STATE_OFF
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def media_play(self):
|
def media_play(self):
|
||||||
"""Send play command."""
|
"""Send play command."""
|
||||||
self._send_pianobar_command(SERVICE_MEDIA_PLAY_PAUSE)
|
self._send_pianobar_command(SERVICE_MEDIA_PLAY_PAUSE)
|
||||||
self._player_state = STATE_PLAYING
|
self._player_state = STATE_PLAYING
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def media_pause(self):
|
def media_pause(self):
|
||||||
"""Send pause command."""
|
"""Send pause command."""
|
||||||
self._send_pianobar_command(SERVICE_MEDIA_PLAY_PAUSE)
|
self._send_pianobar_command(SERVICE_MEDIA_PLAY_PAUSE)
|
||||||
self._player_state = STATE_PAUSED
|
self._player_state = STATE_PAUSED
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def media_next_track(self):
|
def media_next_track(self):
|
||||||
"""Go to next track."""
|
"""Go to next track."""
|
||||||
self._send_pianobar_command(SERVICE_MEDIA_NEXT_TRACK)
|
self._send_pianobar_command(SERVICE_MEDIA_NEXT_TRACK)
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_media_commands(self):
|
def supported_media_commands(self):
|
||||||
|
@ -350,6 +350,8 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
||||||
pass
|
pass
|
||||||
except pexpect.exceptions.TIMEOUT:
|
except pexpect.exceptions.TIMEOUT:
|
||||||
pass
|
pass
|
||||||
|
except pexpect.exceptions.EOF:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _pianobar_exists():
|
def _pianobar_exists():
|
||||||
|
|
Loading…
Reference in New Issue