summaryrefslogtreecommitdiff
path: root/src/home
diff options
context:
space:
mode:
Diffstat (limited to 'src/home')
-rw-r--r--src/home/camera/util.py10
-rw-r--r--src/home/http/http.py2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/home/camera/util.py b/src/home/camera/util.py
index 5f18a1f..39bfcd3 100644
--- a/src/home/camera/util.py
+++ b/src/home/camera/util.py
@@ -63,9 +63,11 @@ async def ffmpeg_cut(input: str,
def dvr_scan_timecodes(timecodes: str) -> list[tuple[int, int]]:
+ tc_backup = timecodes
+
timecodes = timecodes.split(',')
if len(timecodes) % 2 != 0:
- raise ValueError('invalid number of timecodes')
+ raise DVRScanInvalidTimecodes(f'invalid number of timecodes. input: {tc_backup}')
timecodes = list(map(time2seconds, timecodes))
timecodes = list(chunks(timecodes, 2))
@@ -73,7 +75,7 @@ def dvr_scan_timecodes(timecodes: str) -> list[tuple[int, int]]:
# sort out invalid fragments (dvr-scan returns them sometimes, idk why...)
timecodes = list(filter(lambda f: f[0] < f[1], timecodes))
if not timecodes:
- raise ValueError('no valid timecodes')
+ raise DVRScanInvalidTimecodes(f'no valid timecodes. input: {tc_backup}')
# https://stackoverflow.com/a/43600953
timecodes.sort(key=lambda interval: interval[0])
@@ -88,6 +90,10 @@ def dvr_scan_timecodes(timecodes: str) -> list[tuple[int, int]]:
return merged
+class DVRScanInvalidTimecodes(Exception):
+ pass
+
+
def has_handle(fpath):
for proc in psutil.process_iter():
try:
diff --git a/src/home/http/http.py b/src/home/http/http.py
index 6ce16c4..8e9d3b2 100644
--- a/src/home/http/http.py
+++ b/src/home/http/http.py
@@ -93,4 +93,4 @@ class HTTPServer:
event_loop.run_forever()
def ok(self, data=None):
- return ok(data)
+ return ok(data) \ No newline at end of file