aioamazondevices 1.6.0__py3-none-any.whl → 1.8.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.
- aioamazondevices/__init__.py +1 -1
- aioamazondevices/api.py +49 -2
- {aioamazondevices-1.6.0.dist-info → aioamazondevices-1.8.0.dist-info}/METADATA +1 -1
- aioamazondevices-1.8.0.dist-info/RECORD +9 -0
- aioamazondevices-1.6.0.dist-info/RECORD +0 -9
- {aioamazondevices-1.6.0.dist-info → aioamazondevices-1.8.0.dist-info}/LICENSE +0 -0
- {aioamazondevices-1.6.0.dist-info → aioamazondevices-1.8.0.dist-info}/WHEEL +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
@@ -70,6 +70,15 @@ class AmazonSequenceType(StrEnum):
|
|
70
70
|
Announcement = "AlexaAnnouncement"
|
71
71
|
Speak = "Alexa.Speak"
|
72
72
|
Sound = "Alexa.Sound"
|
73
|
+
Music = "Alexa.Music.PlaySearchPhrase"
|
74
|
+
TextCommand = "Alexa.TextCommand"
|
75
|
+
|
76
|
+
|
77
|
+
class AmazonMusicSource(StrEnum):
|
78
|
+
"""Amazon music sources."""
|
79
|
+
|
80
|
+
Radio = "TUNEIN"
|
81
|
+
AmazonMusic = "AMAZON_MUSIC"
|
73
82
|
|
74
83
|
|
75
84
|
class AmazonEchoApi:
|
@@ -610,7 +619,11 @@ class AmazonEchoApi:
|
|
610
619
|
return bool(authenticated)
|
611
620
|
|
612
621
|
async def _send_message(
|
613
|
-
self,
|
622
|
+
self,
|
623
|
+
device: AmazonDevice,
|
624
|
+
message_type: str,
|
625
|
+
message_body: str,
|
626
|
+
message_source: AmazonMusicSource | None = None,
|
614
627
|
) -> None:
|
615
628
|
"""Send message to specific device."""
|
616
629
|
locale_data = Locale.parse(f"und_{self._login_country_code}")
|
@@ -681,6 +694,19 @@ class AmazonEchoApi:
|
|
681
694
|
"soundStringId": message_body,
|
682
695
|
"skillId": "amzn1.ask.1p.sound",
|
683
696
|
}
|
697
|
+
elif message_type == AmazonSequenceType.Music:
|
698
|
+
payload = {
|
699
|
+
**base_payload,
|
700
|
+
"searchPhrase": message_body,
|
701
|
+
"sanitizedSearchPhrase": message_body,
|
702
|
+
"musicProviderId": message_source,
|
703
|
+
}
|
704
|
+
elif message_type == AmazonSequenceType.TextCommand:
|
705
|
+
payload = {
|
706
|
+
**base_payload,
|
707
|
+
"skillId": "amzn1.ask.1p.tellalexa",
|
708
|
+
"text": message_body,
|
709
|
+
}
|
684
710
|
|
685
711
|
sequence = {
|
686
712
|
"@type": "com.amazon.alexa.behaviors.model.Sequence",
|
@@ -735,5 +761,26 @@ class AmazonEchoApi:
|
|
735
761
|
device: AmazonDevice,
|
736
762
|
message_body: str,
|
737
763
|
) -> None:
|
738
|
-
"""Call Alexa.Sound to
|
764
|
+
"""Call Alexa.Sound to play sound."""
|
739
765
|
return await self._send_message(device, AmazonSequenceType.Sound, message_body)
|
766
|
+
|
767
|
+
async def call_alexa_music(
|
768
|
+
self,
|
769
|
+
device: AmazonDevice,
|
770
|
+
message_body: str,
|
771
|
+
message_source: AmazonMusicSource,
|
772
|
+
) -> None:
|
773
|
+
"""Call Alexa.Music.PlaySearchPhrase to play music."""
|
774
|
+
return await self._send_message(
|
775
|
+
device, AmazonSequenceType.Music, message_body, message_source
|
776
|
+
)
|
777
|
+
|
778
|
+
async def call_alexa_text_command(
|
779
|
+
self,
|
780
|
+
device: AmazonDevice,
|
781
|
+
message_body: str,
|
782
|
+
) -> None:
|
783
|
+
"""Call Alexa.Sound to play sound."""
|
784
|
+
return await self._send_message(
|
785
|
+
device, AmazonSequenceType.TextCommand, message_body
|
786
|
+
)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
aioamazondevices/__init__.py,sha256=YjVGmADfaQ0huPg-MEYlwK_KbqYqoZCjordvIITyAk0,276
|
2
|
+
aioamazondevices/api.py,sha256=SfwPrEl3s4aJjb-fpiKVJ75TfKJzdBwC5m0W9NshZEI,27940
|
3
|
+
aioamazondevices/const.py,sha256=6BBEg_q2BkYVYJcz3hMrLNyEwOJBWziPSStMzftWQLg,2106
|
4
|
+
aioamazondevices/exceptions.py,sha256=qK_Hak9pc-lC2FPW-0i4rYIwNpEOHMmA9Rii8F2lkQo,1260
|
5
|
+
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
aioamazondevices-1.8.0.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
7
|
+
aioamazondevices-1.8.0.dist-info/METADATA,sha256=lKjLf3eyeTqzli2R5BYEM2RssjQYLbRP6nz3EtTywwE,5010
|
8
|
+
aioamazondevices-1.8.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
9
|
+
aioamazondevices-1.8.0.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
aioamazondevices/__init__.py,sha256=in_tNmEx7nOOujxGDPDDWw7DqPiabEzcb_EXOV0YM_M,276
|
2
|
-
aioamazondevices/api.py,sha256=9dwKJ31TIUIGDEXG7sdqIA3FFbhUWGHeocKmWci5PwM,26520
|
3
|
-
aioamazondevices/const.py,sha256=6BBEg_q2BkYVYJcz3hMrLNyEwOJBWziPSStMzftWQLg,2106
|
4
|
-
aioamazondevices/exceptions.py,sha256=qK_Hak9pc-lC2FPW-0i4rYIwNpEOHMmA9Rii8F2lkQo,1260
|
5
|
-
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
aioamazondevices-1.6.0.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
7
|
-
aioamazondevices-1.6.0.dist-info/METADATA,sha256=DACE14_5WuvXM_qHui5Mk89TB4CSTwZdrmf5YDu7oW4,5010
|
8
|
-
aioamazondevices-1.6.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
9
|
-
aioamazondevices-1.6.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|