devialet 1.5.3__tar.gz → 1.5.4__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.3 → devialet-1.5.4}/PKG-INFO +1 -1
- {devialet-1.5.3 → devialet-1.5.4}/devialet/devialet_api.py +14 -13
- {devialet-1.5.3 → devialet-1.5.4}/devialet.egg-info/PKG-INFO +1 -1
- {devialet-1.5.3 → devialet-1.5.4}/setup.py +1 -1
- {devialet-1.5.3 → devialet-1.5.4}/LICENSE +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/README.md +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/devialet/__init__.py +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/devialet/const.py +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/devialet.egg-info/SOURCES.txt +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/devialet.egg-info/dependency_links.txt +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/devialet.egg-info/requires.txt +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/devialet.egg-info/top_level.txt +0 -0
- {devialet-1.5.3 → devialet-1.5.4}/setup.cfg +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Support for Devialet Phantom
|
|
1
|
+
"""Support for Devialet Phantom speakers1."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
@@ -58,6 +58,9 @@ class DevialetApi:
|
|
|
58
58
|
self._source_state = await self._async_get_request(UrlSuffix.GET_CURRENT_SOURCE)
|
|
59
59
|
# The source state call is enough to find out if the device is available (On or Off)
|
|
60
60
|
if not self._is_available:
|
|
61
|
+
# Set upnp to none, so discovery will find the new port when it's online again
|
|
62
|
+
self._upnp_device = None
|
|
63
|
+
self._dmr_device = None
|
|
61
64
|
return True
|
|
62
65
|
|
|
63
66
|
if self._sources is None:
|
|
@@ -67,9 +70,6 @@ class DevialetApi:
|
|
|
67
70
|
self._night_mode = await self._async_get_request(UrlSuffix.GET_NIGHT_MODE)
|
|
68
71
|
self._equalizer = await self._async_get_request(UrlSuffix.GET_EQUALIZER)
|
|
69
72
|
|
|
70
|
-
if self.source == "upnp":
|
|
71
|
-
return True
|
|
72
|
-
|
|
73
73
|
try:
|
|
74
74
|
self._media_duration = self._source_state["metadata"]["duration"]
|
|
75
75
|
except (KeyError, TypeError):
|
|
@@ -559,7 +559,7 @@ class DevialetApi:
|
|
|
559
559
|
source=("0.0.0.0", 0))
|
|
560
560
|
LOGGER.debug("Discovering UPnP device for %s", self._host)
|
|
561
561
|
|
|
562
|
-
async def async_play_url_source(self, media_url: str, media_title: str, meta_data: Union[None, str, Mapping] = None)
|
|
562
|
+
async def async_play_url_source(self, media_url: str, media_title: str, meta_data: Union[None, str, Mapping] = None):
|
|
563
563
|
"""Play media uri over UPnP."""
|
|
564
564
|
if not self.upnp_available:
|
|
565
565
|
LOGGER.error("No UPnP location discovered")
|
|
@@ -573,11 +573,12 @@ class DevialetApi:
|
|
|
573
573
|
LOGGER.debug("Action result: %s", str(result))
|
|
574
574
|
except UpnpActionResponseError as a:
|
|
575
575
|
LOGGER.error("Error playing %s: %s", media_title, a.error_desc)
|
|
576
|
+
return
|
|
576
577
|
except UpnpXmlParseError as x:
|
|
577
578
|
LOGGER.error("Error playing %s %s", media_title, x.text)
|
|
579
|
+
return
|
|
578
580
|
|
|
579
581
|
await self.async_upnp_play()
|
|
580
|
-
await self._async_get_upnp_metadata(media_url) # Devialet does not support UPnP metadata
|
|
581
582
|
|
|
582
583
|
async def async_upnp_play(self) -> None:
|
|
583
584
|
"""Send the play command over UPnP."""
|
|
@@ -596,11 +597,11 @@ class DevialetApi:
|
|
|
596
597
|
except UpnpXmlParseError:
|
|
597
598
|
return
|
|
598
599
|
|
|
599
|
-
async def
|
|
600
|
+
async def async_get_upnp_media_title(self, url: str) -> str | None:
|
|
600
601
|
"""Call the media URL with the HEAD method to get ICY metadata."""
|
|
601
602
|
try:
|
|
602
603
|
async with self._session.head(
|
|
603
|
-
url=url, allow_redirects=False, timeout=2, headers={"Icy-MetaData": 1}
|
|
604
|
+
url=url, allow_redirects=False, timeout=2, headers={"Icy-MetaData": "1"}
|
|
604
605
|
) as response:
|
|
605
606
|
LOGGER.debug(
|
|
606
607
|
"Host %s: HTTP Response data: %s",
|
|
@@ -608,13 +609,13 @@ class DevialetApi:
|
|
|
608
609
|
response.headers,
|
|
609
610
|
)
|
|
610
611
|
title:str = response.headers.get("icy-name")
|
|
611
|
-
|
|
612
|
+
return title
|
|
612
613
|
|
|
613
614
|
except aiohttp.ClientConnectorError:
|
|
614
|
-
return
|
|
615
|
+
return
|
|
615
616
|
except asyncio.TimeoutError:
|
|
616
|
-
return
|
|
617
|
+
return
|
|
617
618
|
except TypeError:
|
|
618
|
-
return
|
|
619
|
+
return
|
|
619
620
|
except Exception: # pylint: disable=bare-except
|
|
620
|
-
return
|
|
621
|
+
return
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|