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:
commit
2fa8f2435f
121 changed files with 17802 additions and 0 deletions
78
apps/cli/modulescmd/modulescmd.go
Normal file
78
apps/cli/modulescmd/modulescmd.go
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// Package modulescmd lists the app modules compiled into this binary, their
|
||||
// channels, and where each one's local values came from.
|
||||
package modulescmd
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"text/tabwriter"
|
||||
|
||||
"drmdecryption/app"
|
||||
"drmdecryption/modcfg"
|
||||
)
|
||||
|
||||
// Run prints the compiled-in app modules.
|
||||
func Run(args []string) error {
|
||||
fs := flag.NewFlagSet("modules", flag.ExitOnError)
|
||||
verbose := fs.Bool("channels", true, "list each module's channels")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
names := app.Names()
|
||||
if len(names) == 0 {
|
||||
return fmt.Errorf("no app modules compiled in — check the blank imports in apps/modules/all/all.go")
|
||||
}
|
||||
tw := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0)
|
||||
fmt.Fprintln(tw, "APP\tPACKAGE\tKEY MODE\tREWRITER\tCHANNELS\tVALUES")
|
||||
for _, name := range names {
|
||||
a, err := app.Get(name)
|
||||
if err != nil {
|
||||
fmt.Fprintf(tw, "%s\t-\t-\t-\t-\t%v\n", name, err)
|
||||
continue
|
||||
}
|
||||
rewriter := "none"
|
||||
if sd, ok := a.(app.StreamDefaults); ok && sd.RewriterName() != "" {
|
||||
rewriter = sd.RewriterName()
|
||||
}
|
||||
pkg := a.Package()
|
||||
if pkg == "" {
|
||||
pkg = "(not configured)"
|
||||
}
|
||||
values := modcfg.Path(name)
|
||||
if _, err := os.Stat(values); err != nil {
|
||||
values = "missing: " + values
|
||||
}
|
||||
fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%d\t%s\n",
|
||||
name, pkg, a.KeyMode(), rewriter, len(a.Channels()), values)
|
||||
}
|
||||
_ = tw.Flush()
|
||||
|
||||
if !*verbose {
|
||||
return nil
|
||||
}
|
||||
for _, name := range names {
|
||||
a, err := app.Get(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
chans := a.Channels()
|
||||
sort.Slice(chans, func(i, j int) bool { return chans[i].ID < chans[j].ID })
|
||||
fmt.Printf("\n%s channels:", name)
|
||||
if len(chans) == 0 {
|
||||
fmt.Printf(" none — add %s\n", modcfg.Path(name))
|
||||
continue
|
||||
}
|
||||
fmt.Println()
|
||||
for _, ch := range chans {
|
||||
catalog := ""
|
||||
if _, ok := a.(app.Catalog); ok {
|
||||
catalog = " (catalog)"
|
||||
}
|
||||
fmt.Printf(" %-10s %s%s\n", ch.ID, ch.Label, catalog)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue