forked from Leak_Technologies/VideoTools
Add build/run scripts and fix DVD options visibility
Added scripts folder with three convenience scripts: • scripts/build.sh - Clean build with dependency verification • scripts/run.sh - Run application (auto-builds if needed) • scripts/alias.sh - Create 'VideoTools' command alias Usage: source scripts/alias.sh VideoTools # Run app VideoToolsRebuild # Force rebuild VideoToolsClean # Clean artifacts Fixed main.go DVD options: • Fixed callback ordering so updateDVDOptions is called on format selection • DVD aspect ratio selector now appears when DVD format is selected • DVD info display shows specs for NTSC and PAL formats • Works in both Simple and Advanced tabs DVD options are now fully functional in the UI.
This commit is contained in:
parent
24a76dfaf1
commit
ce60508480
28
main.go
28
main.go
|
|
@ -1397,17 +1397,6 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
|||
formatLabels = append(formatLabels, opt.Label)
|
||||
}
|
||||
outputHint := widget.NewLabel(fmt.Sprintf("Output file: %s", state.convert.OutputFile()))
|
||||
formatSelect := widget.NewSelect(formatLabels, func(value string) {
|
||||
for _, opt := range formatOptions {
|
||||
if opt.Label == value {
|
||||
logging.Debug(logging.CatUI, "format set to %s", value)
|
||||
state.convert.SelectedFormat = opt
|
||||
outputHint.SetText(fmt.Sprintf("Output file: %s", state.convert.OutputFile()))
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
formatSelect.SetSelected(state.convert.SelectedFormat.Label)
|
||||
|
||||
// DVD-specific aspect ratio selector (only shown for DVD formats)
|
||||
dvdAspectSelect := widget.NewSelect([]string{"4:3", "16:9"}, func(value string) {
|
||||
|
|
@ -1442,14 +1431,19 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
|||
}
|
||||
}
|
||||
|
||||
// Update formatSelect callback to also handle DVD options visibility
|
||||
originalFormatCallback := formatSelect.OnChanged
|
||||
formatSelect.OnChanged = func(value string) {
|
||||
if originalFormatCallback != nil {
|
||||
originalFormatCallback(value)
|
||||
// Create formatSelect with callback that updates DVD options
|
||||
formatSelect := widget.NewSelect(formatLabels, func(value string) {
|
||||
for _, opt := range formatOptions {
|
||||
if opt.Label == value {
|
||||
logging.Debug(logging.CatUI, "format set to %s", value)
|
||||
state.convert.SelectedFormat = opt
|
||||
outputHint.SetText(fmt.Sprintf("Output file: %s", state.convert.OutputFile()))
|
||||
updateDVDOptions() // Show/hide DVD options
|
||||
break
|
||||
}
|
||||
updateDVDOptions()
|
||||
}
|
||||
})
|
||||
formatSelect.SetSelected(state.convert.SelectedFormat.Label)
|
||||
|
||||
qualitySelect := widget.NewSelect([]string{"Draft (CRF 28)", "Standard (CRF 23)", "High (CRF 18)", "Lossless"}, func(value string) {
|
||||
logging.Debug(logging.CatUI, "quality preset %s", value)
|
||||
|
|
|
|||
36
scripts/alias.sh
Executable file
36
scripts/alias.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
# VideoTools Convenience Script
|
||||
# Source this file in your shell to add the 'VideoTools' command
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
# Create alias and function for VideoTools
|
||||
alias VideoTools="bash $PROJECT_ROOT/scripts/run.sh"
|
||||
|
||||
# Also create a rebuild function for quick rebuilds
|
||||
VideoToolsRebuild() {
|
||||
echo "🔨 Rebuilding VideoTools..."
|
||||
bash "$PROJECT_ROOT/scripts/build.sh"
|
||||
}
|
||||
|
||||
# Create a clean function
|
||||
VideoToolsClean() {
|
||||
echo "🧹 Cleaning VideoTools build artifacts..."
|
||||
cd "$PROJECT_ROOT"
|
||||
go clean -cache -modcache -testcache
|
||||
rm -f "$PROJECT_ROOT/VideoTools"
|
||||
echo "✓ Clean complete"
|
||||
}
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ VideoTools Commands Available"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " VideoTools - Run VideoTools (auto-builds if needed)"
|
||||
echo " VideoToolsRebuild - Force rebuild of VideoTools"
|
||||
echo " VideoToolsClean - Clean build artifacts and cache"
|
||||
echo ""
|
||||
echo "To make these permanent, add this line to your ~/.bashrc or ~/.zshrc:"
|
||||
echo " source $PROJECT_ROOT/scripts/alias.sh"
|
||||
echo ""
|
||||
61
scripts/build.sh
Executable file
61
scripts/build.sh
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
# VideoTools Build Script
|
||||
# Cleans dependencies and builds the application with proper error handling
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILD_OUTPUT="$PROJECT_ROOT/VideoTools"
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " VideoTools Build Script"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
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."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Go version:"
|
||||
go version
|
||||
echo ""
|
||||
|
||||
# Change to project directory
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "🧹 Cleaning previous builds and cache..."
|
||||
go clean -cache -modcache -testcache 2>/dev/null || true
|
||||
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
|
||||
echo "✓ Cache cleaned"
|
||||
echo ""
|
||||
|
||||
echo "⬇️ Downloading and verifying dependencies..."
|
||||
go mod download
|
||||
go mod verify
|
||||
echo "✓ Dependencies verified"
|
||||
echo ""
|
||||
|
||||
echo "🔨 Building VideoTools..."
|
||||
if CGO_ENABLED=0 go build -o "$BUILD_OUTPUT" .; then
|
||||
echo "✓ Build successful!"
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ BUILD COMPLETE"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Output: $BUILD_OUTPUT"
|
||||
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
|
||||
echo ""
|
||||
echo "To run:"
|
||||
echo " $PROJECT_ROOT/VideoTools"
|
||||
echo ""
|
||||
echo "Or use the convenience script:"
|
||||
echo " source $PROJECT_ROOT/scripts/alias.sh"
|
||||
echo " VideoTools"
|
||||
echo ""
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
32
scripts/run.sh
Executable file
32
scripts/run.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
# VideoTools Run Script
|
||||
# Builds (if needed) and runs the application
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILD_OUTPUT="$PROJECT_ROOT/VideoTools"
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " VideoTools - Run Script"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Check if binary exists
|
||||
if [ ! -f "$BUILD_OUTPUT" ]; then
|
||||
echo "⚠️ Binary not found. Building..."
|
||||
echo ""
|
||||
bash "$PROJECT_ROOT/scripts/build.sh"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Verify binary exists
|
||||
if [ ! -f "$BUILD_OUTPUT" ]; then
|
||||
echo "❌ ERROR: Build failed, cannot run."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🚀 Starting VideoTools..."
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Run the application
|
||||
"$BUILD_OUTPUT" "$@"
|
||||
Loading…
Reference in New Issue
Block a user