chore: last progress before tauri

This commit is contained in:
2025-07-13 13:06:44 -05:00
parent edc6056ac1
commit 0e5dede83a
11 changed files with 224 additions and 355 deletions

37
app.go
View File

@@ -3,24 +3,57 @@ package main
import (
"context"
"fmt"
"github.com/wailsapp/wails/v2/pkg/runtime"
"gopkg.in/vansante/go-ffprobe.v2"
)
// App struct
type App struct {
ctx context.Context
ctx context.Context
files []File
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
return &App{
files: []File{},
}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
runtime.OnFileDrop(ctx, func(x, y int, paths []string) {
a.OnFileDrop(x, y, paths)
})
a.ctx = ctx
}
func (a *App) shutdown(ctx context.Context) {
runtime.OnFileDropOff(ctx)
}
func (a *App) GetStream(path string) {
}
func (a *App) OnFileDrop(x, y int, paths []string) {
runtime.LogPrint(a.ctx, fmt.Sprintf("OnFileDrop: %v", paths))
for _, path := range paths {
probe, err := ffprobe.ProbeURL(a.ctx, path)
if err != nil {
runtime.LogPrint(a.ctx, fmt.Sprintf("Error: %v", err))
continue
}
for _, stream := range probe.Streams {
runtime.LogPrint(a.ctx, fmt.Sprintf("Stream: %v", stream))
}
}
}
// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)