devialet 1.5.4__tar.gz → 1.5.5__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.4
3
+ Version: 1.5.5
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
@@ -5,7 +5,6 @@ import asyncio
5
5
  import datetime
6
6
  import json
7
7
  import re
8
- from typing import Mapping, Union
9
8
 
10
9
  import aiohttp
11
10
  from async_upnp_client.aiohttp import AiohttpRequester
@@ -559,24 +558,35 @@ class DevialetApi:
559
558
  source=("0.0.0.0", 0))
560
559
  LOGGER.debug("Discovering UPnP device for %s", self._host)
561
560
 
562
- async def async_play_url_source(self, media_url: str, media_title: str, meta_data: Union[None, str, Mapping] = None):
561
+ async def async_play_url_source(self, media_id: str, mime_type: str, media_title: str, default_title: bool=False) -> bool:
563
562
  """Play media uri over UPnP."""
564
563
  if not self.upnp_available:
565
564
  LOGGER.error("No UPnP location discovered")
566
565
  return
567
566
 
567
+ if default_title:
568
+ media_title = await self.async_get_upnp_media_title(media_id) or media_title
569
+
570
+ metadata = (
571
+ await self.dmr_device.construct_play_media_metadata(
572
+ media_url=media_id,
573
+ media_title=media_title,
574
+ mime_type=mime_type
575
+ )
576
+ )
577
+
568
578
  service = self._upnp_device.service(AV_TRANSPORT)
569
579
  set_uri = service.action("SetAVTransportURI")
570
580
 
571
581
  try:
572
- result = await set_uri.async_call(InstanceID=0, CurrentURI=media_url, CurrentURIMetaData=meta_data)
582
+ result = await set_uri.async_call(InstanceID=0, CurrentURI=media_id, CurrentURIMetaData=metadata)
573
583
  LOGGER.debug("Action result: %s", str(result))
574
584
  except UpnpActionResponseError as a:
575
585
  LOGGER.error("Error playing %s: %s", media_title, a.error_desc)
576
- return
586
+ return False
577
587
  except UpnpXmlParseError as x:
578
588
  LOGGER.error("Error playing %s %s", media_title, x.text)
579
- return
589
+ return False
580
590
 
581
591
  await self.async_upnp_play()
582
592
 
@@ -608,7 +618,7 @@ class DevialetApi:
608
618
  self._host,
609
619
  response.headers,
610
620
  )
611
- title:str = response.headers.get("icy-name")
621
+ title:str = response.headers.get("icy-description") or response.headers.get("icy-name")
612
622
  return title
613
623
 
614
624
  except aiohttp.ClientConnectorError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: devialet
3
- Version: 1.5.4
3
+ Version: 1.5.5
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.4',
6
+ version='1.5.5',
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