From fadd2809c89459b4dc432096237951fe48ef05cb Mon Sep 17 00:00:00 2001 From: Alex Ballas Date: Sat, 24 Aug 2024 19:33:32 +0300 Subject: [PATCH] Changes to support updating the ffmpeg path from the settings tab #3 --- internal/gui/gui.go | 11 +++++++++++ internal/gui/settings.go | 1 + 2 files changed, 12 insertions(+) diff --git a/internal/gui/gui.go b/internal/gui/gui.go index e9db3cf..5a37d00 100644 --- a/internal/gui/gui.go +++ b/internal/gui/gui.go @@ -17,6 +17,7 @@ import ( "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/data/binding" "fyne.io/fyne/v2/dialog" + "fyne.io/fyne/v2/storage" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" "github.com/alexballas/go2tv/httphandlers" @@ -66,6 +67,7 @@ type NewScreen struct { mediaFormats []string muError sync.RWMutex mu sync.RWMutex + ffmpegPathChanged bool Medialoop bool sliderActive bool Transcode bool @@ -126,6 +128,14 @@ func Start(ctx context.Context, s *NewScreen) { s.SelectInternalSubs.Disable() } + if s.ffmpegPathChanged { + furi, err := storage.ParseURI("file://" + s.mediafile) + if err == nil { + go selectMediaFile(s, furi) + } + s.ffmpegPathChanged = false + } + if t.Text == "Go2TV" { s.Hotkeys = true return @@ -133,6 +143,7 @@ func Start(ctx context.Context, s *NewScreen) { s.Hotkeys = false } + s.ffmpegPathChanged = false if err := utils.CheckFFmpeg(s.ffmpegPath); err != nil { s.TranscodeCheckBox.Disable() } diff --git a/internal/gui/settings.go b/internal/gui/settings.go index d14aa95..25da973 100644 --- a/internal/gui/settings.go +++ b/internal/gui/settings.go @@ -71,6 +71,7 @@ func settingsWindow(s *NewScreen) fyne.CanvasObject { ffmpegTextEntry.OnChanged = func(update string) { s.ffmpegPath = update fyne.CurrentApp().Preferences().SetString("ffmpeg", update) + s.ffmpegPathChanged = true } debugText := widget.NewLabel("Debug")