Skip to content

Commit

Permalink
Support embedded subs - more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexballas committed Aug 15, 2024
1 parent 534b3fc commit 4aa8264
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions internal/gui/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func selectMediaFile(screen *NewScreen, f fyne.URI) {
return
}

screen.SelectInternalSubs.ClearSelected()
screen.ExternalMediaURL.SetChecked(false)

screen.MediaText.Text = filepath.Base(mfile)
screen.mediafile = absMediaFile

Expand Down
21 changes: 19 additions & 2 deletions internal/gui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package gui
import (
"context"
"errors"
"fmt"
"math"
"net/url"
"os/exec"
Expand Down Expand Up @@ -336,7 +335,6 @@ func mainWindow(s *NewScreen) fyne.CanvasObject {
devicelabel := canvas.NewText("Select Device:", nil)

selectInternalSubs := widget.NewSelect([]string{}, func(item string) {
fmt.Println(item)
if item == "" {
return
}
Expand Down Expand Up @@ -452,6 +450,10 @@ func mainWindow(s *NewScreen) fyne.CanvasObject {
// to indicate that we're expecting a URL
s.MediaText.SetPlaceHolder("Enter URL here")
s.MediaText.Enable()

s.SelectInternalSubs.PlaceHolder = "No Embedded Subs"
s.SelectInternalSubs.ClearSelected()
s.SelectInternalSubs.Disable()
return
}

Expand All @@ -472,6 +474,21 @@ func mainWindow(s *NewScreen) fyne.CanvasObject {
s.mediafile = mediafileOld
mediafilelabel.Refresh()
s.MediaText.Disable()

if mediafileOld != "" {
subs, err := utils.GetSubs(mediafileOld)

Check failure on line 479 in internal/gui/main.go

View workflow job for this annotation

GitHub Actions / build

undefined: utils.GetSubs

Check failure on line 479 in internal/gui/main.go

View workflow job for this annotation

GitHub Actions / build

undefined: utils.GetSubs
if err != nil {
s.SelectInternalSubs.Options = []string{}
s.SelectInternalSubs.PlaceHolder = "No Embedded Subs"
s.SelectInternalSubs.ClearSelected()
s.SelectInternalSubs.Disable()
return
}

s.SelectInternalSubs.PlaceHolder = "Embedded Subs"
s.SelectInternalSubs.Options = subs
s.SelectInternalSubs.Enable()
}
}

medialoop.OnChanged = func(b bool) {
Expand Down

0 comments on commit 4aa8264

Please sign in to comment.