denonavr 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl
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.
- denonavr/__init__.py +1 -1
- denonavr/api.py +181 -60
- denonavr/audyssey.py +105 -0
- denonavr/const.py +880 -2
- denonavr/decorators.py +5 -32
- denonavr/denonavr.py +500 -3
- denonavr/dirac.py +89 -0
- denonavr/foundation.py +1196 -26
- denonavr/input.py +44 -3
- denonavr/soundmode.py +912 -3
- denonavr/volume.py +415 -4
- {denonavr-1.0.0.dist-info → denonavr-1.1.0.dist-info}/METADATA +21 -37
- denonavr-1.1.0.dist-info/RECORD +20 -0
- {denonavr-1.0.0.dist-info → denonavr-1.1.0.dist-info}/WHEEL +1 -1
- denonavr-1.0.0.dist-info/RECORD +0 -19
- {denonavr-1.0.0.dist-info → denonavr-1.1.0.dist-info/licenses}/LICENSE +0 -0
- {denonavr-1.0.0.dist-info → denonavr-1.1.0.dist-info}/top_level.txt +0 -0
denonavr/input.py
CHANGED
|
@@ -168,6 +168,13 @@ class DenonAVRInput(DenonAVRFoundation):
|
|
|
168
168
|
converter=attr.converters.optional(str), default=None
|
|
169
169
|
)
|
|
170
170
|
|
|
171
|
+
_renamed_sources_warnings: Set[Tuple[str, str]] = attr.ib(
|
|
172
|
+
validator=attr.validators.deep_iterable(
|
|
173
|
+
attr.validators.instance_of(tuple), attr.validators.instance_of(set)
|
|
174
|
+
),
|
|
175
|
+
default=attr.Factory(set),
|
|
176
|
+
)
|
|
177
|
+
|
|
171
178
|
# Update tags for attributes
|
|
172
179
|
# AppCommand.xml interface
|
|
173
180
|
appcommand_attrs = {AppCommands.GetAllZoneSource: None}
|
|
@@ -516,6 +523,8 @@ class DenonAVRInput(DenonAVRFoundation):
|
|
|
516
523
|
except AttributeError:
|
|
517
524
|
continue
|
|
518
525
|
|
|
526
|
+
self._replace_duplicate_sources(renamed_sources)
|
|
527
|
+
|
|
519
528
|
return (renamed_sources, deleted_sources)
|
|
520
529
|
|
|
521
530
|
async def async_get_changed_sources_status_xml(
|
|
@@ -604,6 +613,8 @@ class DenonAVRInput(DenonAVRFoundation):
|
|
|
604
613
|
except IndexError:
|
|
605
614
|
_LOGGER.error("List of deleted sources incomplete, continuing anyway")
|
|
606
615
|
|
|
616
|
+
self._replace_duplicate_sources(renamed_sources)
|
|
617
|
+
|
|
607
618
|
return (renamed_sources, deleted_sources)
|
|
608
619
|
|
|
609
620
|
async def async_update_inputfuncs(
|
|
@@ -859,10 +870,13 @@ class DenonAVRInput(DenonAVRFoundation):
|
|
|
859
870
|
async def _async_test_image_accessible(self) -> None:
|
|
860
871
|
"""Test if image URL is accessible."""
|
|
861
872
|
if self._image_available is None and self._image_url is not None:
|
|
862
|
-
client = self._device.api.
|
|
873
|
+
client = self._device.api.httpx_async_client.client_getter()
|
|
863
874
|
try:
|
|
864
875
|
res = await client.get(
|
|
865
|
-
self._image_url,
|
|
876
|
+
self._image_url,
|
|
877
|
+
timeout=httpx.Timeout(
|
|
878
|
+
self._device.api.timeout, read=self._device.api.read_timeout
|
|
879
|
+
),
|
|
866
880
|
)
|
|
867
881
|
res.raise_for_status()
|
|
868
882
|
except httpx.TimeoutException:
|
|
@@ -878,7 +892,7 @@ class DenonAVRInput(DenonAVRFoundation):
|
|
|
878
892
|
self._image_available = True
|
|
879
893
|
finally:
|
|
880
894
|
# Close the default AsyncClient but keep custom clients open
|
|
881
|
-
if self._device.api.is_default_async_client():
|
|
895
|
+
if self._device.api.httpx_async_client.is_default_async_client():
|
|
882
896
|
await client.aclose()
|
|
883
897
|
# Already tested that image URL is not accessible
|
|
884
898
|
elif not self._image_available:
|
|
@@ -894,6 +908,33 @@ class DenonAVRInput(DenonAVRFoundation):
|
|
|
894
908
|
self._station = None
|
|
895
909
|
self._image_url = None
|
|
896
910
|
|
|
911
|
+
def _replace_duplicate_sources(self, sources: Dict[str, str]) -> None:
|
|
912
|
+
"""Replace duplicate renamed sources (values) with their original names."""
|
|
913
|
+
seen_values = set()
|
|
914
|
+
duplicate_values = set()
|
|
915
|
+
|
|
916
|
+
for value in sources.values():
|
|
917
|
+
if value in seen_values:
|
|
918
|
+
duplicate_values.add(value)
|
|
919
|
+
seen_values.add(value)
|
|
920
|
+
|
|
921
|
+
for duplicate in duplicate_values:
|
|
922
|
+
for key, value in sources.items():
|
|
923
|
+
if value == duplicate:
|
|
924
|
+
sources[key] = key
|
|
925
|
+
|
|
926
|
+
if (key, value) not in self._renamed_sources_warnings:
|
|
927
|
+
_LOGGER.warning(
|
|
928
|
+
(
|
|
929
|
+
"Input source '%s' is renamed to non-unique name '%s'. "
|
|
930
|
+
"Using original name. Please choose unique names in "
|
|
931
|
+
"your receiver's web-interface"
|
|
932
|
+
),
|
|
933
|
+
key,
|
|
934
|
+
value,
|
|
935
|
+
)
|
|
936
|
+
self._renamed_sources_warnings.add((key, value))
|
|
937
|
+
|
|
897
938
|
##############
|
|
898
939
|
# Properties #
|
|
899
940
|
##############
|