Kodi Community Forum
Is there a specific command or method to activate voice search from a python script? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: Android Development (https://forum.kodi.tv/forumdisplay.php?fid=184)
+---- Thread: Is there a specific command or method to activate voice search from a python script? (/showthread.php?tid=376631)



Is there a specific command or method to activate voice search from a python script? - ppongoo - 2024-03-13

Hi!
I'm having difficulty popping up voice search on my Android TV.
I have a bluetooth remote connected to ATV which doesn't adhere to standard remote button specifications.
I've tried every key setting and Key-map editor I can, but this remote ignores all settings and overrides to weird functions..
Long press will never work with this remote controller.

As an alternative I want to make a script that pops up the voice search as the keyboard skin opened on my add-on.

something like 
keyboard = Keyboard()
keyboard.doModal()
query = voicesearch_popup() and getText()?

or is it possible to create a script to long press the Play button key?

keyboard = Keyboard()
keyboard.doModal()
executebuiltin("Runscript(something Something)")

https://github.com/xbmc/xbmc/blob/348313a4335d14be88c8c91e70bdb3a67a5d542b/system/keymaps/keyboard.xml#L199

  <VirtualKeyboard>
    <keyboard>
      <c mod="longpress">noop</c>
      <left>Left</left>
      <right>Right</right>
      <up>Up</up>
      <down>Down</down>
      <return>Select</return>
      <enter>Select</enter>
      <backspace>Backspace</backspace>
      <browser_back>Backspace</browser_back>
      <browser_back mod="longpress">PreviousMenu</browser_back>
      <play_pause mod="longpress">Enter</play_pause>
      <browser_search>VoiceRecognizer</browser_search>
      <menu>VoiceRecognizer</menu>
      <return mod="longpress">VoiceRecognizer</return>
      <enter mod="longpress">VoiceRecognizer</enter>
      <play_pause>VoiceRecognizer</play_pause>

kinda resolved the problem myself.
added line to the "script.keymap" / resources / lib / action.py
["Virtual Keyboard", [
"voicerecognizer", "Voice Recognizer"
...
]]

but it would be good to know how to call a 'voicerecognizer' with a script.