From 514f1a0475fa852ab3939ebc3e8968d43bb20c31 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Tue, 6 Jan 2026 21:09:50 -0500 Subject: [PATCH] Fix menu theme type and add openURL helper --- author_menu.go | 26 +++++++++++++------------- author_module.go | 2 +- main.go | 17 ++++++++++++++--- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/author_menu.go b/author_menu.go index b63cc4c..1b2cd6e 100644 --- a/author_menu.go +++ b/author_menu.go @@ -21,7 +21,7 @@ type dvdMenuButton struct { Y1 int } -type menuTheme struct { +type MenuTheme struct { Name string BackgroundColor string HeaderColor string @@ -41,7 +41,7 @@ type menuLogoOptions struct { // MenuTemplate defines the interface for a DVD menu generator. type MenuTemplate interface { - Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *menuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) + Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *MenuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) } var menuTemplates = map[string]MenuTemplate{ @@ -50,7 +50,7 @@ var menuTemplates = map[string]MenuTemplate{ "Poster": &PosterMenu{}, } -var menuThemes = map[string]*menuTheme{ +var menuThemes = map[string]*MenuTheme{ "VideoTools": { Name: "VideoTools", BackgroundColor: "0x0f172a", @@ -66,7 +66,7 @@ var menuThemes = map[string]*menuTheme{ type SimpleMenu struct{} // Generate creates a simple DVD menu. -func (t *SimpleMenu) Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *menuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) { +func (t *SimpleMenu) Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *MenuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) { width, height := dvdMenuDimensions(region) buttons := buildDVDMenuButtons(chapters, width, height) if len(buttons) == 0 { @@ -116,7 +116,7 @@ func (t *SimpleMenu) Generate(ctx context.Context, workDir, title, region, aspec type DarkMenu struct{} // Generate creates a dark-themed DVD menu. -func (t *DarkMenu) Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *menuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) { +func (t *DarkMenu) Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *MenuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) { width, height := dvdMenuDimensions(region) buttons := buildDVDMenuButtons(chapters, width, height) if len(buttons) == 0 { @@ -166,7 +166,7 @@ func (t *DarkMenu) Generate(ctx context.Context, workDir, title, region, aspect type PosterMenu struct{} // Generate creates a poster-themed DVD menu. -func (t *PosterMenu) Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *menuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) { +func (t *PosterMenu) Generate(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, backgroundImage string, theme *MenuTheme, logo menuLogoOptions, logFn func(string)) (string, []dvdMenuButton, error) { width, height := dvdMenuDimensions(region) buttons := buildDVDMenuButtons(chapters, width, height) if len(buttons) == 0 { @@ -210,7 +210,7 @@ func (t *PosterMenu) Generate(ctx context.Context, workDir, title, region, aspec return menuSpu, buttons, nil } -func buildDVDMenuAssets(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, logFn func(string), template MenuTemplate, backgroundImage string, theme *menuTheme, logo menuLogoOptions) (string, []dvdMenuButton, error) { +func buildDVDMenuAssets(ctx context.Context, workDir, title, region, aspect string, chapters []authorChapter, logFn func(string), template MenuTemplate, backgroundImage string, theme *MenuTheme, logo menuLogoOptions) (string, []dvdMenuButton, error) { if template == nil { template = &SimpleMenu{} } @@ -262,7 +262,7 @@ func buildDVDMenuButtons(chapters []authorChapter, width, height int) []dvdMenuB return buttons } -func buildMenuBackground(ctx context.Context, outputPath, title string, buttons []dvdMenuButton, width, height int, theme *menuTheme, logo menuLogoOptions) error { +func buildMenuBackground(ctx context.Context, outputPath, title string, buttons []dvdMenuButton, width, height int, theme *MenuTheme, logo menuLogoOptions) error { theme = resolveMenuTheme(theme) safeTitle := utils.ShortenMiddle(strings.TrimSpace(title), 40) @@ -307,7 +307,7 @@ func buildMenuBackground(ctx context.Context, outputPath, title string, buttons return runCommandWithLogger(ctx, utils.GetFFmpegPath(), args, nil) } -func buildDarkMenuBackground(ctx context.Context, outputPath, title string, buttons []dvdMenuButton, width, height int, theme *menuTheme, logo menuLogoOptions) error { +func buildDarkMenuBackground(ctx context.Context, outputPath, title string, buttons []dvdMenuButton, width, height int, theme *MenuTheme, logo menuLogoOptions) error { theme = resolveMenuTheme(theme) safeTitle := utils.ShortenMiddle(strings.TrimSpace(title), 40) @@ -352,7 +352,7 @@ func buildDarkMenuBackground(ctx context.Context, outputPath, title string, butt return runCommandWithLogger(ctx, utils.GetFFmpegPath(), args, nil) } -func buildPosterMenuBackground(ctx context.Context, outputPath, title string, buttons []dvdMenuButton, width, height int, backgroundImage string, theme *menuTheme, logo menuLogoOptions) error { +func buildPosterMenuBackground(ctx context.Context, outputPath, title string, buttons []dvdMenuButton, width, height int, backgroundImage string, theme *MenuTheme, logo menuLogoOptions) error { theme = resolveMenuTheme(theme) safeTitle := utils.ShortenMiddle(strings.TrimSpace(title), 40) if safeTitle == "" { @@ -390,7 +390,7 @@ func buildPosterMenuBackground(ctx context.Context, outputPath, title string, bu return runCommandWithLogger(ctx, utils.GetFFmpegPath(), args, nil) } -func buildMenuOverlays(ctx context.Context, overlayPath, highlightPath, selectPath string, buttons []dvdMenuButton, width, height int, theme *menuTheme) error { +func buildMenuOverlays(ctx context.Context, overlayPath, highlightPath, selectPath string, buttons []dvdMenuButton, width, height int, theme *MenuTheme) error { theme = resolveMenuTheme(theme) accent := theme.AccentColor if err := buildMenuOverlay(ctx, overlayPath, buttons, width, height, "0x000000@0.0"); err != nil { @@ -530,7 +530,7 @@ func findMenuFontPath() string { return "" } -func resolveMenuTheme(theme *menuTheme) *menuTheme { +func resolveMenuTheme(theme *MenuTheme) *MenuTheme { if theme == nil { return menuThemes["VideoTools"] } @@ -543,7 +543,7 @@ func resolveMenuTheme(theme *menuTheme) *menuTheme { return menuThemes["VideoTools"] } -func menuFontArg(theme *menuTheme) string { +func menuFontArg(theme *MenuTheme) string { if theme != nil && theme.FontPath != "" { return fmt.Sprintf("fontfile='%s'", theme.FontPath) } diff --git a/author_module.go b/author_module.go index 9d00567..090b978 100644 --- a/author_module.go +++ b/author_module.go @@ -2219,7 +2219,7 @@ func (s *appState) runAuthoringPipeline(ctx context.Context, paths []string, reg logFn, template, menuBackgroundImage, - &menuTheme{Name: menuTheme}, + &MenuTheme{Name: menuTheme}, menuLogoOptions{ Enabled: menuLogoEnabled, Path: menuLogoPath, diff --git a/main.go b/main.go index 462965f..75e2341 100644 --- a/main.go +++ b/main.go @@ -119,6 +119,17 @@ func moduleColor(id string) color.Color { return queueColor } +func openURL(url string) error { + switch runtime.GOOS { + case "darwin": + return exec.Command("open", url).Start() + case "windows": + return exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() + default: + return exec.Command("xdg-open", url).Start() + } +} + // statusStrip renders a consistent dark status area with the shared stats bar. func statusStrip(bar *ui.ConversionStatsBar) fyne.CanvasObject { bg := canvas.NewRectangle(color.NRGBA{R: 34, G: 34, B: 34, A: 255}) @@ -1146,9 +1157,9 @@ type appState struct { authorMenuLogoPosition string // "Top Left", "Top Right", "Bottom Left", "Bottom Right", "Center" authorMenuLogoScale float64 authorMenuLogoMargin int - authorTitle string // DVD title - authorSubtitles []string // Subtitle file paths - authorAudioTracks []string // Additional audio tracks + authorTitle string // DVD title + authorSubtitles []string // Subtitle file paths + authorAudioTracks []string // Additional audio tracks authorSummaryLabel *widget.Label authorTreatAsChapters bool // Treat multiple clips as chapters authorChapterSource string // embedded, scenes, clips, manual