Adding changes version 1
This commit is contained in:
@@ -1,154 +1,21 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# GnommoEditor - Code-first video editing pipeline
|
||||
# This is a thin wrapper that activates the venv and runs the Python CLI.
|
||||
#
|
||||
# Usage:
|
||||
# gnommo.sh -p <project> Render project
|
||||
# gnommo.sh -p <project> import Generate slides.json from image files
|
||||
# gnommo.sh -p <project> validate Validate only
|
||||
# gnommo.sh -p <project> preprocess Apply video preprocessing filters
|
||||
# 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
|
||||
# Usage: gnommo -p <project> [action] [options]
|
||||
# Run with -h for full help.
|
||||
#
|
||||
|
||||
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"
|
||||
echo "Create it with: python -m venv venv && ./venv/bin/pip install -e . openai-whisper"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse arguments
|
||||
PROJECT=""
|
||||
COMMAND="render"
|
||||
VERBOSE=""
|
||||
FORCE=""
|
||||
|
||||
usage() {
|
||||
echo "Usage: gnommo.sh -p <project> [command] [options]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " render Render video (default)"
|
||||
echo " import Generate slides.json from image files"
|
||||
echo " validate Validate project only"
|
||||
echo " preprocess Apply video preprocessing filters (chroma key, etc.)"
|
||||
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 " -f Force overwrite existing files"
|
||||
echo " -h Show this help"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " gnommo.sh -p video1 # Render video1 project"
|
||||
echo " gnommo.sh -p video1 import # Generate slides.json"
|
||||
echo " gnommo.sh -p video1 import -f # Force overwrite slides.json"
|
||||
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="-v"
|
||||
shift
|
||||
;;
|
||||
-f|--force)
|
||||
FORCE="-f"
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
import|validate|render|preprocess|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 using new CLI interface
|
||||
run_gnommo() {
|
||||
"$VENV_PYTHON" -m gnommo -p "$PROJECT" -a "$1" $VERBOSE
|
||||
}
|
||||
|
||||
run_gnommo_import() {
|
||||
"$VENV_PYTHON" -m gnommo -p "$PROJECT" -a validate -i $FORCE $VERBOSE
|
||||
}
|
||||
|
||||
case $COMMAND in
|
||||
import)
|
||||
echo "=== Importing assets for $PROJECT ==="
|
||||
run_gnommo_import
|
||||
;;
|
||||
|
||||
validate)
|
||||
echo "=== Validating $PROJECT ==="
|
||||
run_gnommo validate
|
||||
;;
|
||||
|
||||
transcribe)
|
||||
echo "=== Transcribing $PROJECT ==="
|
||||
run_gnommo transcribe
|
||||
;;
|
||||
|
||||
align)
|
||||
echo "=== Aligning $PROJECT ==="
|
||||
run_gnommo align
|
||||
;;
|
||||
|
||||
render)
|
||||
echo "=== Rendering $PROJECT ==="
|
||||
run_gnommo render
|
||||
;;
|
||||
|
||||
preprocess)
|
||||
echo "=== Preprocessing $PROJECT ==="
|
||||
run_gnommo preprocess
|
||||
;;
|
||||
|
||||
all)
|
||||
echo "=== Full Pipeline: $PROJECT ==="
|
||||
run_gnommo all
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown command: $COMMAND"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
# Pass all arguments directly to the Python CLI
|
||||
exec "$VENV_PYTHON" -m gnommo "$@"
|
||||
|
||||
Reference in New Issue
Block a user