From 6ed1c6493e7a87967bb540479dbc9e0aa3c45c30 Mon Sep 17 00:00:00 2001 From: deadvey Date: Sun, 29 Mar 2026 20:23:59 +0100 Subject: [PATCH] Added file mode support --- config.json | 3 ++- dictate.py | 10 ++++++++++ main.py | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/config.json b/config.json index 64681d3..d2dc8b3 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { - "mode": "quote", + "mode": "words", + "mode_modifier": 30, "wpm": 50, "language": "english" } diff --git a/dictate.py b/dictate.py index ad997fb..2896fed 100644 --- a/dictate.py +++ b/dictate.py @@ -59,3 +59,13 @@ def quote(config): engine.runAndWait() time.sleep(1/(config['wpm']/60)) +def file(config): + engine = pyttsx3.init() + with open(f'{config['mode_modifier']}', 'r') as file: + lines = file.readlines() + for line in lines: + for word in line.split(' '): + print(word,end=' ') + engine.say(word) + engine.runAndWait() + time.sleep(1/(config['wpm']/60)) diff --git a/main.py b/main.py index b34caff..4fb9463 100644 --- a/main.py +++ b/main.py @@ -23,3 +23,5 @@ if config['mode'] == 'timed': dictate.timed(config) if config['mode'] == 'quote': dictate.quote(config) +if config['mode'] == 'file': + dictate.file(config)