fix debug export replay source timestamp handling

This commit is contained in:
Josh Hawkins 2026-05-18 17:06:59 -05:00
parent df5e6c5936
commit 8202fda2f5
3 changed files with 5 additions and 4 deletions

View File

@ -398,7 +398,7 @@ class _StreamingZipBuffer:
def _unique_archive_name(export: Export, used: set[str]) -> str: def _unique_archive_name(export: Export, used: set[str]) -> str:
base = sanitize_filename(export.name) if export.name else None base = sanitize_filename(export.name) if export.name else None
if not base: if not base:
base = f"{export.camera}_{int(datetime.datetime.timestamp(export.date))}" base = f"{export.camera}_{int(export.date)}"
candidate = f"{base}.mp4" candidate = f"{base}.mp4"
counter = 1 counter = 1

View File

@ -14,7 +14,6 @@ import threading
import time import time
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from datetime import datetime
from typing import TYPE_CHECKING, Any, Optional, cast from typing import TYPE_CHECKING, Any, Optional, cast
from peewee import ModelSelect from peewee import ModelSelect
@ -209,7 +208,9 @@ class ExportDebugReplaySource(DebugReplaySource):
def __init__(self, export: Export, duration: float) -> None: def __init__(self, export: Export, duration: float) -> None:
self._camera = cast(str, export.camera) self._camera = cast(str, export.camera)
self._start_ts = datetime.timestamp(cast(datetime, export.date)) # Export.date is declared DateTimeField but Frigate writes raw unix
# timestamps to the column.
self._start_ts = float(cast(Any, export.date))
self._video_path = cast(str, export.video_path) self._video_path = cast(str, export.video_path)
self._duration = duration self._duration = duration

View File

@ -230,7 +230,7 @@ class TestExportResolution(unittest.TestCase):
id=export_id, id=export_id,
camera=camera, camera=camera,
name=f"export-{export_id}", name=f"export-{export_id}",
date=datetime.datetime.now(), date=int(datetime.datetime.now().timestamp()),
video_path=f"/media/frigate/exports/{filename}", video_path=f"/media/frigate/exports/{filename}",
thumb_path=f"/media/frigate/exports/{filename}.jpg", thumb_path=f"/media/frigate/exports/{filename}.jpg",
in_progress=False, in_progress=False,