Add Python output modules - #1105
Conversation
| if cur_item != "log_level": | ||
| return -1 | ||
|
|
||
| match = re.match(r"\s*([+-]?[0-9]+)", cur_value) |
There was a problem hiding this comment.
I didn't find equivalent to strtol()
There was a problem hiding this comment.
We can simply call int() and return -1 if an exception is caught
|
The Python tests have been successfully run and are available here. |
| self.data = bytearray() | ||
| self.no_lf = 0 | ||
|
|
||
| def module_readline(source=None, block=True): |
There was a problem hiding this comment.
Mmm, module_readline is already available in libspeechd_module, I'd say we can just use it instead of reimplementing it (and thus having to maintain both).
There was a problem hiding this comment.
Note that this is different from module_strip_ssml, as module_readline is available under a BSD license while the existing implementation of module_strip_ssml is available under LGPL.
What I'm thinking is that the python module helper can leverage libspeechd_module to manage the protocol etc. and translate the eventual calls into python calls, plus some helpers to make things easier for module implementors.
| CustomDebugFile = None | ||
|
|
||
|
|
||
| def module_loglevel_set(cur_item, cur_value): |
There was a problem hiding this comment.
this, however, we indeed want to have for module_process.c to call it
| if Debug == 3: | ||
| Debug = 1 | ||
| else: | ||
| Debug = 0 |
There was a problem hiding this comment.
I don't think we want to mimic module_util's way of emitting debug information. Better use a pythonic way
As mentioned above, |
Summary
This PR is a follow-up to #1104 and adds reusable helpers for implementing Speech Dispatcher output modules in Python.
Disclosure: Codex assisted with code review and testing.
Follow-up work
Planned follow-up PRs will:
module_mainandmodule_process) and server-side audio transport.STOP,PAUSE, and complete custom debug logging.