mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-03 12:06:07 -04:00
Included local plyer
This commit is contained in:
parent
25f0d52260
commit
f23855fb68
166 changed files with 15862 additions and 0 deletions
25
sbapp/plyer/platforms/linux/tts.py
Normal file
25
sbapp/plyer/platforms/linux/tts.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import subprocess
|
||||
from plyer.facades import TTS
|
||||
from plyer.utils import whereis_exe
|
||||
|
||||
|
||||
class EspeakTextToSpeech(TTS):
|
||||
''' Speaks using the espeak program
|
||||
'''
|
||||
def _speak(self, **kwargs):
|
||||
subprocess.call(["espeak", kwargs.get('message')])
|
||||
|
||||
|
||||
class FliteTextToSpeech(TTS):
|
||||
''' Speaks using the flite program
|
||||
'''
|
||||
def _speak(self, **kwargs):
|
||||
subprocess.call(["flite", "-t", kwargs.get('message'), "play"])
|
||||
|
||||
|
||||
def instance():
|
||||
if whereis_exe('espeak'):
|
||||
return EspeakTextToSpeech()
|
||||
elif whereis_exe('flite'):
|
||||
return FliteTextToSpeech()
|
||||
return TTS()
|
Loading…
Add table
Add a link
Reference in a new issue