Added support for different voices, renamed language and quote files with their 2 letter abreviations.
New arguments: -v, -c
This commit is contained in:
9
args.py
9
args.py
@@ -1,12 +1,14 @@
|
||||
import os
|
||||
import json
|
||||
def handle_arguments(arguments, config):
|
||||
def handle_arguments(arguments, config, engine):
|
||||
for index, arg in enumerate(arguments[1:]):
|
||||
match arg:
|
||||
case '--wpm'|'-w':
|
||||
config['wpm'] = int(arguments[index+2])
|
||||
case '--language'|'-l':
|
||||
config['language'] = arguments[index+2]
|
||||
case '--voice'|'-v':
|
||||
config['voice'] = arguments[index+2]
|
||||
case '--mode'|'-m':
|
||||
config['mode'] = arguments[index+2]
|
||||
case '--words'|'-o':
|
||||
@@ -28,6 +30,11 @@ def handle_arguments(arguments, config):
|
||||
for index,quote in enumerate(quotes):
|
||||
print(f'{index}: {quote['quote']} - {quote['author']}')
|
||||
exit()
|
||||
case '--list-voices'|'-c':
|
||||
voices = engine.getProperty('voices')
|
||||
for voice in voices:
|
||||
print(voice)
|
||||
exit()
|
||||
case _:
|
||||
continue
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user