mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Bump aiovlc to 0.3.2 (#118258)
This commit is contained in:
parent
ea91f7a5aa
commit
5d61743a5b
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/vlc_telnet",
|
"documentation": "https://www.home-assistant.io/integrations/vlc_telnet",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["aiovlc"],
|
"loggers": ["aiovlc"],
|
||||||
"requirements": ["aiovlc==0.1.0"]
|
"requirements": ["aiovlc==0.3.2"]
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from collections.abc import Awaitable, Callable, Coroutine
|
from collections.abc import Awaitable, Callable, Coroutine
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Concatenate
|
from typing import Any, Concatenate, Literal
|
||||||
|
|
||||||
from aiovlc.client import Client
|
from aiovlc.client import Client
|
||||||
from aiovlc.exceptions import AuthError, CommandError, ConnectError
|
from aiovlc.exceptions import AuthError, CommandError, ConnectError
|
||||||
@ -31,6 +31,13 @@ from .const import DEFAULT_NAME, DOMAIN, LOGGER
|
|||||||
MAX_VOLUME = 500
|
MAX_VOLUME = 500
|
||||||
|
|
||||||
|
|
||||||
|
def _get_str(data: dict, key: str) -> str | None:
|
||||||
|
"""Get a value from a dictionary and cast it to a string or None."""
|
||||||
|
if value := data.get(key):
|
||||||
|
return str(value)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: VlcConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: VlcConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -152,10 +159,10 @@ class VlcDevice(MediaPlayerEntity):
|
|||||||
data = info.data
|
data = info.data
|
||||||
LOGGER.debug("Info data: %s", data)
|
LOGGER.debug("Info data: %s", data)
|
||||||
|
|
||||||
self._attr_media_album_name = data.get("data", {}).get("album")
|
self._attr_media_album_name = _get_str(data.get("data", {}), "album")
|
||||||
self._attr_media_artist = data.get("data", {}).get("artist")
|
self._attr_media_artist = _get_str(data.get("data", {}), "artist")
|
||||||
self._attr_media_title = data.get("data", {}).get("title")
|
self._attr_media_title = _get_str(data.get("data", {}), "title")
|
||||||
now_playing = data.get("data", {}).get("now_playing")
|
now_playing = _get_str(data.get("data", {}), "now_playing")
|
||||||
|
|
||||||
# Many radio streams put artist/title/album in now_playing and title is the station name.
|
# Many radio streams put artist/title/album in now_playing and title is the station name.
|
||||||
if now_playing:
|
if now_playing:
|
||||||
@ -168,7 +175,7 @@ class VlcDevice(MediaPlayerEntity):
|
|||||||
|
|
||||||
# Fall back to filename.
|
# Fall back to filename.
|
||||||
if data_info := data.get("data"):
|
if data_info := data.get("data"):
|
||||||
self._attr_media_title = data_info["filename"]
|
self._attr_media_title = _get_str(data_info, "filename")
|
||||||
|
|
||||||
# Strip out auth signatures if streaming local media
|
# Strip out auth signatures if streaming local media
|
||||||
if (media_title := self.media_title) and (
|
if (media_title := self.media_title) and (
|
||||||
@ -268,7 +275,7 @@ class VlcDevice(MediaPlayerEntity):
|
|||||||
@catch_vlc_errors
|
@catch_vlc_errors
|
||||||
async def async_set_shuffle(self, shuffle: bool) -> None:
|
async def async_set_shuffle(self, shuffle: bool) -> None:
|
||||||
"""Enable/disable shuffle mode."""
|
"""Enable/disable shuffle mode."""
|
||||||
shuffle_command = "on" if shuffle else "off"
|
shuffle_command: Literal["on", "off"] = "on" if shuffle else "off"
|
||||||
await self._vlc.random(shuffle_command)
|
await self._vlc.random(shuffle_command)
|
||||||
|
|
||||||
async def async_browse_media(
|
async def async_browse_media(
|
||||||
|
@ -386,7 +386,7 @@ aiotractive==0.5.6
|
|||||||
aiounifi==77
|
aiounifi==77
|
||||||
|
|
||||||
# homeassistant.components.vlc_telnet
|
# homeassistant.components.vlc_telnet
|
||||||
aiovlc==0.1.0
|
aiovlc==0.3.2
|
||||||
|
|
||||||
# homeassistant.components.vodafone_station
|
# homeassistant.components.vodafone_station
|
||||||
aiovodafone==0.6.0
|
aiovodafone==0.6.0
|
||||||
|
@ -359,7 +359,7 @@ aiotractive==0.5.6
|
|||||||
aiounifi==77
|
aiounifi==77
|
||||||
|
|
||||||
# homeassistant.components.vlc_telnet
|
# homeassistant.components.vlc_telnet
|
||||||
aiovlc==0.1.0
|
aiovlc==0.3.2
|
||||||
|
|
||||||
# homeassistant.components.vodafone_station
|
# homeassistant.components.vodafone_station
|
||||||
aiovodafone==0.6.0
|
aiovodafone==0.6.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user