Fix build: remove unused imports, drop playSess img refs, cleanup state init

This commit is contained in:
Stu 2025-12-13 21:58:41 -05:00
parent c81d540b0f
commit 03b6804a9e

20
main.go
View File

@ -4,15 +4,12 @@ import (
"bufio" "bufio"
"bytes" "bytes"
"context" "context"
"encoding/binary"
"encoding/json" "encoding/json"
"errors" "errors"
"flag" "flag"
"fmt" "fmt"
"image"
"image/color" "image/color"
"image/png" "image/png"
"io"
"math" "math"
"net/url" "net/url"
"os" "os"
@ -42,7 +39,6 @@ import (
"git.leaktechnologies.dev/stu/VT_Player/internal/queue" "git.leaktechnologies.dev/stu/VT_Player/internal/queue"
"git.leaktechnologies.dev/stu/VT_Player/internal/ui" "git.leaktechnologies.dev/stu/VT_Player/internal/ui"
"git.leaktechnologies.dev/stu/VT_Player/internal/utils" "git.leaktechnologies.dev/stu/VT_Player/internal/utils"
"github.com/hajimehoshi/oto"
) )
// Module describes a high level tool surface that gets a tile on the menu. // Module describes a high level tool surface that gets a tile on the menu.
@ -2034,7 +2030,6 @@ func runGUI() {
a.Settings().SetTheme(&ui.MonoTheme{}) a.Settings().SetTheme(&ui.MonoTheme{})
logging.Debug(logging.CatUI, "created fyne app: %#v", a) logging.Debug(logging.CatUI, "created fyne app: %#v", a)
w := a.NewWindow("VT Player") w := a.NewWindow("VT Player")
state.window = w
if icon := utils.LoadAppIcon(); icon != nil { if icon := utils.LoadAppIcon(); icon != nil {
a.SetIcon(icon) a.SetIcon(icon)
w.SetIcon(icon) w.SetIcon(icon)
@ -3948,21 +3943,6 @@ func (s *appState) showFrameManual(path string, img *canvas.Image) {
} }
func (s *appState) captureCoverFromCurrent() (string, error) { func (s *appState) captureCoverFromCurrent() (string, error) {
// If we have a play session active, capture the current playing frame
if s.playSess != nil && s.playSess.img != nil && s.playSess.img.Image != nil {
dest := filepath.Join(os.TempDir(), fmt.Sprintf("videotools-cover-%d.png", time.Now().UnixNano()))
f, err := os.Create(dest)
if err != nil {
return "", err
}
defer f.Close()
if err := png.Encode(f, s.playSess.img.Image); err != nil {
return "", err
}
return dest, nil
}
// Otherwise use the current preview frame
if s.currentFrame == "" { if s.currentFrame == "" {
return "", fmt.Errorf("no frame available") return "", fmt.Errorf("no frame available")
} }