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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: devialet
3
- Version: 1.5.3
3
+ Version: 1.5.4
4
4
  Summary: Devialet API
5
5
  Home-page: https://github.com/fwestenberg/devialet
6
6
  Download-URL: https://github.com/fwestenberg/devialet/releases/latest
@@ -1,4 +1,4 @@
1
- """Support for Devialet Phantom speakers."""
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) -> bool:
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 _async_get_upnp_metadata(self, url: str) -> any | None:
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
- self._source_state = { "metadata": { "title": title } }
612
+ return title
612
613
 
613
614
  except aiohttp.ClientConnectorError:
614
- return None
615
+ return
615
616
  except asyncio.TimeoutError:
616
- return None
617
+ return
617
618
  except TypeError:
618
- return None
619
+ return
619
620
  except Exception: # pylint: disable=bare-except
620
- return None
621
+ return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: devialet
3
- Version: 1.5.3
3
+ Version: 1.5.4
4
4
  Summary: Devialet API
5
5
  Home-page: https://github.com/fwestenberg/devialet
6
6
  Download-URL: https://github.com/fwestenberg/devialet/releases/latest
@@ -3,7 +3,7 @@ from distutils.core import setup
3
3
  setup(
4
4
  name='devialet',
5
5
  packages=['devialet'],
6
- version='1.5.3',
6
+ version='1.5.4',
7
7
  license='MIT',
8
8
  description='Devialet API',
9
9
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes