fix: clip pad ±3s + OSD-clock alignment at cut points (single-frame OCR)
ci / smoke (push) Canceled after 0s

This commit is contained in:
andrew committed 2026-09-28 16:33:49 +07:00
1 parent 110d557dbf
commit 14f5ed4aac
7 files changed
+314 -12

No files matched your search

+19 -1
View File
@@ -1575,10 +1575,25 @@ def api_batch_clip(date, batch_number):
except ValueError:
camera_id = 2
try:
pad_seconds = float((os.getenv("MOTIONEYE_CLIP_PAD") or "").strip())
except (TypeError, ValueError):
pad_seconds = 3.0
_align_raw = os.getenv("MOTIONEYE_OSD_ALIGN")
align_osd = (
True if _align_raw is None
else _align_raw.strip().lower() not in ("0", "false", "no", "")
)
if not str(batch_number).isdigit():
return jsonify({"success": False, "error": f"batch_number tidak valid: {batch_number}"}), 400
batch_number = int(batch_number)
print(
f"[CLIP] batch={date}/{batch_number} pad={pad_seconds} align={align_osd}",
flush=True,
)
try:
conn = get_db()
cur = conn.cursor()
@@ -1614,7 +1629,10 @@ def api_batch_clip(date, batch_number):
return jsonify({"success": False, "error": f"Modul klip belum tersedia: {e}"}), 503
try:
clip_batch(motion_url, camera_id, str(start_iso), str(end_iso), tmp_path)
clip_batch(
motion_url, camera_id, str(start_iso), str(end_iso), tmp_path,
pad_seconds=pad_seconds, align_osd=align_osd,
)
except ClipError as ce:
_unlink_quiet(tmp_path)
msg = str(ce)