diff options
author | Mark Powers <mark@marks.kitchen> | 2021-07-12 04:19:46 +0100 |
---|---|---|
committer | Mark Powers <mark@marks.kitchen> | 2021-07-12 04:19:46 +0100 |
commit | e3f4893b74b97e1de5e126761d9ec6a0f6585888 (patch) | |
tree | 8639ffb0dfe056545d5370802932a8133cfe6083 /events.py | |
parent | c985f5cb690189cfa94078b5990da4776dbd0cf4 (diff) |
Add recording event placeholder
Diffstat (limited to 'events.py')
-rw-r--r-- | events.py | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -2,6 +2,7 @@ import subprocess from datetime import datetime from config import config import requests +from multiprocessing import Process class Event(): def __init__(self, dial_manager, phone_held, phone_hung_up): @@ -89,3 +90,32 @@ class TimerEvent(Event): end = datetime.now() print(end - start) return "time" + +class RecordThread(Process): + def __init__(self): + super().__init__() + self.daemon = True + + def run(self): + subprocess.run(["time", "cat"]) + + +class RecordEvent(Event): + def get_name(self): + return "recorder" + + def get_text(self): + start = datetime.now() + print("timer start", start) + + record_thread = RecordThread() + record_thread.start() + + self.phone_hung_up.wait() + print("terminating") + record_thread.terminate() + + end = datetime.now() + print(end - start) + + return str(end-start) |