Initial commit: Null DRM Official

Capture, decrypt, and restream toolkit with compiled-in app modules
(RTE, TG4, BBC), on-device MITM proxy, streamd control plane, and www.
BBC module.yaml is published (clear streams); other module values stay local.
This commit is contained in:
404errordeveloper 2026-10-06 00:25:35 +02:00
commit 2fa8f2435f
121 changed files with 17802 additions and 0 deletions

View file

@ -0,0 +1,41 @@
package provider
import (
"fmt"
"time"
)
// Duration is a time.Duration that accepts the spellings a module.yaml uses:
// a Go duration string ("25s", "1200ms") or a bare number meaning seconds.
// yaml.v3 decodes time.Duration only as raw nanoseconds, which no one writes.
type Duration time.Duration
// D returns the value as a time.Duration, or def when unset.
func (d Duration) D(def time.Duration) time.Duration {
if d == 0 {
return def
}
return time.Duration(d)
}
func (d *Duration) UnmarshalYAML(unmarshal func(any) error) error {
var s string
if err := unmarshal(&s); err == nil {
if s == "" {
*d = 0
return nil
}
v, err := time.ParseDuration(s)
if err != nil {
return fmt.Errorf("invalid duration %q: %w", s, err)
}
*d = Duration(v)
return nil
}
var f float64
if err := unmarshal(&f); err != nil {
return fmt.Errorf("duration must be a string like \"25s\" or a number of seconds")
}
*d = Duration(time.Duration(f * float64(time.Second)))
return nil
}