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
|
|
@ -30,7 +30,7 @@ Open `http://HOST:8083/` and put the token in the header box for mutating action
|
|||
| Method | Path | Notes |
|
||||
|---|---|---|
|
||||
| GET | `/api/health` | liveness + uptime |
|
||||
| GET | `/api/apps` | compiled-in app modules, channels, registered rewriters |
|
||||
| GET | `/api/apps` | modules/<name>/ providers, channels, registered rewriters |
|
||||
| GET | `/api/streams` | list + runtime (the agent polls this) |
|
||||
| POST | `/api/streams` | create |
|
||||
| GET/PATCH/DELETE | `/api/streams/:id` | detail / edit / delete |
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@ package api
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"drmdecryption/app"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/mpd"
|
||||
"drmdecryption/repo"
|
||||
)
|
||||
|
||||
// appInfo describes one compiled-in app module to the dashboard, so the UI never
|
||||
// has to hardcode a provider or channel name.
|
||||
// appInfo describes one modules/<name>/ provider to the dashboard, so the UI
|
||||
// never has to hardcode a provider or channel name.
|
||||
type appInfo struct {
|
||||
Name string `json:"name"`
|
||||
Channels []channelInfo `json:"channels"`
|
||||
|
|
@ -21,22 +22,27 @@ type channelInfo struct {
|
|||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
// apps answers GET /api/apps: which providers this binary was built with.
|
||||
// apps answers GET /api/apps: which providers exist under modules/.
|
||||
func (h *Handler) apps(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
writeErr(w, http.StatusMethodNotAllowed, "method not allowed")
|
||||
return
|
||||
}
|
||||
out := []appInfo{}
|
||||
for _, a := range app.All() {
|
||||
info := appInfo{Name: a.Name(), Channels: []channelInfo{}, Rewriter: "none"}
|
||||
for _, ch := range a.Channels() {
|
||||
listed, err := modhost.ListAll(repo.Root())
|
||||
if err != nil {
|
||||
writeErr(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
for _, L := range listed {
|
||||
d := L.Desc
|
||||
info := appInfo{Name: d.Name, Channels: []channelInfo{}, Rewriter: "none"}
|
||||
for _, ch := range d.Channels {
|
||||
info.Channels = append(info.Channels, channelInfo{ID: ch.ID, Label: ch.Label})
|
||||
}
|
||||
// A module with no local values file has no channels to offer yet.
|
||||
info.HasConfig = len(info.Channels) > 0
|
||||
if sd, ok := a.(app.StreamDefaults); ok {
|
||||
info.Rewriter = sd.RewriterName()
|
||||
if d.Rewriter != "" {
|
||||
info.Rewriter = d.Rewriter
|
||||
}
|
||||
out = append(out, info)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import (
|
|||
|
||||
"drmdecryption/app"
|
||||
"drmdecryption/apps/streamd/internal/db"
|
||||
"drmdecryption/modhost"
|
||||
"drmdecryption/repo"
|
||||
)
|
||||
|
||||
// streamSettings are the downloader knobs for one stream. They come from the
|
||||
|
|
@ -40,23 +42,21 @@ func settingsFor(st db.Stream) streamSettings {
|
|||
TSReadyBytes: defaultTSReadyBytes,
|
||||
IsHLS: isHLS(st),
|
||||
}
|
||||
if a, err := app.Get(st.App); err == nil {
|
||||
if sd, ok := a.(app.StreamDefaults); ok {
|
||||
if s.VideoSelect == "" {
|
||||
s.VideoSelect = sd.VideoSelect()
|
||||
}
|
||||
if s.AudioSelect == "" {
|
||||
s.AudioSelect = sd.AudioSelect()
|
||||
}
|
||||
if s.Rewriter == "" {
|
||||
s.Rewriter = sd.RewriterName()
|
||||
}
|
||||
if n := sd.LiveWaitSeconds(); n > 0 {
|
||||
s.LiveWait = n
|
||||
}
|
||||
if n := sd.TSReadyBytes(); n > 0 {
|
||||
s.TSReadyBytes = n
|
||||
}
|
||||
if sd := streamDefaultsFor(st.App); sd != nil {
|
||||
if s.VideoSelect == "" {
|
||||
s.VideoSelect = sd.VideoSelect()
|
||||
}
|
||||
if s.AudioSelect == "" {
|
||||
s.AudioSelect = sd.AudioSelect()
|
||||
}
|
||||
if s.Rewriter == "" {
|
||||
s.Rewriter = sd.RewriterName()
|
||||
}
|
||||
if n := sd.LiveWaitSeconds(); n > 0 {
|
||||
s.LiveWait = n
|
||||
}
|
||||
if n := sd.TSReadyBytes(); n > 0 {
|
||||
s.TSReadyBytes = n
|
||||
}
|
||||
}
|
||||
if s.IsHLS {
|
||||
|
|
@ -79,6 +79,23 @@ func settingsFor(st db.Stream) streamSettings {
|
|||
return s
|
||||
}
|
||||
|
||||
// streamDefaultsFor prefers an external modules/<name>/ provider; falls back to
|
||||
// any in-process app.Register (used by unit tests).
|
||||
func streamDefaultsFor(name string) app.StreamDefaults {
|
||||
if name == "" {
|
||||
return nil
|
||||
}
|
||||
if a, err := modhost.Open(repo.Root(), name); err == nil {
|
||||
return a
|
||||
}
|
||||
if a, err := app.Get(name); err == nil {
|
||||
if sd, ok := a.(app.StreamDefaults); ok {
|
||||
return sd
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// isHLS reports whether a stream's manifest is an HLS playlist, by URL shape.
|
||||
// No provider host is consulted: a module declares its own needs through
|
||||
// app.StreamDefaults.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue