androidtvremote2 0.2.1__tar.gz → 0.2.2__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.
Files changed (24) hide show
  1. {androidtvremote2-0.2.1/src/androidtvremote2.egg-info → androidtvremote2-0.2.2}/PKG-INFO +1 -1
  2. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/pyproject.toml +1 -1
  3. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/androidtv_remote.py +2 -1
  4. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/remote.py +9 -4
  5. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2/src/androidtvremote2.egg-info}/PKG-INFO +1 -1
  6. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/LICENSE +0 -0
  7. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/README.md +0 -0
  8. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/setup.cfg +0 -0
  9. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/__init__.py +0 -0
  10. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/base.py +0 -0
  11. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/certificate_generator.py +0 -0
  12. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/const.py +0 -0
  13. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/exceptions.py +0 -0
  14. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/pairing.py +0 -0
  15. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/polo_pb2.py +0 -0
  16. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/polo_pb2.pyi +0 -0
  17. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/remotemessage_pb2.py +0 -0
  18. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2/remotemessage_pb2.pyi +0 -0
  19. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2.egg-info/SOURCES.txt +0 -0
  20. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2.egg-info/dependency_links.txt +0 -0
  21. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2.egg-info/requires.txt +0 -0
  22. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/androidtvremote2.egg-info/top_level.txt +0 -0
  23. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/src/demo.py +0 -0
  24. {androidtvremote2-0.2.1 → androidtvremote2-0.2.2}/tests/test_androidtv_remote.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: androidtvremote2
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python library for interacting with Android TV using the Android TV Remote protocol v2
5
5
  Author-email: tronikos <tronikos@gmail.com>
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "androidtvremote2"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  license = {text = "Apache-2.0"}
5
5
  authors = [
6
6
  { name="tronikos", email="tronikos@gmail.com" },
@@ -384,7 +384,8 @@ class AndroidTVRemote:
384
384
  This does not block; it buffers the data and arranges for it to be sent out asynchronously.
385
385
 
386
386
  :param key_code: int (e.g. 26) or str (e.g. "KEYCODE_POWER" or just "POWER") from the enum
387
- RemoteKeyCode in remotemessage.proto.
387
+ RemoteKeyCode in remotemessage.proto or str prefixed with "text:" to pass
388
+ to send_text.
388
389
  :param direction: "SHORT" (default) or "START_LONG" or "END_LONG".
389
390
  :raises ValueError: if key_code in str or direction isn't known.
390
391
  :raises ConnectionClosed: if client is disconnected.
@@ -30,6 +30,8 @@ ERROR_SUGGESTION_MSG = (
30
30
  "On the Android TV device, go to Settings > Apps > See all apps > Show system apps. "
31
31
  "Then, select Android TV Remote Service > Storage > Clear data/storage."
32
32
  )
33
+ KEYCODE_PREFIX = "KEYCODE_"
34
+ TEXT_PREFIX = "text:"
33
35
 
34
36
 
35
37
  class Feature(IntFlag):
@@ -102,16 +104,19 @@ class RemoteProtocol(ProtobufProtocol):
102
104
 
103
105
  This does not block; it buffers the data and arranges for it to be sent out asynchronously.
104
106
 
105
- :param key_code: int (e.g. 26) or str (e.g. KEYCODE_POWER or just "POWER") from the enum
106
- RemoteKeyCode in remotemessage.proto.
107
+ :param key_code: int (e.g. 26) or str (e.g. "KEYCODE_POWER" or just "POWER") from the enum
108
+ RemoteKeyCode in remotemessage.proto or str prefixed with "text:" to pass
109
+ to send_text.
107
110
  :param direction: "SHORT" (default) or "START_LONG" or "END_LONG".
108
111
  :raises ValueError: if key_code in str or direction isn't known.
109
112
  """
110
113
  self._reset_idle_disconnect_task()
111
114
  msg = RemoteMessage()
112
115
  if isinstance(key_code, str):
113
- if not key_code.startswith("KEYCODE_"):
114
- key_code = "KEYCODE_" + key_code
116
+ if key_code.lower().startswith(TEXT_PREFIX):
117
+ return self.send_text(key_code[len(TEXT_PREFIX):])
118
+ if not key_code.startswith(KEYCODE_PREFIX):
119
+ key_code = KEYCODE_PREFIX + key_code
115
120
  key_code = RemoteKeyCode.Value(key_code)
116
121
  if isinstance(direction, str):
117
122
  direction = RemoteDirection.Value(direction)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: androidtvremote2
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python library for interacting with Android TV using the Android TV Remote protocol v2
5
5
  Author-email: tronikos <tronikos@gmail.com>
6
6
  License: Apache-2.0