Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/clipper/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,12 @@ def getSettingsSchema() -> Dict[str, Any]:
"default": 5000,
"cli_args": ["--cache-max-size-mb"],
},
"move_markup_on_success": {
"type": "boolean",
"description": "Move original markup JSON into output folder after successful processing",
"default": False,
"cli_args": ["--move-markup-on-success"],
},
# Color Grading / UI tuning (GUI only for now)
"lgg_projection_gain": {
"type": "number",
Expand Down
42 changes: 42 additions & 0 deletions src/clipper/gui/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,47 @@ def process_files(self, markup_path: Optional[str] = None, video_path: Optional[
clip_maker.previewClips(self.cs)
message = "Preview completed successfully"

# After successful processing, optionally move the original markup JSON
# into the output folder if the user has enabled the setting and we
# actually processed from a file (not in-memory data). This helps keep
# related artifacts together for archival/organization.
try:
if (
message.startswith("Clips") # only on real generation
and markup_path # only if we have a source file path
and gui_settings.get("move_markup_on_success")
):
src_path = Path(markup_path)
if src_path.exists():
dest_dir = Path(self.cs.clipper_paths.clipsPath)
dest_dir.mkdir(parents=True, exist_ok=True)
dest_path = dest_dir / src_path.name
# Use replace to overwrite if it already exists
if dest_path.resolve() == src_path.resolve():
# Already in the output folder; nothing to do
self.logger.debug(
"Markup file already located in output directory; skipping move",
)
else:
self.logger.debug(
"Moving markup JSON '%s' -> '%s'", src_path, dest_path,
)
try:
# Attempt an atomic-ish move; fallback to copy+unlink if needed
src_path.replace(dest_path)
except Exception:
import shutil
shutil.copy2(src_path, dest_path)
src_path.unlink(missing_ok=True) # type: ignore[arg-type]
self.logger.info(
"Moved markup JSON to output directory: %s", dest_path,
)
except Exception as move_err:
# Non-fatal: we still succeeded overall.
self.logger.warning(
"Failed to move markup JSON to output directory: %s", move_err,
)

# Update persistent cache after processing (preserve RIFE loaded state)
self._update_persistent_cache()

Expand Down Expand Up @@ -297,6 +338,7 @@ def _apply_gui_settings_to_clipper_state(self, gui_settings: Dict[str, Any]) ->
# Other settings
'preview': 'preview',
'notify_on_completion': 'notifyOnCompletion',
'move_markup_on_success': 'moveMarkupOnSuccess', # GUI-only behavioral setting

# yt-dlp settings
'ytdl_location': 'ytdlLocation',
Expand Down
1 change: 1 addition & 0 deletions src/clipper/gui/settings_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class GeneralSettings:
# === COLOR GRADING / UI TUNING ===
# Multiplier applied to LGG color wheel hue projection (was hardcoded 1.5)
lgg_projection_gain: float = 1.5
move_markup_on_success: bool = False

# === WINDOW OPTIONS ===
window_width: int = 1000 # Default window width
Expand Down
8 changes: 8 additions & 0 deletions src/gui-frontend/src/components/SettingsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@
Intensity multiplier for LGG color wheel hue projection. Lower = gentler isolation; higher = stronger channel separation.
</el-text>
</el-form-item>
<el-form-item label="Move markup on success">
<el-switch
:model-value="props.settings?.move_markup_on_success || false"
@update:model-value="(value) => updateBooleanSetting('move_markup_on_success', value)"
:loading="isLoading"
/>
<el-text class="setting-help" type="info">After successful processing, move the original markup JSON into the output clips folder for archival.</el-text>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
Expand Down
1 change: 1 addition & 0 deletions src/gui-frontend/src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface GeneralSettings {

// === COLOR GRADING / UI TUNING ===
lgg_projection_gain: number
move_markup_on_success: boolean
}

export interface VideoSpecificSettings {
Expand Down
Loading