From 254cc1243f0a4ffd54329cc0c02f9466b65faf16 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Tue, 30 Dec 2025 21:15:47 -0500 Subject: [PATCH] Add optional AI upscaling tools installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added support for installing Real-ESRGAN NCNN during setup: **New Features:** - Prompts user to install AI upscaling tools (Real-ESRGAN NCNN) - Downloads and installs binary from GitHub releases - Tries /usr/local/bin with sudo, falls back to ~/.local/bin - Supports x86_64 architecture, warns for ARM - Added --skip-ai flag to skip AI tools prompt **Installation Flow:** 1. Ask: "Install DVD authoring tools?" (dvdauthor + xorriso) 2. Ask: "Install AI upscaling tools?" (Real-ESRGAN NCNN) 3. Auto-install all missing dependencies user requested **Benefits:** - Users get AI upscaling without manual download - FFmpeg native upscaling still works without it - Optional enhancement, not required 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- scripts/install.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 8264a0e..f14bffb 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -32,6 +32,7 @@ PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DVDSTYLER_URL="" DVDSTYLER_ZIP="" SKIP_DVD_TOOLS="" +SKIP_AI_TOOLS="" while [ $# -gt 0 ]; do case "$1" in --dvdstyler-url=*) @@ -54,9 +55,13 @@ while [ $# -gt 0 ]; do SKIP_DVD_TOOLS=true shift ;; + --skip-ai) + SKIP_AI_TOOLS=true + shift + ;; *) echo "Unknown option: $1" - echo "Usage: $0 [--dvdstyler-url URL] [--dvdstyler-zip PATH] [--skip-dvd]" + echo "Usage: $0 [--dvdstyler-url URL] [--dvdstyler-zip PATH] [--skip-dvd] [--skip-ai]" exit 1 ;; esac @@ -173,6 +178,22 @@ else fi fi + # Ask about AI upscaling tools + if [ -z "$SKIP_AI_TOOLS" ]; then + echo "" + read -p "Install AI upscaling tools (Real-ESRGAN NCNN)? [y/N]: " ai_choice + if [[ "$ai_choice" =~ ^[Yy]$ ]]; then + SKIP_AI_TOOLS=false + else + SKIP_AI_TOOLS=true + fi + fi + if [ "$SKIP_AI_TOOLS" = false ]; then + if ! command -v realesrgan-ncnn-vulkan &> /dev/null; then + missing_deps+=("realesrgan-ncnn-vulkan") + fi + fi + install_deps=false if [ ${#missing_deps[@]} -gt 0 ]; then echo -e "${YELLOW}⚠${NC} Missing dependencies: ${missing_deps[*]}" @@ -219,6 +240,51 @@ else echo "Please install: ffmpeg, dvdauthor, and mkisofs/genisoimage/xorriso" exit 1 fi + + # Install Real-ESRGAN NCNN if requested and not available + if [ "$SKIP_AI_TOOLS" = false ] && ! command -v realesrgan-ncnn-vulkan &> /dev/null; then + echo "" + echo "Installing Real-ESRGAN NCNN..." + + # Detect architecture + ARCH=$(uname -m) + if [ "$ARCH" = "x86_64" ]; then + ESRGAN_ARCH="ubuntu" + elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then + echo -e "${YELLOW}⚠${NC} ARM architecture detected. You may need to build realesrgan-ncnn-vulkan from source." + echo "See: https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan" + ESRGAN_ARCH="" + else + echo -e "${YELLOW}⚠${NC} Unsupported architecture: $ARCH" + ESRGAN_ARCH="" + fi + + if [ -n "$ESRGAN_ARCH" ]; then + ESRGAN_URL="https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesrgan-ncnn-vulkan-20220424-ubuntu.zip" + TEMP_DIR=$(mktemp -d) + + if command -v wget &> /dev/null; then + wget -q "$ESRGAN_URL" -O "$TEMP_DIR/realesrgan.zip" + elif command -v curl &> /dev/null; then + curl -sL "$ESRGAN_URL" -o "$TEMP_DIR/realesrgan.zip" + else + echo -e "${YELLOW}⚠${NC} Neither wget nor curl found. Cannot download Real-ESRGAN." + echo "Please install manually from: https://github.com/xinntao/Real-ESRGAN/releases" + fi + + if [ -f "$TEMP_DIR/realesrgan.zip" ]; then + unzip -q "$TEMP_DIR/realesrgan.zip" -d "$TEMP_DIR" + sudo install -m 755 "$TEMP_DIR/realesrgan-ncnn-vulkan" /usr/local/bin/ 2>/dev/null || \ + install -m 755 "$TEMP_DIR/realesrgan-ncnn-vulkan" "$HOME/.local/bin/" 2>/dev/null || \ + echo -e "${YELLOW}⚠${NC} Could not install to /usr/local/bin or ~/.local/bin" + rm -rf "$TEMP_DIR" + + if command -v realesrgan-ncnn-vulkan &> /dev/null; then + echo -e "${GREEN}✓${NC} Real-ESRGAN NCNN installed successfully" + fi + fi + fi + fi fi if ! command -v ffmpeg &> /dev/null; then