updated reamde and language files and args

This commit is contained in:
deadvey
2026-03-30 00:34:54 +01:00
parent 17e77c6372
commit 2859b3fbd5
9 changed files with 733 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ def words(config):
dictation = []
if not 'mode_modifier' in config:
config['mode_modifier'] = 20
for i in range(0, config['mode_modifier']):
for i in range(0, config['words']):
word = words_list[maths.biased_random(len(words_list)-1)]
dictation.append(word)
print(word)
@@ -31,9 +31,10 @@ def timed(config):
dump = json.load(file)
words_list = dump['words']
if not 'mode_modifier' in config:
config['mode_modifier'] = 30
config['time'] = 30
# For keeping track of time
start = time.time()
# The words are generated on-demand
while 1==1:
word = words_list[maths.biased_random(len(words_list)-1)]
engine.say(word)
@@ -44,15 +45,15 @@ def timed(config):
# check if too much time has elapsed for mode: time
now = time.time()
# Break condition
if (now-start) > config['mode_modifier']:
if (now-start) > config['time']:
break
def quote(config):
engine = pyttsx3.init()
with open(f'quotes/{config['language']}.json', 'r') as file:
quotes = json.load(file)
if 'mode_modifier' in config:
quote = quotes[config['mode_modifier']]
if 'quoteid' in config:
quote = quotes[config['quoteid']]
else:
x = random.randint(0, len(quotes)-1)
quote = quotes[x]
@@ -65,7 +66,10 @@ def quote(config):
def file(config):
engine = pyttsx3.init()
with open(f'{config['mode_modifier']}', 'r') as file:
if not 'filename' in config:
print('Filename required, use -f <filename>')
exit()
with open(f'{config['filename']}', 'r') as file:
lines = file.readlines()
# Text output
for line in lines: