devialet 1.5.7__tar.gz → 1.5.8__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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: devialet
3
- Version: 1.5.7
3
+ Version: 1.5.8
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
@@ -21,5 +21,16 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: aiohttp
23
23
  Requires-Dist: async_upnp_client
24
+ Dynamic: author
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: download-url
29
+ Dynamic: home-page
30
+ Dynamic: keywords
31
+ Dynamic: license
32
+ Dynamic: license-file
33
+ Dynamic: requires-dist
34
+ Dynamic: summary
24
35
 
25
36
  Devialet API
@@ -562,51 +562,59 @@ class DevialetApi:
562
562
  """Play media uri over UPnP."""
563
563
  if not self.upnp_available:
564
564
  LOGGER.error("No UPnP location discovered")
565
- return
565
+ return False
566
566
 
567
567
  if default_title:
568
568
  media_title = await self.async_get_upnp_media_title(media_id) or media_title
569
569
 
570
- metadata = (
571
- await self.dmr_device.construct_play_media_metadata(
572
- media_url=media_id,
570
+ urls = [media_id]
571
+ # The Devialet UPnP renderer cannot open HTTPS (error 716), most radio streams also serve HTTP
572
+ if media_id.startswith("https://"):
573
+ urls.append("http://" + media_id.removeprefix("https://"))
574
+
575
+ service = self._upnp_device.service(AV_TRANSPORT)
576
+ set_uri = service.action("SetAVTransportURI")
577
+
578
+ for url in urls:
579
+ metadata = await self.dmr_device.construct_play_media_metadata(
580
+ media_url=url,
573
581
  media_title=media_title,
574
582
  default_mime_type=mime_type
575
583
  )
576
- )
577
584
 
578
- service = self._upnp_device.service(AV_TRANSPORT)
579
- set_uri = service.action("SetAVTransportURI")
585
+ try:
586
+ result = await set_uri.async_call(InstanceID=0, CurrentURI=url, CurrentURIMetaData=metadata)
587
+ except UpnpActionResponseError as a:
588
+ LOGGER.debug("Error setting %s as UPnP source: %s %s", url, a.error_code, a.error_desc)
589
+ continue
590
+ except UpnpXmlParseError as x:
591
+ LOGGER.error("Error playing %s %s", media_title, x.text)
592
+ return False
580
593
 
581
- try:
582
- result = await set_uri.async_call(InstanceID=0, CurrentURI=media_id, CurrentURIMetaData=metadata)
583
594
  LOGGER.debug("Action result: %s", str(result))
584
- return True
585
- except UpnpActionResponseError as a:
586
- LOGGER.error("Error playing %s: %s", media_title, a.error_desc)
587
- return False
588
- except UpnpXmlParseError as x:
589
- LOGGER.error("Error playing %s %s", media_title, x.text)
590
- return False
595
+ return await self.async_upnp_play()
591
596
 
592
- await self.async_upnp_play()
597
+ LOGGER.error("Error playing %s: the device could not open %s", media_title, media_id)
598
+ return False
593
599
 
594
- async def async_upnp_play(self) -> None:
600
+ async def async_upnp_play(self) -> bool:
595
601
  """Send the play command over UPnP."""
596
602
  if not self.upnp_available:
597
603
  LOGGER.error("No UPnP location discovered")
598
- return
604
+ return False
599
605
 
600
606
  service = self._upnp_device.service(AV_TRANSPORT)
601
- set_uri = service.action("Play")
607
+ play = service.action("Play")
602
608
 
603
609
  try:
604
- await set_uri.async_call(InstanceID=0, Speed="1")
605
- return
606
- except UpnpActionResponseError:
607
- return
608
- except UpnpXmlParseError:
609
- return
610
+ await play.async_call(InstanceID=0, Speed="1")
611
+ except UpnpActionResponseError as a:
612
+ LOGGER.error("Error sending UPnP play: %s", a.error_desc)
613
+ return False
614
+ except UpnpXmlParseError as x:
615
+ LOGGER.error("Error sending UPnP play: %s", x.text)
616
+ return False
617
+ return True
610
618
 
611
619
  async def async_get_upnp_media_title(self, url: str) -> str | None:
612
620
  """Call the media URL with the HEAD method to get ICY metadata."""
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: devialet
3
- Version: 1.5.7
3
+ Version: 1.5.8
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
@@ -21,5 +21,16 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: aiohttp
23
23
  Requires-Dist: async_upnp_client
24
+ Dynamic: author
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: download-url
29
+ Dynamic: home-page
30
+ Dynamic: keywords
31
+ Dynamic: license
32
+ Dynamic: license-file
33
+ Dynamic: requires-dist
34
+ Dynamic: summary
24
35
 
25
36
  Devialet API
@@ -3,7 +3,7 @@ from distutils.core import setup
3
3
  setup(
4
4
  name='devialet',
5
5
  packages=['devialet'],
6
- version='1.5.7',
6
+ version='1.5.8',
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