aboutsummaryrefslogtreecommitdiff
path: root/events.py
diff options
context:
space:
mode:
authorMark Powers <mark@marks.kitchen>2021-07-12 04:19:46 +0100
committerMark Powers <mark@marks.kitchen>2021-07-12 04:19:46 +0100
commite3f4893b74b97e1de5e126761d9ec6a0f6585888 (patch)
tree8639ffb0dfe056545d5370802932a8133cfe6083 /events.py
parentc985f5cb690189cfa94078b5990da4776dbd0cf4 (diff)
Add recording event placeholder
Diffstat (limited to 'events.py')
-rw-r--r--events.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/events.py b/events.py
index 1ed185c..cbd17ea 100644
--- a/events.py
+++ b/events.py
@@ -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)