Skip to content

Xilu017 Remove Show

src.xil_pipeline.XILU017_remove_show

xil-remove-show — remove all workspace files for a given show.

Deletes every workspace artifact belonging to the named show
  • configs/{slug}/
  • parsed/{slug}/
  • stems/{slug}/
  • daw/{slug}/
  • masters/{slug}/
  • cues/{slug}/
  • posts/{slug}/
  • legacy root files: cast_{slug}_.json, sfx_{slug}_.json
  • legacy parsed files: parsed/parsed_{slug}.json, parsed/annotated_{slug}_.json, parsed/pre_splice_parsed{slug}_.json, parsed/orig_parsed_{slug}_.json
  • .active_show — cleared if it points to the removed show
  • scripts/{slug}.md — only with --include-scripts

Shared assets (SFX/, logs/) are never touched.

Usage::

xil remove-show mypodcast --dry-run
xil remove-show mypodcast --yes
xil remove-show "My Podcast" --dry-run
xil remove-show mypodcast --include-scripts --dry-run
xil remove-show mypodcast --include-scripts --yes

logger module-attribute

logger = get_logger(__name__)

RemovalItem module-attribute

RemovalItem = _Dir | _File

get_parser

get_parser() -> argparse.ArgumentParser
Source code in src/xil_pipeline/XILU017_remove_show.py
def get_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(
        prog="xil-remove-show",
        description=(
            "Remove all workspace files for a given show. "
            "Shared assets (SFX/, logs/) are never touched."
        ),
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog=(
            "Examples:\n"
            "  xil remove-show mypodcast --dry-run\n"
            "  xil remove-show mypodcast --yes\n"
            '  xil remove-show "My Podcast" --dry-run\n'
            "  xil remove-show mypodcast --include-scripts --yes\n"
        ),
    )
    parser.add_argument(
        "show",
        metavar="SHOW",
        help="Show name or slug to remove (e.g. mypodcast or 'My Podcast')",
    )
    parser.add_argument(
        "--dry-run", "-n",
        action="store_true",
        help="Show what would be removed without deleting anything",
    )
    parser.add_argument(
        "--yes", "-y",
        action="store_true",
        help="Skip the confirmation prompt",
    )
    parser.add_argument(
        "--include-scripts",
        action="store_true",
        help=(
            "Also remove scripts/*_{slug}_*.md files whose filename contains the show slug "
            "(caution: source material)"
        ),
    )
    return parser

main

main() -> None
Source code in src/xil_pipeline/XILU017_remove_show.py
def main() -> None:
    configure_logging()
    args = get_parser().parse_args()

    slug = _resolve_slug(args.show)
    items = _collect(slug, args.include_scripts)

    total_files, total_bytes = _report(items, slug, dry_run=args.dry_run)

    if args.dry_run:
        if total_files > 0 or any(i.path.exists() for i in items):
            logger.info("")
            logger.info("Dry run — nothing deleted. Run without --dry-run to remove.")
        sys.exit(0)

    if total_files == 0 and not any(i.path.exists() for i in items):
        sys.exit(0)

    if not args.yes:
        logger.info("")
        confirm = input(
            f'⚠️  This will permanently delete {total_files} file(s) ({_fmt_bytes(total_bytes)}) '
            f'for show "{slug}".\n'
            f'    Type "{slug}" to confirm (or Ctrl-C to abort): '
        ).strip()
        if confirm != slug:
            logger.info("Aborted — input did not match. Nothing deleted.")
            sys.exit(1)

    logger.info("")
    removed = _delete(items)
    logger.info("")
    logger.info(f"✓ Removed {removed} file(s) for show '{slug}'.")