fix: remove duplicate code and syntax errors

- Remove orphaned closing brace in author_menu.go
- Remove duplicate code sections in main.go
- Fix non-declaration statements outside function body
- Ensure clean compilation with no syntax errors
- Complete UnifiedPlayerAdapter integration cleanup
This commit is contained in:
Stu Leak 2026-01-06 18:36:07 -05:00
parent 10b605464c
commit 0b1cf8eb19
2 changed files with 2 additions and 52 deletions

View File

@ -463,7 +463,7 @@ func findVTLogoPath() string {
}
if exe, err := os.Executable(); err == nil {
dir := filepath.Dir(exe)
search = append(search, filepath.Join(dir, "assets", "logo", "VT_Icon.png")),
search = append(search, filepath.Join(dir, "assets", "logo", "VT_Icon.png"))
}
for _, p := range search {
if _, err := os.Stat(p); err == nil {
@ -479,4 +479,4 @@ func escapeDrawtextText(text string) string {
escaped = strings.ReplaceAll(escaped, "'", "\\'")
escaped = strings.ReplaceAll(escaped, "%", "\\%")
return escaped
}
}

50
main.go
View File

@ -10996,30 +10996,6 @@ func newPlaySession(path string, w, h int, fps, duration float64, targetW, targe
unifiedAdapter: unifiedAdapter,
}
}
// Create UnifiedPlayer adapter instead of dual-process player
adapter := player.NewUnifiedPlayerAdapter(path, w, h, fps, duration, targetW, targetH, prog, frameFunc, img)
// Create playSession wrapper to maintain interface compatibility
return &playSession{
// Store adapter in videoCmd to avoid breaking existing code
videoCmd: (*exec.Cmd)(unsafe.Pointer(adapter)), // Type hack to store adapter pointer
// Keep interface fields for compatibility
path: path,
fps: fps,
width: w,
height: h,
targetW: targetW,
targetH: targetH,
volume: 100,
duration: duration,
stop: make(chan struct{}),
done: make(chan struct{}),
prog: prog,
frameFunc: frameFunc,
img: img,
}
}
func (p *playSession) Play() {
@ -11225,32 +11201,6 @@ func (p *playSession) SetVolume(v float64) {
p.writeStringToStdin(cmd)
}
}
if v > 100 {
v = 100
}
p.volume = v
if v > 0 {
p.muted = false
} else {
p.muted = true
}
p.mu.Unlock()
// If volume changed significantly, restart audio with new volume filter
// This is necessary because volume is now handled by FFmpeg
if math.Abs(oldVolume-v) > 5 || oldMuted != (v <= 0) {
p.mu.Lock()
if p.audioCmd != nil {
// Restart audio with new volume
currentPos := p.current
p.mu.Unlock()
// Stop and restart audio (video keeps playing)
p.restartAudio(currentPos)
} else {
p.mu.Unlock()
}
}
}
func (p *playSession) restartAudio(offset float64) {
p.mu.Lock()