Add gnommo.sh wrapper and fix slide/scaling issues

gnommo.sh:
- Bash wrapper for easy CLI usage
- Commands: validate, transcribe, align, render, all
- `gnommo.sh -p video1 all` runs full pipeline

Slide scaling:
- Slides now scale to full frame (1920x1080)
- Transparent areas show through to layers below
- Positioned at 0,0 for full overlay

targetheight percentage:
- Supports percentage values like "100%"
- Calculates actual height from frame resolution
- "100%" on 1080p = 1080px height

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-12 15:13:33 +01:00
parent 216131e072
commit df900dfd59
4 changed files with 184 additions and 14 deletions
Executable
+157
View File
@@ -0,0 +1,157 @@
#!/bin/bash
#
# GnommoEditor - Code-first video editing pipeline
#
# Usage:
# gnommo.sh -p <project> Render project
# gnommo.sh -p <project> validate Validate only
# gnommo.sh -p <project> transcribe Transcribe video
# gnommo.sh -p <project> align Align markers to transcript
# gnommo.sh -p <project> all Full pipeline: transcribe → align → render
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_PYTHON="$SCRIPT_DIR/venv/bin/python"
# Check for venv
if [[ ! -f "$VENV_PYTHON" ]]; then
echo "Error: Virtual environment not found at $SCRIPT_DIR/venv"
echo "Create it with: python -m venv venv && ./venv/bin/pip install openai-whisper"
exit 1
fi
# Parse arguments
PROJECT=""
COMMAND="render"
VERBOSE=""
usage() {
echo "Usage: gnommo.sh -p <project> [command] [options]"
echo ""
echo "Commands:"
echo " render Render video (default)"
echo " validate Validate project only"
echo " transcribe Transcribe video audio"
echo " align Align manuscript to transcript"
echo " all Full pipeline: transcribe → align → render"
echo ""
echo "Options:"
echo " -p <dir> Project directory (required)"
echo " -v Verbose output"
echo " -h Show this help"
echo ""
echo "Examples:"
echo " gnommo.sh -p video1 # Render video1 project"
echo " gnommo.sh -p video1 validate # Validate only"
echo " gnommo.sh -p video1 all # Full pipeline"
exit 0
}
while [[ $# -gt 0 ]]; do
case $1 in
-p|--project)
PROJECT="$2"
shift 2
;;
-v|--verbose)
VERBOSE="--verbose"
shift
;;
-h|--help)
usage
;;
validate|render|transcribe|align|all)
COMMAND="$1"
shift
;;
*)
echo "Unknown option: $1"
usage
;;
esac
done
# Validate project argument
if [[ -z "$PROJECT" ]]; then
echo "Error: Project directory required (-p <project>)"
echo ""
usage
fi
if [[ ! -d "$PROJECT" ]]; then
echo "Error: Project directory not found: $PROJECT"
exit 1
fi
if [[ ! -f "$PROJECT/project.json" ]]; then
echo "Error: project.json not found in $PROJECT"
exit 1
fi
# Run commands
run_gnommo() {
"$VENV_PYTHON" -m gnommo "$@"
}
case $COMMAND in
validate)
echo "=== Validating $PROJECT ==="
run_gnommo validate "$PROJECT"
;;
transcribe)
echo "=== Transcribing $PROJECT ==="
VIDEO=$(find "$PROJECT/media" -name "*.mov" -o -name "*.mp4" | head -1)
if [[ -z "$VIDEO" ]]; then
echo "Error: No video file found in $PROJECT/media/"
exit 1
fi
run_gnommo transcribe "$VIDEO"
;;
align)
echo "=== Aligning $PROJECT ==="
run_gnommo align "$PROJECT"
;;
render)
echo "=== Rendering $PROJECT ==="
run_gnommo render "$PROJECT" $VERBOSE
;;
all)
echo "=== Full Pipeline: $PROJECT ==="
echo ""
# Step 1: Transcribe
echo ">>> Step 1/3: Transcribe"
VIDEO=$(find "$PROJECT/media" -name "*.mov" -o -name "*.mp4" | grep -v transcript | head -1)
if [[ -z "$VIDEO" ]]; then
echo "Error: No video file found in $PROJECT/media/"
exit 1
fi
TRANSCRIPT="${VIDEO%.*}.transcript.json"
if [[ -f "$TRANSCRIPT" ]]; then
echo " Transcript exists, skipping: $TRANSCRIPT"
else
run_gnommo transcribe "$VIDEO"
fi
echo ""
# Step 2: Align
echo ">>> Step 2/3: Align"
run_gnommo align "$PROJECT"
echo ""
# Step 3: Render
echo ">>> Step 3/3: Render"
run_gnommo render "$PROJECT" $VERBOSE
;;
*)
echo "Unknown command: $COMMAND"
usage
;;
esac