37 lines
893 B
Python
37 lines
893 B
Python
import uno
|
|
import unohelper
|
|
from com.sun.star.task import XJobExecutor
|
|
|
|
import easymacro as app
|
|
import nerd_dictation as nd
|
|
|
|
|
|
ID_EXTENSION = 'net.elmau.zaz.talk'
|
|
SERVICE = ('com.sun.star.task.Job',)
|
|
|
|
|
|
class ZazTalk2Me(unohelper.Base, XJobExecutor):
|
|
|
|
def __init__(self, ctx):
|
|
self.ctx = ctx
|
|
|
|
@app.run_in_thread
|
|
def _start(self):
|
|
path_ext = app.paths.from_id(ID_EXTENSION)
|
|
path_model = app.paths.join(path_ext, 'model', app.LANG)
|
|
nd.main_begin(vosk_model_dir=path_model, config_override=None)
|
|
return
|
|
|
|
def trigger(self, args):
|
|
if args=='start':
|
|
self._start()
|
|
app.info('Start')
|
|
elif args=='end':
|
|
nd.main_end()
|
|
app.info('End')
|
|
return
|
|
|
|
|
|
g_ImplementationHelper = unohelper.ImplementationHelper()
|
|
g_ImplementationHelper.addImplementation(ZazTalk2Me, ID_EXTENSION, SERVICE)
|