Reverse video compile checkbox

This commit is contained in:
Arnaud_Cayrol 2025-04-12 22:09:13 +02:00
parent e0d50cd496
commit ee7f450a96
2 changed files with 12 additions and 12 deletions

11
main.py
View file

@ -76,7 +76,7 @@ def background_process(
max_workers: int = 1,
progress_callback: Callable = None,
cancel_flag: Callable = None,
compile_video: bool = False,
do_not_compile_video: bool = False,
framerate: int = 15
) -> List[str]:
"""Process faces in the background and optionally compile a timelapse video.
@ -85,7 +85,7 @@ def background_process(
max_workers: Number of worker processes for face processing
progress_callback: Optional callback for progress updates
cancel_flag: Optional function to check for cancellation
compile_video: Whether to compile a timelapse video after processing
do_not_compile_video: Whether to not compile a timelapse video after processing
framerate: Frames per second for the output video
"""
try:
@ -97,7 +97,7 @@ def background_process(
cancel_flag=cancel_flag
)
if compile_video and not cancel_flag():
if not do_not_compile_video and not cancel_flag():
if progress_callback:
progress_callback(0, 1) # Reset progress for video compilation
@ -109,6 +109,7 @@ def background_process(
framerate=framerate,
update_progress=progress_callback
)
progress_info["status"] = "video_done" if success else "error:Video compilation failed"
except Exception as e:
logger.error(f"Error in background process: {str(e)}")
@ -169,7 +170,7 @@ def index() -> str:
config.date_from = request.form.get("date_from")
config.date_to = request.form.get("date_to")
max_workers = int(request.form.get("max_workers"))
compile_video = request.form.get("compile_video") == "on"
do_not_compile_video = request.form.get("do_not_compile_video") == "on"
framerate = int(request.form.get("framerate", 15))
# Reset progress info
@ -187,7 +188,7 @@ def index() -> str:
"max_workers": max_workers,
"progress_callback": update_progress,
"cancel_flag": lambda: cancel_requested,
"compile_video": compile_video,
"do_not_compile_video": do_not_compile_video,
"framerate": framerate
}
)

View file

@ -216,8 +216,8 @@
<div class="section-header">Video Output</div>
<div class="form-group">
<div class="checkbox-container">
<input type="checkbox" id="compile_video" name="compile_video">
<label for="compile_video">Compile timelapse into video</label>
<input type="checkbox" id="do_not_compile_video" name="do_not_compile_video">
<label for="do_not_compile_video">Do not compile images into a video</label>
</div>
</div>
<div class="form-group" id="framerateGroup" style="display:none;">
@ -275,8 +275,8 @@
}
// Toggle framerate field visibility based on checkbox
document.getElementById('compile_video').addEventListener('change', function() {
document.getElementById('framerateGroup').style.display = this.checked ? 'block' : 'none';
document.getElementById('do_not_compile_video').addEventListener('change', function() {
document.getElementById('framerateGroup').style.display = this.checked ? 'none' : 'block';
});
// Cancel button
@ -322,11 +322,10 @@
progressText.textContent = "Processing cancelled.";
} else if (data.status === "done") {
progressText.textContent = "Processing complete!";
} else if (data.status === "compiling_video") {
progressText.textContent = "Images generated, creating video";
} else if (data.status === "video_done") {
progressText.textContent = "Video compilation complete!";
videoResult.style.display = "block";
videoLink.href = "/output/timelapse.mp4";
videoLink.textContent = "Download Timelapse Video";
} else if (data.status.startsWith("error:")) {
progressText.textContent = data.status;
} else if (data.total > 0) {