weird but necessary print statement swap
This commit is contained in:
parent
dfdc92a98b
commit
2ed799d9e9
8
main.py
8
main.py
|
@ -88,11 +88,11 @@ def wait_or_enter(duration, i3_focus=False):
|
||||||
stderr=DEVNULL,
|
stderr=DEVNULL,
|
||||||
)
|
)
|
||||||
|
|
||||||
if stop:
|
if time() - start < duration:
|
||||||
return sys.stdin.readline().strip()
|
return sys.stdin.readline().strip()
|
||||||
else:
|
else:
|
||||||
print()
|
|
||||||
tcflush(sys.stdin, TCIOFLUSH)
|
tcflush(sys.stdin, TCIOFLUSH)
|
||||||
|
print(flush=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def write_break_message(msg):
|
def write_break_message(msg):
|
||||||
|
@ -103,7 +103,6 @@ def write_break_message(msg):
|
||||||
print(msg)
|
print(msg)
|
||||||
f.write(msg + "\n")
|
f.write(msg + "\n")
|
||||||
|
|
||||||
|
|
||||||
def main(playlist, work_time, break_time):
|
def main(playlist, work_time, break_time):
|
||||||
interval = generate_interval(work_time, break_time)
|
interval = generate_interval(work_time, break_time)
|
||||||
while True:
|
while True:
|
||||||
|
@ -126,7 +125,6 @@ def main(playlist, work_time, break_time):
|
||||||
|
|
||||||
write_break_message(msg)
|
write_break_message(msg)
|
||||||
|
|
||||||
|
|
||||||
def timer(playlist, duration):
|
def timer(playlist, duration):
|
||||||
second = datetime.now().strftime("%H:%M:%S")
|
second = datetime.now().strftime("%H:%M:%S")
|
||||||
print(second, "wait for", duration, "seconds")
|
print(second, "wait for", duration, "seconds")
|
||||||
|
@ -180,7 +178,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
if args.test_sound:
|
if args.test_sound:
|
||||||
test_playlist(args.playlist)
|
test_playlist(args.playlist)
|
||||||
else:
|
elif args.once is None:
|
||||||
# For some reason the first time I play the playlist it doesn't work.
|
# For some reason the first time I play the playlist it doesn't work.
|
||||||
# This is a workaround.
|
# This is a workaround.
|
||||||
test_playlist(args.playlist, 10)
|
test_playlist(args.playlist, 10)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user