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,5 +1,5 @@
|
|||
// Package modulescmd lists the app modules compiled into this binary, their
|
||||
// channels, and where each one's local values came from.
|
||||
// Package modulescmd lists provider modules discovered under modules/<name>/,
|
||||
// building them on demand and showing channels + values paths.
|
||||
package modulescmd
|
||||
|
||||
import (
|
||||
|
|
@ -9,11 +9,11 @@ import (
|
|||
"sort"
|
||||
"text/tabwriter"
|
||||
|
||||
"drmdecryption/app"
|
||||
"drmdecryption/modcfg"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/repo"
|
||||
)
|
||||
|
||||
// Run prints the compiled-in app modules.
|
||||
// Run prints external modules under modules/.
|
||||
func Run(args []string) error {
|
||||
fs := flag.NewFlagSet("modules", flag.ExitOnError)
|
||||
verbose := fs.Bool("channels", true, "list each module's channels")
|
||||
|
|
@ -21,54 +21,57 @@ func Run(args []string) error {
|
|||
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")
|
||||
root := repo.Root()
|
||||
listed, err := modhost.ListAll(root)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(listed) == 0 {
|
||||
return fmt.Errorf("no modules found under %s — add modules/<name>/ with Go source + module.yaml (see modules/README.md)", modhost.ModulesDir(root))
|
||||
}
|
||||
|
||||
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
|
||||
for _, L := range listed {
|
||||
d := L.Desc
|
||||
rewriter := d.Rewriter
|
||||
if rewriter == "" {
|
||||
rewriter = "none"
|
||||
}
|
||||
rewriter := "none"
|
||||
if sd, ok := a.(app.StreamDefaults); ok && sd.RewriterName() != "" {
|
||||
rewriter = sd.RewriterName()
|
||||
}
|
||||
pkg := a.Package()
|
||||
pkg := d.Package
|
||||
if pkg == "" {
|
||||
pkg = "(not configured)"
|
||||
}
|
||||
values := modcfg.Path(name)
|
||||
values := d.ValuesPath
|
||||
if values == "" {
|
||||
values = L.Mod.Dir + string(os.PathSeparator) + "module.yaml"
|
||||
}
|
||||
if _, err := os.Stat(values); err != nil {
|
||||
values = "missing: " + values
|
||||
} else if !d.ValuesLoaded {
|
||||
values = values + " (not loaded)"
|
||||
}
|
||||
fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%d\t%s\n",
|
||||
name, pkg, a.KeyMode(), rewriter, len(a.Channels()), values)
|
||||
d.Name, pkg, d.KeyMode, rewriter, len(d.Channels), values)
|
||||
}
|
||||
_ = tw.Flush()
|
||||
|
||||
if !*verbose {
|
||||
return nil
|
||||
}
|
||||
for _, name := range names {
|
||||
a, err := app.Get(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
chans := a.Channels()
|
||||
for _, L := range listed {
|
||||
d := L.Desc
|
||||
chans := append([]modhost.Channel{}, d.Channels...)
|
||||
sort.Slice(chans, func(i, j int) bool { return chans[i].ID < chans[j].ID })
|
||||
fmt.Printf("\n%s channels:", name)
|
||||
fmt.Printf("\n%s channels:", d.Name)
|
||||
if len(chans) == 0 {
|
||||
fmt.Printf(" none — add %s\n", modcfg.Path(name))
|
||||
fmt.Printf(" none — add %s\n", d.ValuesPath)
|
||||
continue
|
||||
}
|
||||
fmt.Println()
|
||||
for _, ch := range chans {
|
||||
catalog := ""
|
||||
if _, ok := a.(app.Catalog); ok {
|
||||
if d.HasCatalog {
|
||||
catalog = " (catalog)"
|
||||
}
|
||||
fmt.Printf(" %-10s %s%s\n", ch.ID, ch.Label, catalog)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue