v0.1.1: external modules, publish YAML, proxy reset, binary-first README
- Host discovers/builds modules under modules/ (bbc, rte, tg4) - module-publish.yaml tracked; local module.yaml gitignored - drm --modules-dir / DRM_MODULES_DIR - drm proxy reset; Magisk reinject reliability - modules-v* Forgejo release workflow + build scripts - BBC full Explore channel map including S4C - README quickstart based on release binaries
This commit is contained in:
parent
1d36961a7c
commit
f9c28be3f1
52 changed files with 2915 additions and 636 deletions
39
modules/README.md
Normal file
39
modules/README.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# External modules
|
||||
|
||||
Each subdirectory is a provider the `drm` host discovers, builds, and runs.
|
||||
|
||||
```
|
||||
modules/
|
||||
bbc/
|
||||
module-publish.yaml # tracked universal values (channels, labels, ui)
|
||||
module.yaml # LOCAL secrets/overrides (gitignored)
|
||||
go.mod + main.go
|
||||
.bin/bbc.exe # built on demand
|
||||
rte/
|
||||
tg4/
|
||||
```
|
||||
|
||||
## Config files
|
||||
|
||||
| File | Published? | Purpose |
|
||||
|---|---|---|
|
||||
| `module-publish.yaml` | yes (in git + release zips) | Universal package/channels/UI |
|
||||
| `module.yaml` | **no** | Operator secrets; overlays publish at runtime |
|
||||
|
||||
Release zips rename `module-publish.yaml` → `module.yaml` so end users edit one file.
|
||||
|
||||
## Commands
|
||||
|
||||
```
|
||||
drm modules
|
||||
drm --modules-dir D:\mods modules
|
||||
drm capture --app bbc --channel s4c
|
||||
DRM_MODULES_DIR=D:\mods drm capture --app rte --channel rteone
|
||||
```
|
||||
|
||||
## Releases
|
||||
|
||||
Push a `modules-v*` tag to publish per-module zips (`module-bbc-….zip`, …) via
|
||||
Forgejo Actions. Host `drm` stays on separate `v*` tags.
|
||||
|
||||
Requires Go on PATH to build from source. Release zips may ship `.bin/` prebuilt.
|
||||
15
modules/bbc/go.mod
Normal file
15
modules/bbc/go.mod
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module null-drm/modules/bbc
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
drmdecryption v0.0.0
|
||||
drmdecryption/modules v0.0.0
|
||||
)
|
||||
|
||||
require gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
replace (
|
||||
drmdecryption => ../../apps/pkg
|
||||
drmdecryption/modules => ../../apps/modules
|
||||
)
|
||||
4
modules/bbc/go.sum
Normal file
4
modules/bbc/go.sum
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
168
modules/bbc/main.go
Normal file
168
modules/bbc/main.go
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
// Command bbc is the external BBC iPlayer provider module.
|
||||
// Built on demand by the drm host: modules/bbc/.bin/bbc[.exe]
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"drmdecryption/adb"
|
||||
appreg "drmdecryption/app"
|
||||
"drmdecryption/modcfg"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/modules/bbc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
cmd, args := os.Args[1], os.Args[2:]
|
||||
var err error
|
||||
switch cmd {
|
||||
case "describe":
|
||||
err = cmdDescribe()
|
||||
case "launch":
|
||||
err = cmdLaunch(args)
|
||||
case "autoplay":
|
||||
err = cmdAutoplay(args)
|
||||
case "catalog":
|
||||
err = cmdCatalog(args)
|
||||
case "help", "-h", "--help":
|
||||
usage()
|
||||
return
|
||||
default:
|
||||
usage()
|
||||
err = fmt.Errorf("unknown command %q", cmd)
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "[!]", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprint(os.Stderr, `bbc — Null DRM external module (BBC iPlayer)
|
||||
|
||||
Usage:
|
||||
bbc describe
|
||||
bbc launch [--serial SERIAL]
|
||||
bbc autoplay --channel ID [--serial SERIAL]
|
||||
bbc catalog --channel ID [--json]
|
||||
`)
|
||||
}
|
||||
|
||||
func loadApp() (appreg.App, error) {
|
||||
return bbc.New()
|
||||
}
|
||||
|
||||
func cmdDescribe() error {
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d := modhost.Describe{
|
||||
Protocol: modhost.ProtocolVersion,
|
||||
Name: a.Name(),
|
||||
Package: a.Package(),
|
||||
LicenseURL: a.LicenseURL(),
|
||||
KeyMode: a.KeyMode(),
|
||||
ProxyBin: a.ProxyBin(),
|
||||
CAHash: a.CAHash(),
|
||||
TransparentMITM: true,
|
||||
Rewriter: "none",
|
||||
ValuesPath: modcfg.Path(a.Name()),
|
||||
}
|
||||
type loaded interface {
|
||||
ConfigLoaded() bool
|
||||
ConfigPath() string
|
||||
}
|
||||
if L, ok := a.(loaded); ok {
|
||||
d.ValuesLoaded = L.ConfigLoaded()
|
||||
if L.ConfigPath() != "" {
|
||||
d.ValuesPath = L.ConfigPath()
|
||||
}
|
||||
}
|
||||
if _, ok := a.(appreg.Catalog); ok {
|
||||
d.HasCatalog = true
|
||||
}
|
||||
h := a.CaptureHints()
|
||||
d.Require = h.Require
|
||||
d.Score = h.Score
|
||||
for _, ch := range a.Channels() {
|
||||
d.Channels = append(d.Channels, modhost.Channel{ID: ch.ID, Label: ch.Label})
|
||||
}
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(d)
|
||||
}
|
||||
|
||||
func cmdLaunch(args []string) error {
|
||||
fs := flag.NewFlagSet("launch", flag.ContinueOnError)
|
||||
serial := fs.String("serial", "", "adb device serial")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
c = c.WithSerial(*serial)
|
||||
}
|
||||
return a.Launch(c)
|
||||
}
|
||||
|
||||
func cmdAutoplay(args []string) error {
|
||||
fs := flag.NewFlagSet("autoplay", flag.ContinueOnError)
|
||||
serial := fs.String("serial", "", "adb device serial")
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *channel == "" {
|
||||
return fmt.Errorf("--channel is required")
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
c = c.WithSerial(*serial)
|
||||
}
|
||||
return a.AutoPlay(c, *channel)
|
||||
}
|
||||
|
||||
func cmdCatalog(args []string) error {
|
||||
fs := flag.NewFlagSet("catalog", flag.ContinueOnError)
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
asJSON := fs.Bool("json", false, "print JSON")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *channel == "" {
|
||||
return fmt.Errorf("--channel is required")
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cat, ok := a.(appreg.Catalog)
|
||||
if !ok {
|
||||
return fmt.Errorf("bbc module has no catalog")
|
||||
}
|
||||
info, err := cat.Resolve(*channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *asJSON {
|
||||
return json.NewEncoder(os.Stdout).Encode(info)
|
||||
}
|
||||
fmt.Printf("mpd: %s\n", info.MPD)
|
||||
return nil
|
||||
}
|
||||
93
modules/bbc/module-publish.yaml
Normal file
93
modules/bbc/module-publish.yaml
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
# BBC iPlayer — published universal values (renamed to module.yaml in release zips).
|
||||
# No secrets. Local overrides / ca_hash / proxy_bin go in gitignored module.yaml.
|
||||
|
||||
package: bbc.iplayer.android
|
||||
proxy_bin: bin/proxy-android-arm64
|
||||
|
||||
# Manifest-URL scoring for the on-device MITM / waiter.
|
||||
score:
|
||||
hosts:
|
||||
- open.live.bbc.co.uk
|
||||
- vs-cmaf-push-uk
|
||||
- vod-dash-uk
|
||||
- akamaized.net
|
||||
- bbci.co.uk
|
||||
- bidi.net.uk
|
||||
- bidi.bbc.co.uk
|
||||
deny:
|
||||
- telemetry.api.bbci
|
||||
- bag.api.bbc
|
||||
- ibl.api.bbci
|
||||
- thumbnail
|
||||
|
||||
aliases:
|
||||
one: bbcone
|
||||
bbc1: bbcone
|
||||
london: bbcone
|
||||
two: bbctwo
|
||||
bbc2: bbctwo
|
||||
three: bbcthree
|
||||
bbc3: bbcthree
|
||||
four: bbcfour
|
||||
bbc4: bbcfour
|
||||
news: bbcnews
|
||||
scotland: bbcscotland
|
||||
alba: bbcalba
|
||||
parliament: bbcparliament
|
||||
radio1: bbcradio1
|
||||
radio: bbcradio1
|
||||
|
||||
# Labels must match Explore-rail content-desc for interactive autoplay.
|
||||
channels:
|
||||
bbcone:
|
||||
label: BBC One
|
||||
vpid: bbc_one_london
|
||||
bbctwo:
|
||||
label: BBC Two
|
||||
vpid: bbc_two_england
|
||||
bbcthree:
|
||||
label: BBC Three
|
||||
vpid: bbc_three
|
||||
bbcfour:
|
||||
label: BBC Four
|
||||
vpid: bbc_four
|
||||
bbcnews:
|
||||
label: BBC News
|
||||
vpid: bbc_news_channel
|
||||
bbcscotland:
|
||||
label: BBC Scotland
|
||||
vpid: bbc_scotland
|
||||
bbcalba:
|
||||
label: BBC ALBA
|
||||
vpid: bbc_alba
|
||||
bbcparliament:
|
||||
label: BBC Parliament
|
||||
vpid: bbc_parliament
|
||||
cbbc:
|
||||
label: CBBC
|
||||
vpid: cbbc
|
||||
cbeebies:
|
||||
label: CBeebies
|
||||
vpid: cbeebies
|
||||
s4c:
|
||||
label: S4C
|
||||
vpid: s4c
|
||||
bbcradio1:
|
||||
label: BBC Radio 1
|
||||
vpid: bbc_radio_one
|
||||
|
||||
# Interactive auto-play: Explore → channel logo → Watch live.
|
||||
timeouts:
|
||||
launch_wait_ui: 30s
|
||||
launch_settle: 4s
|
||||
explore_nav: 20s
|
||||
channel_find: 45s
|
||||
after_channel: 3s
|
||||
watch_live: 20s
|
||||
playback: 60s
|
||||
ui:
|
||||
launch_desc_contains: ["Home", "Explore", "Watchlist", "Watch now"]
|
||||
explore_tab: ["Explore"]
|
||||
watch_live: ["Watch live", "Watch Live"]
|
||||
playback_desc_contains: ["Pause", "pause", "Seek"]
|
||||
channel_scroll_max: 12
|
||||
15
modules/rte/go.mod
Normal file
15
modules/rte/go.mod
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module null-drm/modules/rte
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
drmdecryption v0.0.0
|
||||
drmdecryption/modules v0.0.0
|
||||
)
|
||||
|
||||
require gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
replace (
|
||||
drmdecryption => ../../apps/pkg
|
||||
drmdecryption/modules => ../../apps/modules
|
||||
)
|
||||
4
modules/rte/go.sum
Normal file
4
modules/rte/go.sum
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
170
modules/rte/main.go
Normal file
170
modules/rte/main.go
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
// Command rte is the external RTÉ Player provider module.
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"drmdecryption/adb"
|
||||
appreg "drmdecryption/app"
|
||||
"drmdecryption/modcfg"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/modules/rte"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
cmd, args := os.Args[1], os.Args[2:]
|
||||
var err error
|
||||
switch cmd {
|
||||
case "describe":
|
||||
err = cmdDescribe()
|
||||
case "launch":
|
||||
err = cmdLaunch(args)
|
||||
case "autoplay":
|
||||
err = cmdAutoplay(args)
|
||||
case "catalog":
|
||||
err = cmdCatalog(args)
|
||||
case "help", "-h", "--help":
|
||||
usage()
|
||||
return
|
||||
default:
|
||||
usage()
|
||||
err = fmt.Errorf("unknown command %q", cmd)
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "[!]", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprint(os.Stderr, `rte — Null DRM external module (RTÉ Player)
|
||||
|
||||
Usage:
|
||||
rte describe
|
||||
rte launch [--serial SERIAL]
|
||||
rte autoplay --channel ID [--serial SERIAL]
|
||||
rte catalog --channel ID [--json]
|
||||
`)
|
||||
}
|
||||
|
||||
func loadApp() (appreg.App, error) {
|
||||
return rte.New()
|
||||
}
|
||||
|
||||
func cmdDescribe() error {
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d := modhost.Describe{
|
||||
Protocol: modhost.ProtocolVersion,
|
||||
Name: a.Name(),
|
||||
Package: a.Package(),
|
||||
LicenseURL: a.LicenseURL(),
|
||||
KeyMode: a.KeyMode(),
|
||||
ProxyBin: a.ProxyBin(),
|
||||
CAHash: a.CAHash(),
|
||||
TransparentMITM: false,
|
||||
Rewriter: "rte",
|
||||
ValuesPath: modcfg.Path(a.Name()),
|
||||
}
|
||||
if sd, ok := a.(appreg.StreamDefaults); ok {
|
||||
d.Rewriter = sd.RewriterName()
|
||||
}
|
||||
type loaded interface {
|
||||
ConfigLoaded() bool
|
||||
ConfigPath() string
|
||||
}
|
||||
if L, ok := a.(loaded); ok {
|
||||
d.ValuesLoaded = L.ConfigLoaded()
|
||||
if L.ConfigPath() != "" {
|
||||
d.ValuesPath = L.ConfigPath()
|
||||
}
|
||||
}
|
||||
if _, ok := a.(appreg.Catalog); ok {
|
||||
d.HasCatalog = true
|
||||
}
|
||||
h := a.CaptureHints()
|
||||
d.Require = h.Require
|
||||
d.Score = h.Score
|
||||
for _, ch := range a.Channels() {
|
||||
d.Channels = append(d.Channels, modhost.Channel{ID: ch.ID, Label: ch.Label})
|
||||
}
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(d)
|
||||
}
|
||||
|
||||
func cmdLaunch(args []string) error {
|
||||
fs := flag.NewFlagSet("launch", flag.ContinueOnError)
|
||||
serial := fs.String("serial", "", "adb device serial")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
c = c.WithSerial(*serial)
|
||||
}
|
||||
return a.Launch(c)
|
||||
}
|
||||
|
||||
func cmdAutoplay(args []string) error {
|
||||
fs := flag.NewFlagSet("autoplay", flag.ContinueOnError)
|
||||
serial := fs.String("serial", "", "adb device serial")
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *channel == "" {
|
||||
return fmt.Errorf("--channel is required")
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
c = c.WithSerial(*serial)
|
||||
}
|
||||
return a.AutoPlay(c, *channel)
|
||||
}
|
||||
|
||||
func cmdCatalog(args []string) error {
|
||||
fs := flag.NewFlagSet("catalog", flag.ContinueOnError)
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
asJSON := fs.Bool("json", false, "print JSON")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *channel == "" {
|
||||
return fmt.Errorf("--channel is required")
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cat, ok := a.(appreg.Catalog)
|
||||
if !ok {
|
||||
return fmt.Errorf("rte module has no catalog — use phone capture")
|
||||
}
|
||||
info, err := cat.Resolve(*channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *asJSON {
|
||||
return json.NewEncoder(os.Stdout).Encode(info)
|
||||
}
|
||||
fmt.Printf("mpd: %s\n", info.MPD)
|
||||
return nil
|
||||
}
|
||||
60
modules/rte/module-publish.yaml
Normal file
60
modules/rte/module-publish.yaml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# RTE Player — published universal values (renamed to module.yaml in release zips).
|
||||
# Fill secrets in local module.yaml: license_url, origins, kids (never commit that file).
|
||||
|
||||
package: air.RTE.OSMF.Minimal
|
||||
proxy_bin: bin/proxy-android-arm64
|
||||
|
||||
# SENSITIVE — set in local module.yaml:
|
||||
# license_url: "https://…"
|
||||
|
||||
score:
|
||||
hosts:
|
||||
- live.rte.ie
|
||||
- dai.google.com
|
||||
deny:
|
||||
- feed.entertainment
|
||||
|
||||
aliases:
|
||||
rte1: rteone
|
||||
one: rteone
|
||||
rte2: rtetwo
|
||||
two: rtetwo
|
||||
jr: rtejr
|
||||
news: rtenews
|
||||
newsnow: rtenews
|
||||
|
||||
channels:
|
||||
rteone:
|
||||
label: RTE One
|
||||
chip_desc: ["^rteone$"]
|
||||
play_desc: ["play\\s*rteone"]
|
||||
rtetwo:
|
||||
label: RTE 2
|
||||
chip_desc: ["^rte2$"]
|
||||
play_desc: ["play\\s*rte2"]
|
||||
rtejr:
|
||||
label: RTE jr
|
||||
chip_desc: ["^rtejr$"]
|
||||
play_desc: ["play\\s*rte\\s*jr", "play\\s*rtejr"]
|
||||
rtenews:
|
||||
label: RTE News Now
|
||||
chip_desc: ["^rtenewsnow$", "^rtenews$"]
|
||||
play_desc: ["play\\s*rtenews", "play\\s*rtenewsnow"]
|
||||
|
||||
# SENSITIVE — set in local module.yaml:
|
||||
# origins:
|
||||
# vc11: "https://…"
|
||||
# vc12: "https://…"
|
||||
# kids:
|
||||
# vc11: "…"
|
||||
# vc12: "…"
|
||||
|
||||
ui:
|
||||
launch_desc_contains: ["live tab", "header logo", "Live"]
|
||||
live_tab_desc_re: ["Live tab", "Live"]
|
||||
|
||||
timeouts:
|
||||
launch_wait_ui: 30s
|
||||
launch_settle: 4s
|
||||
live_tab: 30s
|
||||
playback: 45s
|
||||
15
modules/tg4/go.mod
Normal file
15
modules/tg4/go.mod
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module null-drm/modules/tg4
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
drmdecryption v0.0.0
|
||||
drmdecryption/modules v0.0.0
|
||||
)
|
||||
|
||||
require gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
replace (
|
||||
drmdecryption => ../../apps/pkg
|
||||
drmdecryption/modules => ../../apps/modules
|
||||
)
|
||||
4
modules/tg4/go.sum
Normal file
4
modules/tg4/go.sum
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
170
modules/tg4/main.go
Normal file
170
modules/tg4/main.go
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
// Command tg4 is the external TG4 provider module.
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"drmdecryption/adb"
|
||||
appreg "drmdecryption/app"
|
||||
"drmdecryption/modcfg"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/modules/tg4"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
cmd, args := os.Args[1], os.Args[2:]
|
||||
var err error
|
||||
switch cmd {
|
||||
case "describe":
|
||||
err = cmdDescribe()
|
||||
case "launch":
|
||||
err = cmdLaunch(args)
|
||||
case "autoplay":
|
||||
err = cmdAutoplay(args)
|
||||
case "catalog":
|
||||
err = cmdCatalog(args)
|
||||
case "help", "-h", "--help":
|
||||
usage()
|
||||
return
|
||||
default:
|
||||
usage()
|
||||
err = fmt.Errorf("unknown command %q", cmd)
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "[!]", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprint(os.Stderr, `tg4 — Null DRM external module (TG4)
|
||||
|
||||
Usage:
|
||||
tg4 describe
|
||||
tg4 launch [--serial SERIAL]
|
||||
tg4 autoplay --channel ID [--serial SERIAL]
|
||||
tg4 catalog --channel ID [--json]
|
||||
`)
|
||||
}
|
||||
|
||||
func loadApp() (appreg.App, error) {
|
||||
return tg4.New()
|
||||
}
|
||||
|
||||
func cmdDescribe() error {
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d := modhost.Describe{
|
||||
Protocol: modhost.ProtocolVersion,
|
||||
Name: a.Name(),
|
||||
Package: a.Package(),
|
||||
LicenseURL: a.LicenseURL(),
|
||||
KeyMode: a.KeyMode(),
|
||||
ProxyBin: a.ProxyBin(),
|
||||
CAHash: a.CAHash(),
|
||||
TransparentMITM: false,
|
||||
Rewriter: "none",
|
||||
ValuesPath: modcfg.Path(a.Name()),
|
||||
}
|
||||
if sd, ok := a.(appreg.StreamDefaults); ok {
|
||||
d.Rewriter = sd.RewriterName()
|
||||
}
|
||||
type loaded interface {
|
||||
ConfigLoaded() bool
|
||||
ConfigPath() string
|
||||
}
|
||||
if L, ok := a.(loaded); ok {
|
||||
d.ValuesLoaded = L.ConfigLoaded()
|
||||
if L.ConfigPath() != "" {
|
||||
d.ValuesPath = L.ConfigPath()
|
||||
}
|
||||
}
|
||||
if _, ok := a.(appreg.Catalog); ok {
|
||||
d.HasCatalog = true
|
||||
}
|
||||
h := a.CaptureHints()
|
||||
d.Require = h.Require
|
||||
d.Score = h.Score
|
||||
for _, ch := range a.Channels() {
|
||||
d.Channels = append(d.Channels, modhost.Channel{ID: ch.ID, Label: ch.Label})
|
||||
}
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(d)
|
||||
}
|
||||
|
||||
func cmdLaunch(args []string) error {
|
||||
fs := flag.NewFlagSet("launch", flag.ContinueOnError)
|
||||
serial := fs.String("serial", "", "adb device serial")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
c = c.WithSerial(*serial)
|
||||
}
|
||||
return a.Launch(c)
|
||||
}
|
||||
|
||||
func cmdAutoplay(args []string) error {
|
||||
fs := flag.NewFlagSet("autoplay", flag.ContinueOnError)
|
||||
serial := fs.String("serial", "", "adb device serial")
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *channel == "" {
|
||||
return fmt.Errorf("--channel is required")
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c := adb.New()
|
||||
if *serial != "" {
|
||||
c = c.WithSerial(*serial)
|
||||
}
|
||||
return a.AutoPlay(c, *channel)
|
||||
}
|
||||
|
||||
func cmdCatalog(args []string) error {
|
||||
fs := flag.NewFlagSet("catalog", flag.ContinueOnError)
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
asJSON := fs.Bool("json", false, "print JSON")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *channel == "" {
|
||||
return fmt.Errorf("--channel is required")
|
||||
}
|
||||
a, err := loadApp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cat, ok := a.(appreg.Catalog)
|
||||
if !ok {
|
||||
return fmt.Errorf("tg4 module has no catalog")
|
||||
}
|
||||
info, err := cat.Resolve(*channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *asJSON {
|
||||
return json.NewEncoder(os.Stdout).Encode(info)
|
||||
}
|
||||
fmt.Printf("mpd: %s\n", info.MPD)
|
||||
return nil
|
||||
}
|
||||
64
modules/tg4/module-publish.yaml
Normal file
64
modules/tg4/module-publish.yaml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# TG4 — published universal values (renamed to module.yaml in release zips).
|
||||
# Fill secrets in local module.yaml: account_id, policy_key, playback_config_url,
|
||||
# and per-channel video_id / token_field / stream_id_field (never commit that file).
|
||||
|
||||
package: ie.bytes.tg4.tg4videoapp
|
||||
proxy_bin: bin/proxy-android-arm64
|
||||
|
||||
# SENSITIVE — set in local module.yaml:
|
||||
# account_id: "…"
|
||||
# policy_key: "…"
|
||||
# playback_config_url: "https://…"
|
||||
|
||||
score:
|
||||
hosts:
|
||||
- fastly.live.brightcove.com
|
||||
deny:
|
||||
- metrics.brightcove
|
||||
- gnsnpaw.com
|
||||
|
||||
aliases:
|
||||
tg4: ioi
|
||||
live: ioi
|
||||
ireland: ioi
|
||||
cula: cula4
|
||||
plus1: plus
|
||||
"tg4+": plus
|
||||
tg4plus: plus
|
||||
worldwide: ww
|
||||
tg4sport: sport
|
||||
sporttg4: sport
|
||||
|
||||
channels:
|
||||
ioi:
|
||||
label: "TG4 (IOI)"
|
||||
live_card_index: 0
|
||||
# video_id / token_field / stream_id_field → local module.yaml
|
||||
cula4:
|
||||
label: "Cúla4"
|
||||
live_card_index: 1
|
||||
plus:
|
||||
label: "TG4+1"
|
||||
live_card_index: 2
|
||||
sport:
|
||||
label: "Sport TG4"
|
||||
phone_only: true
|
||||
live_card_index: 3
|
||||
ww:
|
||||
label: "TG4 Worldwide"
|
||||
live_card_index: 0
|
||||
|
||||
ui:
|
||||
launch_resource_contains:
|
||||
- rails_swipe_refresh_layout
|
||||
- fragment_drawer_toolbar
|
||||
live_label: live
|
||||
playback_desc_contains: ["video player"]
|
||||
playback_resource_contains: ["brightcove_video_view"]
|
||||
|
||||
timeouts:
|
||||
launch_wait_ui: 30s
|
||||
launch_settle: 4s
|
||||
live_nav: 25s
|
||||
card: 30s
|
||||
playback: 45s
|
||||
Loading…
Add table
Add a link
Reference in a new issue