From e3aebdcbb73e979de99232b85d9bd17f677d5176 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Fri, 26 Dec 2025 20:17:24 -0500 Subject: [PATCH] Fix subtitle module drag and drop and remove emojis from scripts - Wrap entire subtitle module content in droppable container for drag and drop anywhere - Remove all emojis from build scripts (build-linux.sh, build.sh, build-windows.sh, alias.sh) - Subtitle module now accepts video/subtitle file drops on any part of the view Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- scripts/alias.sh | 8 +++---- scripts/build-linux.sh | 24 ++++++++++---------- scripts/build-windows.sh | 48 ++++++++++++++++++++-------------------- scripts/build.sh | 26 +++++++++++----------- subtitles_module.go | 10 ++++++--- 5 files changed, 60 insertions(+), 56 deletions(-) diff --git a/scripts/alias.sh b/scripts/alias.sh index 227a375..3dcce35 100755 --- a/scripts/alias.sh +++ b/scripts/alias.sh @@ -9,21 +9,21 @@ alias VideoTools="bash $PROJECT_ROOT/scripts/run.sh" # Also create a rebuild function for quick rebuilds VideoToolsRebuild() { - echo "๐Ÿ”จ Rebuilding VideoTools..." + echo "Rebuilding VideoTools..." bash "$PROJECT_ROOT/scripts/build.sh" } # Create a clean function VideoToolsClean() { - echo "๐Ÿงน Cleaning VideoTools build artifacts..." + echo "Cleaning VideoTools build artifacts..." cd "$PROJECT_ROOT" go clean -cache -modcache -testcache rm -f "$PROJECT_ROOT/VideoTools" - echo "โœ“ Clean complete" + echo "Clean complete" } echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" -echo "โœ… VideoTools Commands Available" +echo "VideoTools Commands Available" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" echo "" echo "Commands:" diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index 2913485..122320f 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -17,49 +17,49 @@ echo "" # Check if go is installed if ! command -v go &> /dev/null; then - echo "โŒ ERROR: Go is not installed. Please install Go 1.21 or later." + echo "ERROR: Go is not installed. Please install Go 1.21 or later." exit 1 fi -echo "๐Ÿ“ฆ Go version:" +echo "Go version:" go version echo "" # Change to project directory cd "$PROJECT_ROOT" -echo "๐Ÿงน Cleaning previous builds and cache..." +echo "Cleaning previous builds and cache..." go clean -cache -testcache 2>/dev/null || true rm -f "$BUILD_OUTPUT" 2>/dev/null || true # Also clear build cache directory to avoid permission issues rm -rf "${GOCACHE:-$HOME/.cache/go-build}" 2>/dev/null || true -echo "โœ“ Cache cleaned" +echo "Cache cleaned" echo "" -echo "โฌ‡๏ธ Downloading and verifying dependencies (skips if already cached)..." +echo "Downloading and verifying dependencies (skips if already cached)..." if go list -m all >/dev/null 2>&1; then - echo "โœ“ Dependencies already present" + echo "Dependencies already present" else if go mod download && go mod verify; then - echo "โœ“ Dependencies downloaded and verified" + echo "Dependencies downloaded and verified" else - echo "โŒ Failed to download/verify modules. Check network/GOPROXY or try again." + echo "Failed to download/verify modules. Check network/GOPROXY or try again." exit 1 fi fi echo "" -echo "๐Ÿ”จ Building VideoTools..." +echo "Building VideoTools..." # Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled. export CGO_ENABLED=1 export GOCACHE="$PROJECT_ROOT/.cache/go-build" export GOMODCACHE="$PROJECT_ROOT/.cache/go-mod" mkdir -p "$GOCACHE" "$GOMODCACHE" if go build -o "$BUILD_OUTPUT" .; then - echo "โœ“ Build successful! (VideoTools $APP_VERSION)" + echo "Build successful! (VideoTools $APP_VERSION)" echo "" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" - echo "โœ… BUILD COMPLETE - $APP_VERSION" + echo "BUILD COMPLETE - $APP_VERSION" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" echo "" echo "Output: $BUILD_OUTPUT" @@ -74,7 +74,7 @@ if go build -o "$BUILD_OUTPUT" .; then echo " VideoTools" echo "" else - echo "โŒ Build failed! (VideoTools $APP_VERSION)" + echo "Build failed! (VideoTools $APP_VERSION)" echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')" echo "" echo "Help: check the Go error messages above." diff --git a/scripts/build-windows.sh b/scripts/build-windows.sh index a9725c3..962594a 100755 --- a/scripts/build-windows.sh +++ b/scripts/build-windows.sh @@ -15,17 +15,17 @@ echo "" # Check if go is installed if ! command -v go &> /dev/null; then - echo "โŒ ERROR: Go is not installed. Please install Go 1.21 or later." + echo "ERROR: Go is not installed. Please install Go 1.21 or later." exit 1 fi -echo "๐Ÿ“ฆ Go version:" +echo "Go version:" go version echo "" # Check if MinGW-w64 is installed if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then - echo "โŒ ERROR: MinGW-w64 cross-compiler not found!" + echo "ERROR: MinGW-w64 cross-compiler not found!" echo "" echo "To install on Fedora/RHEL:" echo " sudo dnf install mingw64-gcc mingw64-winpthreads-static" @@ -36,26 +36,26 @@ if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then exit 1 fi -echo "๐Ÿ”ง MinGW-w64 detected:" +echo "MinGW-w64 detected:" x86_64-w64-mingw32-gcc --version | head -1 echo "" # Change to project directory cd "$PROJECT_ROOT" -echo "๐Ÿงน Cleaning previous Windows builds..." +echo "Cleaning previous Windows builds..." rm -f "$BUILD_OUTPUT" 2>/dev/null || true rm -rf "$DIST_DIR" 2>/dev/null || true -echo "โœ“ Previous builds cleaned" +echo "Previous builds cleaned" echo "" -echo "โฌ‡๏ธ Downloading and verifying dependencies..." +echo "Downloading and verifying dependencies..." go mod download go mod verify -echo "โœ“ Dependencies verified" +echo "Dependencies verified" echo "" -echo "๐Ÿ”จ Cross-compiling for Windows (amd64)..." +echo "Cross-compiling for Windows (amd64)..." echo " Target: windows/amd64" echo " Compiler: x86_64-w64-mingw32-gcc" echo "" @@ -73,27 +73,27 @@ export CXX=x86_64-w64-mingw32-g++ LDFLAGS="-H windowsgui -s -w" if go build -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then - echo "โœ“ Cross-compilation successful!" + echo "Cross-compilation successful!" echo "" else - echo "โŒ Build failed!" + echo "Build failed!" exit 1 fi -echo "๐Ÿ“ฆ Creating distribution package..." +echo "Creating distribution package..." mkdir -p "$DIST_DIR" # Copy executable cp "$BUILD_OUTPUT" "$DIST_DIR/" -echo "โœ“ Copied VideoTools.exe" +echo "Copied VideoTools.exe" # Copy documentation -cp README.md "$DIST_DIR/" 2>/dev/null || echo "โš ๏ธ README.md not found" -cp LICENSE "$DIST_DIR/" 2>/dev/null || echo "โš ๏ธ LICENSE not found" +cp README.md "$DIST_DIR/" 2>/dev/null || echo "WARNING: README.md not found" +cp LICENSE "$DIST_DIR/" 2>/dev/null || echo "WARNING: LICENSE not found" # Download and bundle FFmpeg automatically if [ ! -f "ffmpeg.exe" ]; then - echo "๐Ÿ“ฅ FFmpeg not found locally, downloading..." + echo "FFmpeg not found locally, downloading..." FFMPEG_URL="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip" FFMPEG_ZIP="$PROJECT_ROOT/ffmpeg-windows.zip" @@ -102,14 +102,14 @@ if [ ! -f "ffmpeg.exe" ]; then elif command -v curl &> /dev/null; then curl -L "$FFMPEG_URL" -o "$FFMPEG_ZIP" --progress-bar else - echo "โš ๏ธ wget or curl not found. Cannot download FFmpeg automatically." + echo "WARNING: wget or curl not found. Cannot download FFmpeg automatically." echo " Please download manually from: $FFMPEG_URL" echo " Extract ffmpeg.exe and ffprobe.exe to project root" echo "" fi if [ -f "$FFMPEG_ZIP" ]; then - echo "๐Ÿ“ฆ Extracting FFmpeg..." + echo "Extracting FFmpeg..." unzip -q "$FFMPEG_ZIP" "*/bin/ffmpeg.exe" "*/bin/ffprobe.exe" -d "$PROJECT_ROOT/ffmpeg-temp" # Find and copy the executables (they're nested in a versioned directory) @@ -118,28 +118,28 @@ if [ ! -f "ffmpeg.exe" ]; then # Cleanup rm -rf "$PROJECT_ROOT/ffmpeg-temp" "$FFMPEG_ZIP" - echo "โœ“ FFmpeg downloaded and extracted" + echo "FFmpeg downloaded and extracted" fi fi # Bundle FFmpeg with the distribution if [ -f "ffmpeg.exe" ]; then cp ffmpeg.exe "$DIST_DIR/" - echo "โœ“ Bundled ffmpeg.exe" + echo "Bundled ffmpeg.exe" else - echo "โš ๏ธ ffmpeg.exe not found - distribution will require separate FFmpeg installation" + echo "WARNING: ffmpeg.exe not found - distribution will require separate FFmpeg installation" fi if [ -f "ffprobe.exe" ]; then cp ffprobe.exe "$DIST_DIR/" - echo "โœ“ Bundled ffprobe.exe" + echo "Bundled ffprobe.exe" else - echo "โš ๏ธ ffprobe.exe not found" + echo "WARNING: ffprobe.exe not found" fi echo "" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" -echo "โœ… WINDOWS BUILD COMPLETE" +echo "WINDOWS BUILD COMPLETE" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" echo "" echo "Output directory: $DIST_DIR" diff --git a/scripts/build.sh b/scripts/build.sh index c170643..fa0d4af 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -15,23 +15,23 @@ case "$PLATFORM" in Linux*) OS="Linux" ;; Darwin*) OS="macOS" ;; CYGWIN*|MINGW*|MSYS*) OS="Windows" ;; - *) echo "โŒ Unknown platform: $PLATFORM"; exit 1 ;; + *) echo "Unknown platform: $PLATFORM"; exit 1 ;; esac echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" echo " VideoTools ${OS} Build" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" echo "" -echo "๐Ÿ” Detected platform: $OS" +echo "Detected platform: $OS" echo "" # Go check if ! command -v go >/dev/null 2>&1; then - echo "โŒ ERROR: Go is not installed. Please install Go 1.21+ (go version currently missing)." + echo "ERROR: Go is not installed. Please install Go 1.21+ (go version currently missing)." exit 1 fi -echo "๐Ÿ“ฆ Go version:" +echo "Go version:" go version echo "" @@ -50,26 +50,26 @@ case "$OS" in echo "" cd "$PROJECT_ROOT" - echo "๐Ÿงน Cleaning previous builds..." + echo "Cleaning previous builds..." rm -f VideoTools.exe 2>/dev/null || true # Clear Go cache to avoid permission issues go clean -cache -modcache -testcache 2>/dev/null || true - echo "โœ“ Cache cleaned" + echo "Cache cleaned" echo "" - echo "โฌ‡๏ธ Downloading dependencies..." + echo "Downloading dependencies..." go mod download - echo "โœ“ Dependencies downloaded" + echo "Dependencies downloaded" echo "" - echo "๐Ÿ”จ Building VideoTools $APP_VERSION for Windows..." + echo "Building VideoTools $APP_VERSION for Windows..." export CGO_ENABLED=1 if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then - echo "โœ“ Build successful! (VideoTools $APP_VERSION)" + echo "Build successful! (VideoTools $APP_VERSION)" echo "" if [ -f "setup-windows.bat" ]; then echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" - echo "โœ… BUILD COMPLETE - $APP_VERSION" + echo "BUILD COMPLETE - $APP_VERSION" echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" echo "" echo "Output: VideoTools.exe" @@ -93,11 +93,11 @@ case "$OS" in echo "You can skip if FFmpeg is already installed elsewhere." fi else - echo "โœ“ Build complete: VideoTools.exe" + echo "Build complete: VideoTools.exe" diagnostics fi else - echo "โŒ Build failed! (VideoTools $APP_VERSION)" + echo "Build failed! (VideoTools $APP_VERSION)" diagnostics echo "" echo "Help: check the Go error messages above." diff --git a/subtitles_module.go b/subtitles_module.go index 0ea7ece..e2fb5e3 100644 --- a/subtitles_module.go +++ b/subtitles_module.go @@ -488,8 +488,8 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject { rebuildCues() content := container.NewGridWithColumns(2, left, right) - mainContent := container.NewBorder(topBar, bottomBar, nil, nil, content) - return ui.NewDroppable(mainContent, handleDrop) + droppableContent := ui.NewDroppable(content, handleDrop) + return container.NewBorder(topBar, bottomBar, nil, nil, droppableContent) } func (s *appState) setSubtitleStatus(msg string) { @@ -536,7 +536,11 @@ func (s *appState) handleSubtitlesModuleDrop(items []fyne.URI) { s.setSubtitleStatus(err.Error()) } } - s.showSubtitlesView() + + // Refresh the view to show the loaded files + if s.active == "subtitles" { + s.showSubtitlesView() + } } func (s *appState) loadSubtitleFile(path string) error {