mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add support for espeak-ng. Closes #42438
This commit is contained in:
parent
824524c67a
commit
2d6bb2500e
1 changed files with 9 additions and 8 deletions
|
@ -32,7 +32,7 @@ options:
|
|||
description:
|
||||
What voice to use
|
||||
required: false
|
||||
requirements: [ say or espeak ]
|
||||
requirements: [ say or espeak or espeak-ng ]
|
||||
author:
|
||||
- "Ansible Core Team"
|
||||
- "Michael DeHaan (@mpdehaan)"
|
||||
|
@ -68,17 +68,18 @@ def main():
|
|||
|
||||
msg = module.params['msg']
|
||||
voice = module.params['voice']
|
||||
possibles = ('say', 'espeak', 'espeak-ng')
|
||||
|
||||
executable = module.get_bin_path('say')
|
||||
if not executable:
|
||||
executable = module.get_bin_path('espeak')
|
||||
elif get_platform() != 'Darwin':
|
||||
if get_platform() != 'Darwin':
|
||||
# 'say' binary available, it might be GNUstep tool which doesn't support 'voice' parameter
|
||||
voice = None
|
||||
module.warn("'say' executable found but system is '%s': ignoring voice parameter" % get_platform())
|
||||
|
||||
if not executable:
|
||||
module.fail_json(msg="Unable to find either 'say' or 'espeak' executable")
|
||||
for possible in possibles:
|
||||
executable = module.get_bin_path(possible)
|
||||
if executable:
|
||||
break
|
||||
else:
|
||||
module.fail_json(msg='Unable to find either %s' % ', '.join(possibles))
|
||||
|
||||
if module.check_mode:
|
||||
module.exit_json(msg=msg, changed=False)
|
||||
|
|
Loading…
Reference in a new issue