updates
This commit is contained in:
@@ -9,14 +9,8 @@ from ..reconnecting_client import ReconnectingClient
|
||||
from .radio import find_local_radio_url_by_name, fill_station_cache_async
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
MediaPlayerEntity, PLATFORM_SCHEMA)
|
||||
from homeassistant.components.media_player.const import (
|
||||
ATTR_MEDIA_ENQUEUE, DOMAIN, MEDIA_TYPE_MUSIC,
|
||||
SUPPORT_CLEAR_PLAYLIST, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE,
|
||||
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, SUPPORT_SEEK,
|
||||
SUPPORT_SHUFFLE_SET, SUPPORT_REPEAT_SET, SUPPORT_TURN_OFF, SUPPORT_TURN_ON,
|
||||
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, REPEAT_MODE_ALL, REPEAT_MODE_OFF,
|
||||
REPEAT_MODE_ONE,)
|
||||
MediaPlayerEntity, PLATFORM_SCHEMA, MediaType, RepeatMode, ATTR_MEDIA_ENQUEUE)
|
||||
from homeassistant.components.media_player.const import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_COMMAND, CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME, ATTR_ENTITY_ID,
|
||||
STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING)
|
||||
@@ -28,10 +22,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_PORT = 9090
|
||||
|
||||
SUPPORT_SQUEEZEBOX = SUPPORT_PAUSE | SUPPORT_VOLUME_SET | \
|
||||
SUPPORT_VOLUME_MUTE | SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK | \
|
||||
SUPPORT_SEEK | SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_PLAY_MEDIA | \
|
||||
SUPPORT_PLAY | SUPPORT_SHUFFLE_SET | SUPPORT_CLEAR_PLAYLIST | SUPPORT_REPEAT_SET
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
@@ -255,6 +245,23 @@ class LogitechMediaServer(ReconnectingClient):
|
||||
class SqueezeBoxDevice(MediaPlayerEntity):
|
||||
"""Representation of a SqueezeBox device."""
|
||||
|
||||
_attr_supported_features = (
|
||||
MediaPlayerEntityFeature.PAUSE
|
||||
| MediaPlayerEntityFeature.VOLUME_SET
|
||||
| MediaPlayerEntityFeature.VOLUME_MUTE
|
||||
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||
| MediaPlayerEntityFeature.SEEK
|
||||
| MediaPlayerEntityFeature.TURN_ON
|
||||
| MediaPlayerEntityFeature.TURN_OFF
|
||||
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||
| MediaPlayerEntityFeature.PLAY
|
||||
| MediaPlayerEntityFeature.REPEAT_SET
|
||||
| MediaPlayerEntityFeature.SHUFFLE_SET
|
||||
| MediaPlayerEntityFeature.CLEAR_PLAYLIST
|
||||
| MediaPlayerEntityFeature.STOP
|
||||
)
|
||||
|
||||
def __init__(self, lms, playerid, name, **attributes):
|
||||
"""Initialize the SqueezeBox device."""
|
||||
super(SqueezeBoxDevice, self).__init__()
|
||||
@@ -362,7 +369,7 @@ class SqueezeBoxDevice(MediaPlayerEntity):
|
||||
@property
|
||||
def media_content_type(self):
|
||||
"""Content type of current playing media."""
|
||||
return MEDIA_TYPE_MUSIC
|
||||
return MediaType.MUSIC
|
||||
|
||||
@property
|
||||
def media_duration(self):
|
||||
@@ -446,11 +453,11 @@ class SqueezeBoxDevice(MediaPlayerEntity):
|
||||
def repeat(self):
|
||||
repeat_status = self._status.get('playlist repeat', 0)
|
||||
if repeat_status == 1:
|
||||
return REPEAT_MODE_ONE
|
||||
return RepeatMode.ONE
|
||||
elif repeat_status == 2:
|
||||
return REPEAT_MODE_ALL
|
||||
return RepeatMode.ALL
|
||||
else:
|
||||
return REPEAT_MODE_OFF
|
||||
return RepeatMode.OFF
|
||||
|
||||
def set_repeat(self, repeat: str) -> None:
|
||||
"""Set repeat mode."""
|
||||
|
||||
Reference in New Issue
Block a user