devialet 1.5.2__tar.gz → 1.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devialet-1.5.2 → devialet-1.5.3}/PKG-INFO +1 -1
- {devialet-1.5.2 → devialet-1.5.3}/devialet/const.py +1 -1
- {devialet-1.5.2 → devialet-1.5.3}/devialet/devialet_api.py +27 -0
- {devialet-1.5.2 → devialet-1.5.3}/devialet.egg-info/PKG-INFO +1 -1
- {devialet-1.5.2 → devialet-1.5.3}/setup.py +1 -1
- {devialet-1.5.2 → devialet-1.5.3}/LICENSE +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/README.md +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/devialet/__init__.py +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/devialet.egg-info/SOURCES.txt +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/devialet.egg-info/dependency_links.txt +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/devialet.egg-info/requires.txt +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/devialet.egg-info/top_level.txt +0 -0
- {devialet-1.5.2 → devialet-1.5.3}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ NORMAL_INPUTS = {
|
|
|
10
10
|
"Digital left": "digital_left", #Arch only
|
|
11
11
|
"Digital right": "digital_right", #Arch only
|
|
12
12
|
"Line": "line", #Arch only
|
|
13
|
-
"
|
|
13
|
+
"UPnP": "upnp",
|
|
14
14
|
"Optical": "optical", #Phantom I, Dialog (Mono)
|
|
15
15
|
"Optical left": "optical_left", #Phantom I (Stereo)
|
|
16
16
|
"Optical right": "optical_right", #Phantom I (Stereo)
|
|
@@ -67,6 +67,9 @@ class DevialetApi:
|
|
|
67
67
|
self._night_mode = await self._async_get_request(UrlSuffix.GET_NIGHT_MODE)
|
|
68
68
|
self._equalizer = await self._async_get_request(UrlSuffix.GET_EQUALIZER)
|
|
69
69
|
|
|
70
|
+
if self.source == "upnp":
|
|
71
|
+
return True
|
|
72
|
+
|
|
70
73
|
try:
|
|
71
74
|
self._media_duration = self._source_state["metadata"]["duration"]
|
|
72
75
|
except (KeyError, TypeError):
|
|
@@ -574,6 +577,7 @@ class DevialetApi:
|
|
|
574
577
|
LOGGER.error("Error playing %s %s", media_title, x.text)
|
|
575
578
|
|
|
576
579
|
await self.async_upnp_play()
|
|
580
|
+
await self._async_get_upnp_metadata(media_url) # Devialet does not support UPnP metadata
|
|
577
581
|
|
|
578
582
|
async def async_upnp_play(self) -> None:
|
|
579
583
|
"""Send the play command over UPnP."""
|
|
@@ -591,3 +595,26 @@ class DevialetApi:
|
|
|
591
595
|
return
|
|
592
596
|
except UpnpXmlParseError:
|
|
593
597
|
return
|
|
598
|
+
|
|
599
|
+
async def _async_get_upnp_metadata(self, url: str) -> any | None:
|
|
600
|
+
"""Call the media URL with the HEAD method to get ICY metadata."""
|
|
601
|
+
try:
|
|
602
|
+
async with self._session.head(
|
|
603
|
+
url=url, allow_redirects=False, timeout=2, headers={"Icy-MetaData": 1}
|
|
604
|
+
) as response:
|
|
605
|
+
LOGGER.debug(
|
|
606
|
+
"Host %s: HTTP Response data: %s",
|
|
607
|
+
self._host,
|
|
608
|
+
response.headers,
|
|
609
|
+
)
|
|
610
|
+
title:str = response.headers.get("icy-name")
|
|
611
|
+
self._source_state = { "metadata": { "title": title } }
|
|
612
|
+
|
|
613
|
+
except aiohttp.ClientConnectorError:
|
|
614
|
+
return None
|
|
615
|
+
except asyncio.TimeoutError:
|
|
616
|
+
return None
|
|
617
|
+
except TypeError:
|
|
618
|
+
return None
|
|
619
|
+
except Exception: # pylint: disable=bare-except
|
|
620
|
+
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|