more customisation, more QoL improvements

an all-around good time!
This commit is contained in:
ari melody 2026-01-30 14:14:54 +00:00
parent 2954689784
commit 45db651388
Signed by: ari
GPG key ID: CF99829C92678188
9 changed files with 315 additions and 147 deletions

View file

@ -11,18 +11,19 @@ import (
type (
Category struct {
Name string
Type string
Url string
Name string `toml:"name"`
Type string `toml:"type" comment:"Valid types: gaming, other (default: other)"`
Url string `toml:"url"`
}
Metadata struct {
Title string
Date string
Part int
FootageDir string
Category *Category
Uploaded bool
Title string `toml:"title"`
Part int `toml:"part"`
Date string `toml:"date"`
Tags []string `toml:"tags"`
FootageDir string `toml:"footage_dir"`
Uploaded bool `toml:"uploaded"`
Category *Category `toml:"category" comment:"(Optional) Category details, for additional credits."`
}
)
@ -39,6 +40,7 @@ func ScanSegments(directory string, extension string) ([]string, error) {
for _, item := range entries {
if item.IsDir() { continue }
if !strings.HasSuffix(item.Name(), "." + extension) { continue }
if strings.HasSuffix(item.Name(), "-fullvod." + extension) { continue }
files = append(files, item.Name())
}
@ -67,12 +69,11 @@ func ReadMetadata(directory string) (*Metadata, error) {
func WriteMetadata(directory string, metadata *Metadata) (error) {
file, err := os.OpenFile(
path.Join(directory, METADATA_FILENAME),
os.O_CREATE, 0644,
os.O_CREATE | os.O_RDWR, 0644,
)
if err != nil { return err }
err = toml.NewEncoder(file).Encode(metadata)
return err
}