Use review item thumbnail for export (#12998)

* Use review item thumbnail for export

* Formatting
This commit is contained in:
Nicolas Mowen 2024-08-12 08:26:54 -06:00
parent c16450adc8
commit 2cb81ef116
3 changed files with 14 additions and 2 deletions

View File

@ -55,6 +55,8 @@ def export_recording(camera_name: str, start_time, end_time):
401,
)
existing_image = json.get("image_path")
recordings_count = (
Recordings.select()
.where(
@ -78,6 +80,7 @@ def export_recording(camera_name: str, start_time, end_time):
current_app.frigate_config,
camera_name,
friendly_name,
existing_image,
int(start_time),
int(end_time),
(

View File

@ -10,6 +10,7 @@ import subprocess as sp
import threading
from enum import Enum
from pathlib import Path
from typing import Optional
from peewee import DoesNotExist
@ -49,7 +50,8 @@ class RecordingExporter(threading.Thread):
self,
config: FrigateConfig,
camera: str,
name: str,
name: Optional[str],
image: Optional[str],
start_time: int,
end_time: int,
playback_factor: PlaybackFactorEnum,
@ -58,6 +60,7 @@ class RecordingExporter(threading.Thread):
self.config = config
self.camera = camera
self.user_provided_name = name
self.user_provided_image = image
self.start_time = start_time
self.end_time = end_time
self.playback_factor = playback_factor
@ -72,6 +75,12 @@ class RecordingExporter(threading.Thread):
def save_thumbnail(self, id: str) -> str:
thumb_path = os.path.join(CLIPS_DIR, f"export/{id}.webp")
if self.user_provided_image is not None and os.path.isfile(
self.user_provided_image
):
shutil.copy(self.user_provided_image, thumb_path)
return thumb_path
if (
self.start_time
< datetime.datetime.now(datetime.timezone.utc)

View File

@ -190,7 +190,7 @@ export default function EventView({
axios
.post(
`export/${review.camera}/start/${review.start_time - REVIEW_PADDING}/end/${endTime}`,
{ playback: "realtime" },
{ playback: "realtime", image_path: review.thumb_path },
)
.then((response) => {
if (response.status == 200) {