mirror of
https://github.com/Xevion/byte-me.git
synced 2025-12-06 01:14:33 -06:00
chore: last progress before tauri
This commit is contained in:
37
app.go
37
app.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user