check if fullvod exists; store config in UserConfigDir
All checks were successful
/ build-linux-amd64 (push) Successful in 1m8s
All checks were successful
/ build-linux-amd64 (push) Successful in 1m8s
This commit is contained in:
parent
c3dc6f095e
commit
aa28ffedc8
3 changed files with 58 additions and 13 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue