mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 05:35:25 +03:00
Save full frame always
This commit is contained in:
parent
27cd5a07e2
commit
5eedccdacc
@ -611,9 +611,8 @@ def export_recording(camera_name: str, start_time, end_time):
|
||||
json: dict[str, any] = request.get_json(silent=True) or {}
|
||||
playback_factor = json.get("playback", "realtime")
|
||||
name: Optional[str] = json.get("name")
|
||||
existing_thumb: Optional[str] = json.get("thumb")
|
||||
|
||||
if len(name) > 256 or len(existing_thumb) > 256:
|
||||
if len(name or "") > 256:
|
||||
return make_response(
|
||||
jsonify({"success": False, "message": "File name is too long."}),
|
||||
401,
|
||||
@ -642,7 +641,6 @@ def export_recording(camera_name: str, start_time, end_time):
|
||||
current_app.frigate_config,
|
||||
camera_name,
|
||||
secure_filename(name.replace(" ", "_")) if name else None,
|
||||
secure_filename(existing_thumb),
|
||||
int(start_time),
|
||||
int(end_time),
|
||||
(
|
||||
|
||||
@ -48,7 +48,6 @@ class RecordingExporter(threading.Thread):
|
||||
config: FrigateConfig,
|
||||
camera: str,
|
||||
name: str,
|
||||
existing_thumb: str,
|
||||
start_time: int,
|
||||
end_time: int,
|
||||
playback_factor: PlaybackFactorEnum,
|
||||
@ -57,7 +56,6 @@ class RecordingExporter(threading.Thread):
|
||||
self.config = config
|
||||
self.camera = camera
|
||||
self.user_provided_name = name
|
||||
self.existing_thumb = existing_thumb
|
||||
self.start_time = start_time
|
||||
self.end_time = end_time
|
||||
self.playback_factor = playback_factor
|
||||
@ -72,9 +70,7 @@ class RecordingExporter(threading.Thread):
|
||||
def save_thumbnail(self, id: str) -> str:
|
||||
thumb_path = os.path.join(CLIPS_DIR, f"export/{id}.webp")
|
||||
|
||||
if self.existing_thumb and os.path.isfile(self.existing_thumb):
|
||||
shutil.copyfile(self.existing_thumb, thumb_path)
|
||||
else:
|
||||
|
||||
if datetime.datetime.fromtimestamp(
|
||||
self.start_time
|
||||
) < datetime.datetime.now().replace(minute=0, second=0):
|
||||
@ -235,7 +231,7 @@ class RecordingExporter(threading.Thread):
|
||||
|
||||
logger.debug(f"Updating finalized export {file_path}")
|
||||
os.rename(file_path, final_file_path)
|
||||
export_id = "".join(random.choices(string.ascii_lowercase + string.digits, k=6))
|
||||
export_id = f"{self.camera}_{''.join(random.choices(string.ascii_lowercase + string.digits, k=6))}"
|
||||
|
||||
thumb_path = self.save_thumbnail(export_id)
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ class PendingReviewSegment:
|
||||
self.frame = np.zeros((THUMB_HEIGHT * 3 // 2, THUMB_WIDTH), np.uint8)
|
||||
self.frame_active_count = 0
|
||||
self.frame_path = os.path.join(
|
||||
CLIPS_DIR, f"review/thumb-{self.camera}-{self.id}.jpg"
|
||||
CLIPS_DIR, f"review/thumb-{self.camera}-{self.id}.webp"
|
||||
)
|
||||
|
||||
def update_frame(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user