devialet 1.5.4__tar.gz → 1.5.6__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.4 → devialet-1.5.6}/PKG-INFO +1 -1
- {devialet-1.5.4 → devialet-1.5.6}/devialet/devialet_api.py +16 -6
- {devialet-1.5.4 → devialet-1.5.6}/devialet.egg-info/PKG-INFO +1 -1
- {devialet-1.5.4 → devialet-1.5.6}/setup.py +1 -1
- {devialet-1.5.4 → devialet-1.5.6}/LICENSE +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/README.md +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/devialet/__init__.py +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/devialet/const.py +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/devialet.egg-info/SOURCES.txt +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/devialet.egg-info/dependency_links.txt +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/devialet.egg-info/requires.txt +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/devialet.egg-info/top_level.txt +0 -0
- {devialet-1.5.4 → devialet-1.5.6}/setup.cfg +0 -0
|
@@ -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,
|
|
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
|
+
default_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=
|
|
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:
|
|
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
|