check if fullvod exists; store config in UserConfigDir
All checks were successful
/ build-linux-amd64 (push) Successful in 1m12s

This commit is contained in:
ari melody 2026-01-31 02:28:09 +00:00
parent c3dc6f095e
commit 6adbd3e0f1
Signed by: ari
GPG key ID: CF99829C92678188
3 changed files with 58 additions and 13 deletions

View file

@ -1,12 +1,14 @@
package scanner
import (
"encoding/json"
"os"
"path"
"strings"
"time"
"github.com/pelletier/go-toml/v2"
ffmpeg_go "github.com/u2takey/ffmpeg-go"
)
type (
@ -25,6 +27,15 @@ type (
Uploaded bool `toml:"uploaded"`
Category *Category `toml:"category" comment:"(Optional) Category details, for additional credits."`
}
ffprobeFormat struct {
Duration float64 `json:"duration"`
Size int64 `json:"size"`
}
ffprobeOutput struct {
Format ffprobeFormat `json:"format"`
}
)
const METADATA_FILENAME = "metadata.toml"
@ -47,6 +58,17 @@ func ScanSegments(directory string, extension string) ([]string, error) {
return files, nil
}
func ProbeSegment(filename string) (*ffprobeOutput, error) {
out, err := ffmpeg_go.Probe(filename)
if err != nil { return nil, err }
probe := ffprobeOutput{}
err = json.Unmarshal([]byte(out), probe)
if err != nil { return nil, err }
return &probe, nil
}
func ReadMetadata(directory string) (*Metadata, error) {
metadata := &Metadata{}
file, err := os.OpenFile(