added a dedicated sleep function
This commit is contained in:
@@ -30,6 +30,11 @@ c,f,h,i,l,m,o,q,t,u,v,w<br/>
|
|||||||
**--help, -h**<br/>
|
**--help, -h**<br/>
|
||||||
Output's this help text and exits<br/>
|
Output's this help text and exits<br/>
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
- Get the dictation to work with non-latin letters
|
||||||
|
- Get more languages supported
|
||||||
|
- Make the voice sound less robotic
|
||||||
|
|
||||||
## Languages
|
## Languages
|
||||||
Current languages: English or Spanish, I plan to add more though.<br/>
|
Current languages: English or Spanish, I plan to add more though.<br/>
|
||||||
The languages were downloaded from monkeytype.com
|
The languages were downloaded from monkeytype.com
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def words(config, engine):
|
|||||||
engine.say(word)
|
engine.say(word)
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
# Break between words as determined by the wpm
|
# Break between words as determined by the wpm
|
||||||
time.sleep(1/(config['wpm']/60))
|
maths.sleep(config['wpm'])
|
||||||
|
|
||||||
# TIMED #
|
# TIMED #
|
||||||
def timed(config, engine):
|
def timed(config, engine):
|
||||||
@@ -46,8 +46,7 @@ def timed(config, engine):
|
|||||||
print(f'{word} ')
|
print(f'{word} ')
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
# Break between words as determined by the wpm
|
# Break between words as determined by the wpm
|
||||||
time.sleep(1/(config['wpm']/60))
|
maths.sleep(config['wpm'])
|
||||||
|
|
||||||
# check if too much time has elapsed for mode: time
|
# check if too much time has elapsed for mode: time
|
||||||
now = time.time()
|
now = time.time()
|
||||||
# Break condition
|
# Break condition
|
||||||
@@ -73,7 +72,7 @@ def quote(config, engine):
|
|||||||
engine.say(word)
|
engine.say(word)
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
# Break between words as determined by the wpm
|
# Break between words as determined by the wpm
|
||||||
time.sleep(1/(config['wpm']/60))
|
maths.sleep(config['wpm'])
|
||||||
|
|
||||||
# FILE #
|
# FILE #
|
||||||
def file(config, engine):
|
def file(config, engine):
|
||||||
@@ -93,4 +92,4 @@ def file(config, engine):
|
|||||||
engine.say(word)
|
engine.say(word)
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
# Break between words as determined by the wpm
|
# Break between words as determined by the wpm
|
||||||
time.sleep(1/(config['wpm']/60))
|
maths.sleep(config['wpm'])
|
||||||
|
|||||||
7
maths.py
7
maths.py
@@ -1,4 +1,11 @@
|
|||||||
import random
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
# Random number generator that's biased towards 0
|
# Random number generator that's biased towards 0
|
||||||
def biased_random(max_value, strength=3):
|
def biased_random(max_value, strength=3):
|
||||||
return round((random.random() ** strength) * max_value)
|
return round((random.random() ** strength) * max_value)
|
||||||
|
def sleep(wpm):
|
||||||
|
sleep_time = (1/(wpm/60))-1
|
||||||
|
if sleep_time > 0.0:
|
||||||
|
time.sleep(sleep_time)
|
||||||
|
|
||||||
|
|||||||
@@ -105,5 +105,7 @@
|
|||||||
{ "quote":"A computer is like air conditioning - it becomes useless when you open Windows", "author":"Linus Torvalds"},
|
{ "quote":"A computer is like air conditioning - it becomes useless when you open Windows", "author":"Linus Torvalds"},
|
||||||
{ "quote":"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.", "author": "Linus Torvalds"},
|
{ "quote":"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.", "author": "Linus Torvalds"},
|
||||||
{ "quote":"An idiot admires complexity, a genius admires simplicity.", "author":"Terry A. Davis"},
|
{ "quote":"An idiot admires complexity, a genius admires simplicity.", "author":"Terry A. Davis"},
|
||||||
{ "quote":"It is not the well-fed long-haired man I fear, but the pale and the hungry looking.", "author":"Gauis Julius Caesar"}
|
{ "quote":"It is not the well-fed long-haired man I fear, but the pale and the hungry looking.", "author":"Gauis Julius Caesar"},
|
||||||
|
{ "quote":"No, Luke, I am your father", "author":"Anakin Skywalker"},
|
||||||
|
{ "quote":"Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?", "author":"J.R.R. Tolkien (Gandalf)"}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user