MCPcopy
hub / github.com/nikopueringer/CorridorKey / interactive_wizard

Function interactive_wizard

corridorkey_cli.py:445–683  ·  view source on GitHub ↗
(win_path: str, device: str | None = None)

Source from the content-addressed store, hash-verified

443
444
445def interactive_wizard(win_path: str, device: str | None = None) -> None:
446 console.print(Panel("[bold]CORRIDOR KEY — SMART WIZARD[/bold]", style="cyan"))
447
448 # 1. Resolve Path
449 console.print(f"Windows Path: {win_path}")
450
451 # Perform a check, if we expect user to provide us directory,
452 # but accidentially gave us the path to the footage instead,
453 # we should presume the parent folder as substitution instead.
454 if os.path.isfile(win_path):
455 win_path = os.path.abspath(os.path.join(win_path, os.pardir))
456
457 if os.path.exists(win_path):
458 process_path = win_path
459 console.print(f"Running locally: [bold]{process_path}[/bold]")
460 else:
461 process_path = map_path(win_path)
462 console.print(f"Linux/Remote Path: [bold]{process_path}[/bold]")
463
464 if not os.path.exists(process_path):
465 console.print(
466 f"\n[bold red]ERROR:[/bold red] Path does not exist locally OR on Linux mount!\n"
467 f"Expected Linux Mount Root: {LINUX_MOUNT_ROOT}"
468 )
469 raise typer.Exit(code=1)
470
471 # 2. Analyze — shot or project?
472 target_is_shot = False
473 if os.path.exists(os.path.join(process_path, "Input")) or glob.glob(os.path.join(process_path, "Input.*")):
474 target_is_shot = True
475
476 work_dirs: list[str] = []
477 # Pipeline output dirs, not clip sources
478 excluded_dirs = {"Output", "AlphaHint", "VideoMamaMaskHint", ".ipynb_checkpoints"}
479 if target_is_shot:
480 work_dirs = [process_path]
481 else:
482 work_dirs = [
483 os.path.join(process_path, d)
484 for d in os.listdir(process_path)
485 if os.path.isdir(os.path.join(process_path, d)) and d not in excluded_dirs
486 ]
487
488 console.print(f"\nFound [bold]{len(work_dirs)}[/bold] potential clip folders.")
489
490 # Files already named Input/AlphaHint/etc are organized, not "loose"
491 known_names = {"input", "alphahint", "videomamamaskhint"}
492 loose_videos = [
493 f
494 for f in os.listdir(process_path)
495 if is_video_file(f)
496 and os.path.isfile(os.path.join(process_path, f))
497 and os.path.splitext(f)[0].lower() not in known_names
498 ]
499
500 dirs_needing_org = []
501 for d in work_dirs:
502 has_input = os.path.exists(os.path.join(d, "Input")) or glob.glob(os.path.join(d, "Input.*"))

Callers 1

wizardFunction · 0.85

Calls 12

find_assetsMethod · 0.95
map_pathFunction · 0.90
is_video_fileFunction · 0.90
organize_targetFunction · 0.90
ClipEntryClass · 0.90
run_videomamaFunction · 0.90
generate_alphasFunction · 0.90
run_birefnetFunction · 0.90
run_inferenceFunction · 0.90
ProgressContextClass · 0.85

Tested by

no test coverage detected