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
|
|
@ -1,6 +1,6 @@
|
|||
// Package catalogcmd resolves a channel's stream credentials from its provider's
|
||||
// public catalog, with no phone involved. It is provider-agnostic: any app module
|
||||
// implementing app.Catalog works here.
|
||||
// public catalog, with no phone involved. Providers live under modules/<name>/
|
||||
// and are invoked via modhost.
|
||||
package catalogcmd
|
||||
|
||||
import (
|
||||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"drmdecryption/app"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/repo"
|
||||
"drmdecryption/session"
|
||||
)
|
||||
|
|
@ -19,7 +19,7 @@ import (
|
|||
// Run performs a catalog lookup for one channel.
|
||||
func Run(args []string) error {
|
||||
fs := flag.NewFlagSet("catalog", flag.ExitOnError)
|
||||
appName := fs.String("app", "", "app module to query")
|
||||
appName := fs.String("app", "", "app module under modules/<name>/")
|
||||
channel := fs.String("channel", "", "channel id")
|
||||
asJSON := fs.Bool("json", false, "print streamd-ready JSON only")
|
||||
list := fs.Bool("list", false, "list the app's channels and their catalog ids")
|
||||
|
|
@ -27,8 +27,6 @@ func Run(args []string) error {
|
|||
withKeys := fs.Bool("keys", false, "also fetch PSSH and resolve KID:KEY via the local CDM")
|
||||
python := fs.String("python", "", "python for wvkey.py (default: .venv)")
|
||||
wvd := fs.String("wvd", "", "path to .wvd device file (required with --keys)")
|
||||
// Each module contributes --<app>.<field> overrides for its local values.
|
||||
app.BindFlags(fs)
|
||||
fs.Usage = func() {
|
||||
fmt.Fprintf(fs.Output(), "catalog — resolve a channel from its public catalog (no phone)\n\nUsage:\n catalog --app <%s> --channel ID [--keys] [--json]\n\nFlags:\n", strings.Join(catalogApps(), "|"))
|
||||
fs.PrintDefaults()
|
||||
|
|
@ -40,33 +38,36 @@ func Run(args []string) error {
|
|||
available := catalogApps()
|
||||
if strings.TrimSpace(*appName) == "" {
|
||||
if len(available) != 1 {
|
||||
return fmt.Errorf("--app required (apps with a catalog: %s)", strings.Join(available, ", "))
|
||||
msg := strings.Join(available, ", ")
|
||||
if msg == "" {
|
||||
msg = "(none — add a modules/<name>/ with catalog support)"
|
||||
}
|
||||
return fmt.Errorf("--app required (apps with a catalog: %s)", msg)
|
||||
}
|
||||
*appName = available[0]
|
||||
}
|
||||
a, err := app.Get(*appName)
|
||||
a, err := modhost.Open(repo.Root(), *appName)
|
||||
if err != nil {
|
||||
return err
|
||||
return modhost.FormatUnknown(repo.Root(), *appName)
|
||||
}
|
||||
cat, ok := a.(app.Catalog)
|
||||
if !ok {
|
||||
if !a.Desc.HasCatalog {
|
||||
return fmt.Errorf("app %q has no catalog — capture it from the phone instead: drm capture --app %s", a.Name(), a.Name())
|
||||
}
|
||||
|
||||
if *list {
|
||||
return listChannels(a, cat)
|
||||
return listChannels(a)
|
||||
}
|
||||
if strings.TrimSpace(*channel) == "" {
|
||||
return fmt.Errorf("--channel required (see: drm catalog --app %s --list)", a.Name())
|
||||
}
|
||||
|
||||
info, err := cat.Resolve(*channel)
|
||||
info, err := a.Resolve(*channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *withKeys {
|
||||
fmt.Fprintln(os.Stderr, "[*] fetching PSSH + Widevine keys…")
|
||||
if err := cat.EnrichWithKeys(&info, *python, *wvd); err != nil {
|
||||
if err := a.EnrichWithKeys(&info, *python, *wvd); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "[+] key %s (%d total)\n", info.Key, len(info.Keys))
|
||||
|
|
@ -87,48 +88,23 @@ func Run(args []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// catalogApps lists compiled-in modules that can answer catalog lookups.
|
||||
// catalogApps lists external modules that advertise HasCatalog.
|
||||
func catalogApps() []string {
|
||||
listed, err := modhost.ListAll(repo.Root())
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
out := []string{}
|
||||
for _, a := range app.All() {
|
||||
if _, ok := a.(app.Catalog); ok {
|
||||
out = append(out, a.Name())
|
||||
for _, L := range listed {
|
||||
if L.Desc.HasCatalog {
|
||||
out = append(out, L.Desc.Name)
|
||||
}
|
||||
}
|
||||
sort.Strings(out)
|
||||
return out
|
||||
}
|
||||
|
||||
func listChannels(a app.App, cat app.Catalog) error {
|
||||
if l, ok := cat.(app.CatalogLister); ok {
|
||||
rows, flags, err := l.ListChannels()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("%-10s %-16s %s\n", "CHANNEL", "CATALOG ID", "LABEL")
|
||||
sort.Slice(rows, func(i, j int) bool { return rows[i].ID < rows[j].ID })
|
||||
for _, r := range rows {
|
||||
id := r.CatalogID
|
||||
if id == "" {
|
||||
id = "-"
|
||||
}
|
||||
fmt.Printf("%-10s %-16s %s\n", r.ID, id, r.Label)
|
||||
}
|
||||
if len(flags) > 0 {
|
||||
keys := make([]string, 0, len(flags))
|
||||
for k := range flags {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
parts := make([]string, 0, len(keys))
|
||||
for _, k := range keys {
|
||||
parts = append(parts, fmt.Sprintf("%s=%v", k, flags[k]))
|
||||
}
|
||||
fmt.Printf("\nprovider flags: %s\n", strings.Join(parts, " "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Fall back to the plain channel list every app can produce.
|
||||
func listChannels(a *modhost.RemoteApp) error {
|
||||
fmt.Printf("%-10s %s\n", "CHANNEL", "LABEL")
|
||||
for _, ch := range a.Channels() {
|
||||
fmt.Printf("%-10s %s\n", ch.ID, ch.Label)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue