mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move imports in pandora component (#28045)
This commit is contained in:
parent
fb79c45645
commit
bbc71441a1
@ -6,6 +6,8 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
|
import pexpect
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerDevice
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
@ -104,8 +106,6 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
|||||||
|
|
||||||
def turn_on(self):
|
def turn_on(self):
|
||||||
"""Turn the media player on."""
|
"""Turn the media player on."""
|
||||||
import pexpect
|
|
||||||
|
|
||||||
if self._player_state != STATE_OFF:
|
if self._player_state != STATE_OFF:
|
||||||
return
|
return
|
||||||
self._pianobar = pexpect.spawn("pianobar")
|
self._pianobar = pexpect.spawn("pianobar")
|
||||||
@ -136,8 +136,6 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
|||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self):
|
||||||
"""Turn the media player off."""
|
"""Turn the media player off."""
|
||||||
import pexpect
|
|
||||||
|
|
||||||
if self._pianobar is None:
|
if self._pianobar is None:
|
||||||
_LOGGER.info("Pianobar subprocess already stopped")
|
_LOGGER.info("Pianobar subprocess already stopped")
|
||||||
return
|
return
|
||||||
@ -226,8 +224,6 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
|||||||
|
|
||||||
def _send_station_list_command(self):
|
def _send_station_list_command(self):
|
||||||
"""Send a station list command."""
|
"""Send a station list command."""
|
||||||
import pexpect
|
|
||||||
|
|
||||||
self._pianobar.send("s")
|
self._pianobar.send("s")
|
||||||
try:
|
try:
|
||||||
self._pianobar.expect("Select station:", timeout=1)
|
self._pianobar.expect("Select station:", timeout=1)
|
||||||
@ -248,8 +244,6 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
|||||||
|
|
||||||
def _query_for_playing_status(self):
|
def _query_for_playing_status(self):
|
||||||
"""Query system for info about current track."""
|
"""Query system for info about current track."""
|
||||||
import pexpect
|
|
||||||
|
|
||||||
self._clear_buffer()
|
self._clear_buffer()
|
||||||
self._pianobar.send("i")
|
self._pianobar.send("i")
|
||||||
try:
|
try:
|
||||||
@ -372,8 +366,6 @@ class PandoraMediaPlayer(MediaPlayerDevice):
|
|||||||
This is necessary because there are a bunch of 00:00 in the buffer
|
This is necessary because there are a bunch of 00:00 in the buffer
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pexpect
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while not self._pianobar.expect(".+", timeout=0.1):
|
while not self._pianobar.expect(".+", timeout=0.1):
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user