aioamazondevices 1.6.0__tar.gz → 1.7.0__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.
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/PKG-INFO +1 -1
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/pyproject.toml +1 -1
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/src/aioamazondevices/__init__.py +1 -1
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/src/aioamazondevices/api.py +32 -2
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/LICENSE +0 -0
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/README.md +0 -0
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/src/aioamazondevices/const.py +0 -0
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/src/aioamazondevices/exceptions.py +0 -0
- {aioamazondevices-1.6.0 → aioamazondevices-1.7.0}/src/aioamazondevices/py.typed +0 -0
@@ -70,6 +70,14 @@ class AmazonSequenceType(StrEnum):
|
|
70
70
|
Announcement = "AlexaAnnouncement"
|
71
71
|
Speak = "Alexa.Speak"
|
72
72
|
Sound = "Alexa.Sound"
|
73
|
+
Music = "Alexa.Music.PlaySearchPhrase"
|
74
|
+
|
75
|
+
|
76
|
+
class AmazonMusicSource(StrEnum):
|
77
|
+
"""Amazon music sources."""
|
78
|
+
|
79
|
+
Radio = "TUNEIN"
|
80
|
+
AmazonMusic = "AMAZON_MUSIC"
|
73
81
|
|
74
82
|
|
75
83
|
class AmazonEchoApi:
|
@@ -610,7 +618,11 @@ class AmazonEchoApi:
|
|
610
618
|
return bool(authenticated)
|
611
619
|
|
612
620
|
async def _send_message(
|
613
|
-
self,
|
621
|
+
self,
|
622
|
+
device: AmazonDevice,
|
623
|
+
message_type: str,
|
624
|
+
message_body: str,
|
625
|
+
message_source: AmazonMusicSource | None = None,
|
614
626
|
) -> None:
|
615
627
|
"""Send message to specific device."""
|
616
628
|
locale_data = Locale.parse(f"und_{self._login_country_code}")
|
@@ -681,6 +693,13 @@ class AmazonEchoApi:
|
|
681
693
|
"soundStringId": message_body,
|
682
694
|
"skillId": "amzn1.ask.1p.sound",
|
683
695
|
}
|
696
|
+
elif message_type == AmazonSequenceType.Music:
|
697
|
+
payload = {
|
698
|
+
**base_payload,
|
699
|
+
"searchPhrase": message_body,
|
700
|
+
"sanitizedSearchPhrase": message_body,
|
701
|
+
"musicProviderId": message_source,
|
702
|
+
}
|
684
703
|
|
685
704
|
sequence = {
|
686
705
|
"@type": "com.amazon.alexa.behaviors.model.Sequence",
|
@@ -735,5 +754,16 @@ class AmazonEchoApi:
|
|
735
754
|
device: AmazonDevice,
|
736
755
|
message_body: str,
|
737
756
|
) -> None:
|
738
|
-
"""Call Alexa.Sound to
|
757
|
+
"""Call Alexa.Sound to play sound."""
|
739
758
|
return await self._send_message(device, AmazonSequenceType.Sound, message_body)
|
759
|
+
|
760
|
+
async def call_alexa_music(
|
761
|
+
self,
|
762
|
+
device: AmazonDevice,
|
763
|
+
message_body: str,
|
764
|
+
message_source: AmazonMusicSource,
|
765
|
+
) -> None:
|
766
|
+
"""Call Alexa.Music.PlaySearchPhrase to play music."""
|
767
|
+
return await self._send_message(
|
768
|
+
device, AmazonSequenceType.Music, message_body, message_source
|
769
|
+
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|