summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorhmj6502 <hashim@hmj6502.com>2025-12-19 11:12:45 +0000
committerhmj6502 <hashim@hmj6502.com>2025-12-19 11:12:45 +0000
commit1dd32f5dd7bb228713206389646c54edfd585b0a (patch)
tree72c7412b510a0ccfa83c2e76266b529e6e3aeb23 /main.py
parentf24e650c19a1b8862a64749c42dd6b8092765d0c (diff)
downloadlock-n-log-1dd32f5dd7bb228713206389646c54edfd585b0a.tar.gz
lock-n-log-1dd32f5dd7bb228713206389646c54edfd585b0a.tar.bz2
lock-n-log-1dd32f5dd7bb228713206389646c54edfd585b0a.zip
combine timer and stopwatch into one function
they work effectively the same, so add if statements for minor changes. time_left no longer used at all
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py49
1 files changed, 18 insertions, 31 deletions
diff --git a/main.py b/main.py
index 897234c..c59ac4c 100755
--- a/main.py
+++ b/main.py
@@ -24,44 +24,31 @@ while not option:
print("")
if option == 't':
+ timer = "timer"
print("timer length (in minutes)? ", end="", flush=True)
timer_length = inputs.get_pos_int()
while not timer_length:
print("please enter a positive integer")
print("timer length (in minutes)? ", end="", flush=True)
timer_length = inputs.get_pos_int()
-
- time_left, start = timers.countdown(timer_length)
-
- print("\nfocus session finished!\nlogging...")
- session = OrderedDict()
- session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
- session["date"] = start.strftime("%Y-%m-%d")
- session["start"] = start.strftime("%H:%M")
- session["elapsed"] = int(timer_length - time_left.total_seconds())
- session["type"] = "focus"
- session["tag"] = tag
- session["timer"] = "timer"
- session["ratio"] = 0.2
- #print(session)
-
- f.sesh_to_log(session, "lock-n-log.csv")
-
else:
+ timer = "stopwatch"
+ timer_length = 0
print("whenever you're ready, press enter to start", end="", flush=True)
input()
- elapsed, start = timers.stopwatch()
-
- print("\nfocus session finished!\nlogging...")
- session = OrderedDict()
- session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
- session["date"] = start.strftime("%Y-%m-%d")
- session["start"] = start.strftime("%H:%M")
- session["elapsed"] = int(elapsed.total_seconds())
- session["type"] = "focus"
- session["tag"] = tag
- session["timer"] = "stopwatch"
- session["ratio"] = 0.2
- #print(session)
- f.sesh_to_log(session, "lock-n-log.csv")
+elapsed, start = timers.timer(timer_length)
+
+print("\nfocus session finished!\nlogging...")
+session = OrderedDict()
+session["id"] = hashlib.sha256(str(start).encode('utf8')).hexdigest()
+session["date"] = start.strftime("%Y-%m-%d")
+session["start"] = start.strftime("%H:%M")
+session["elapsed"] = int(elapsed.total_seconds())
+session["type"] = "focus"
+session["tag"] = tag
+session["timer"] = timer
+session["ratio"] = 0.2
+#print(session)
+
+f.sesh_to_log(session, "lock-n-log.csv")