Insert text directly in document
This commit is contained in:
parent
a29a7d0b81
commit
fb124c35d0
2
LEEME.md
2
LEEME.md
|
@ -10,12 +10,10 @@ Dependencias:
|
||||||
|
|
||||||
Ubuntu
|
Ubuntu
|
||||||
```
|
```
|
||||||
sudo apt install xdotool
|
|
||||||
pip install --user vosk
|
pip install --user vosk
|
||||||
```
|
```
|
||||||
|
|
||||||
Arch
|
Arch
|
||||||
```
|
```
|
||||||
sudo pacman -S xdotool
|
|
||||||
pip install --user vosk
|
pip install --user vosk
|
||||||
```
|
```
|
||||||
|
|
Binary file not shown.
|
@ -20,12 +20,12 @@ class ZazTalk2Me(unohelper.Base, XJobExecutor):
|
||||||
path_ext = app.paths.from_id(ID_EXTENSION)
|
path_ext = app.paths.from_id(ID_EXTENSION)
|
||||||
path_model = app.paths.join(path_ext, 'model')
|
path_model = app.paths.join(path_ext, 'model')
|
||||||
nd.main_begin(vosk_model_dir=path_model, config_override=None)
|
nd.main_begin(vosk_model_dir=path_model, config_override=None)
|
||||||
app.info('Start')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def trigger(self, args):
|
def trigger(self, args):
|
||||||
if args=='start':
|
if args=='start':
|
||||||
self._start()
|
self._start()
|
||||||
|
app.info('Start')
|
||||||
elif args=='end':
|
elif args=='end':
|
||||||
nd.main_end()
|
nd.main_end()
|
||||||
app.info('End')
|
app.info('End')
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
This is a utility that activates text to speech in Linux.
|
This is a utility that activates text to speech in Linux.
|
||||||
While it could use any system currently it uses the VOSK-API.
|
While it could use any system currently it uses the VOSK-API.
|
||||||
"""
|
"""
|
||||||
|
import easymacro as app
|
||||||
# See: `hacking.rst` for developer notes.
|
# See: `hacking.rst` for developer notes.
|
||||||
|
|
||||||
# All built in modules.
|
# All built in modules.
|
||||||
|
@ -68,7 +68,15 @@ def run_xdotool(subcommand: str, payload: List[str]) -> None:
|
||||||
"--clearmodifiers",
|
"--clearmodifiers",
|
||||||
] + payload
|
] + payload
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(cmd)
|
# ~ print(cmd)
|
||||||
|
# ~ type or key
|
||||||
|
rango = app.selection.goto_end()
|
||||||
|
if subcommand == 'type':
|
||||||
|
word = payload[-1]
|
||||||
|
rango.string = word
|
||||||
|
else:
|
||||||
|
rango.go_left(count=len(payload), expand=True).string = ''
|
||||||
|
# ~ subprocess.check_output(cmd)
|
||||||
except FileNotFoundError as ex:
|
except FileNotFoundError as ex:
|
||||||
print("Command {!r} not found: {!s}".format(cmd_base, ex))
|
print("Command {!r} not found: {!s}".format(cmd_base, ex))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -762,6 +770,8 @@ def text_from_vosk_pipe(
|
||||||
sys.stderr.write("--input %r not supported.\n" % input_method)
|
sys.stderr.write("--input %r not supported.\n" % input_method)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# ~ print(cmd)
|
||||||
|
# ~ ('parec', '--record', '--rate=44100', '--channels=1', '--format=s16ne', '--latency=10')
|
||||||
ps = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
ps = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
stdout = ps.stdout
|
stdout = ps.stdout
|
||||||
|
|
Loading…
Reference in New Issue