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.
74 lines
2.1 KiB
Go
74 lines
2.1 KiB
Go
package bbc
|
|
|
|
import (
|
|
"time"
|
|
|
|
"drmdecryption/modcfg"
|
|
"drmdecryption/modules/provider"
|
|
)
|
|
|
|
// Name is the module id (--app bbc).
|
|
const Name = "bbc"
|
|
|
|
// Channel is one live (or catch-up) target. Phone UI selectors are optional —
|
|
// capture works with manual play; auto-play uses them when present.
|
|
type Channel struct {
|
|
Label string `yaml:"label"`
|
|
// VPID is the mediaselector version/service id (e.g. bbc_one_london).
|
|
VPID string `yaml:"vpid"`
|
|
// ChipDesc / PlayDesc are optional UI matchers for --auto-play.
|
|
ChipDesc []string `yaml:"chip_desc"`
|
|
PlayDesc []string `yaml:"play_desc"`
|
|
}
|
|
|
|
// Config is apps/modules/bbc/module.yaml.
|
|
type Config struct {
|
|
provider.Common `yaml:",inline"`
|
|
|
|
Channels map[string]Channel `yaml:"channels"`
|
|
|
|
Timeouts Timeouts `yaml:"timeouts"`
|
|
UI UI `yaml:"ui"`
|
|
}
|
|
|
|
// Timeouts for launch / optional autoplay.
|
|
type Timeouts struct {
|
|
LaunchWaitUI provider.Duration `yaml:"launch_wait_ui"`
|
|
LaunchSettle provider.Duration `yaml:"launch_settle"`
|
|
Playback provider.Duration `yaml:"playback"`
|
|
}
|
|
|
|
// UI markers for launch readiness (localized; keep loose).
|
|
type UI struct {
|
|
LaunchDescContains []string `yaml:"launch_desc_contains"`
|
|
LaunchResourceContains []string `yaml:"launch_resource_contains"`
|
|
}
|
|
|
|
func (c Config) withDefaults() Config {
|
|
t := &c.Timeouts
|
|
t.LaunchWaitUI = provider.Duration(t.LaunchWaitUI.D(30 * time.Second))
|
|
t.LaunchSettle = provider.Duration(t.LaunchSettle.D(4 * time.Second))
|
|
t.Playback = provider.Duration(t.Playback.D(60 * time.Second))
|
|
if len(c.UI.LaunchDescContains) == 0 {
|
|
c.UI.LaunchDescContains = []string{"iPlayer", "Home", "Live"}
|
|
}
|
|
return c
|
|
}
|
|
|
|
var flags struct {
|
|
packageName string
|
|
caHash string
|
|
proxyBin string
|
|
}
|
|
|
|
func loadConfig() (Config, modcfg.Result, error) {
|
|
var cfg Config
|
|
res, err := modcfg.Load(Name, &cfg)
|
|
if err != nil {
|
|
return cfg, res, err
|
|
}
|
|
cfg.Package = modcfg.Override(Name, "package", flags.packageName, cfg.Package)
|
|
cfg.CAHash = modcfg.Override(Name, "ca_hash", flags.caHash, cfg.CAHash)
|
|
cfg.ProxyBin = modcfg.Override(Name, "proxy_bin", flags.proxyBin, cfg.ProxyBin)
|
|
return cfg.withDefaults(), res, nil
|
|
}
|