VT_Player/scripts/run.sh
Stu 9d33575ada Fix CGO type errors and improve GTK player
- Fix render.go CGO type assignments using plain uint32 casts
- Add video playlist tracking with unique IDs
- Improve drag-and-drop: assign to first available pane
- Add parseURIs with crash protection for drag data
- Improve mpv initialization handling
- Update .gitignore for build artifacts (.cache, gtkplayer binary)
- Improve GDK_BACKEND handling in run script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 05:40:37 -05:00

53 lines
2.0 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# VT Player Run Script
# Builds (if needed) and runs the application
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BUILD_OUTPUT="$PROJECT_ROOT/vt_player"
GTK_ENTRY="$PROJECT_ROOT/cmd/gtkplayer"
echo "════════════════════════════════════════════════════════════════"
echo " VT Player - Run Script"
echo "════════════════════════════════════════════════════════════════"
echo ""
# If a GTK entry exists, run it directly (uses mpv embedded)
if [ -d "$GTK_ENTRY" ]; then
echo "🚀 Starting VT Player (GTK/mpv)..."
echo "════════════════════════════════════════════════════════════════"
echo ""
# Prefer an explicit backend only if the user hasnt set one; default to X11 (works under XWayland).
if [ -z "$GDK_BACKEND" ]; then
export GDK_BACKEND=x11
fi
export GOCACHE="$PROJECT_ROOT/.cache/go-build"
export GOMODCACHE="$PROJECT_ROOT/.cache/go-mod"
GOCACHE="$GOCACHE" GOMODCACHE="$GOMODCACHE" \
go run "$GTK_ENTRY"
exit $?
fi
# Fallback to legacy binary
if [ ! -f "$BUILD_OUTPUT" ]; then
echo "⚠️ Binary not found. Building..."
echo ""
bash "$PROJECT_ROOT/scripts/build.sh"
echo ""
fi
if [ ! -f "$BUILD_OUTPUT" ]; then
echo "❌ ERROR: Build failed, cannot run."
exit 1
fi
echo "🚀 Starting VT Player..."
echo "════════════════════════════════════════════════════════════════"
echo ""
if [ "$VTPLAYER_HW" != "1" ]; then
export FYNE_SW_CANVAS=1
export LIBGL_ALWAYS_SOFTWARE=1
fi
"$BUILD_OUTPUT" "$@"