streamd: preview quality picker, dashboard polish, C4 wrap keys
All checks were successful
release / build-and-upload (push) Successful in 6m18s
modules-release / build-and-upload (push) Successful in 5m18s

- Preview player can select FHD/HD/SD (or ABR master) from publish links
- Embed dashboard screenshots in README; Linux streamd+agent setup guide
- C4 Widevine wrap license mode + require --wvd; prefer Widevine PSSH
- Channel 4 and My5 modules; streamd auth, variants, schedules, HLS gate
This commit is contained in:
404errordeveloper 2026-10-09 20:57:43 +02:00
parent b3955bd81e
commit 066e018749
113 changed files with 19002 additions and 1541 deletions

View file

@ -24,6 +24,9 @@ type Hints struct {
// Score ranks candidate manifest URLs. Zero value falls back to
// DefaultScoreCfg, which has no provider hosts.
Score ScoreCfg
// PreferURLContains boosts MPDs whose URL contains any of these substrings
// (e.g. channel(e4) for Channel 4 Live). Used when an app prefetches neighbours.
PreferURLContains []string
}
// RemoteCapPaths are the on-device locations the MITM may persist its capture
@ -59,10 +62,23 @@ func DefaultPassiveHints() Hints {
// score applies the hints' URL scoring, defaulting when unset.
func (h Hints) score(u string) int {
var sc int
if len(h.Score.Deny) == 0 && len(h.Score.Hosts) == 0 {
return DefaultScoreCfg().Score(u)
sc = DefaultScoreCfg().Score(u)
} else {
sc = h.Score.Score(u)
}
return h.Score.Score(u)
if sc <= 0 || len(h.PreferURLContains) == 0 {
return sc
}
low := strings.ToLower(u)
for _, p := range h.PreferURLContains {
p = strings.ToLower(strings.TrimSpace(p))
if p != "" && strings.Contains(low, p) {
return sc + 1000
}
}
return sc
}
// Data is the merged capture payload before key fetch.
@ -70,6 +86,25 @@ type Data map[string]string
func (d Data) Get(k string) string { return d[k] }
// preferSatisfied is true when no PreferURLContains is set, or the chosen MPD
// matches one of the preferred substrings.
func preferSatisfied(cap Data, hints Hints) bool {
if len(hints.PreferURLContains) == 0 {
return true
}
mpd := strings.ToLower(strings.TrimSpace(cap["mpd"]))
if mpd == "" {
return false
}
for _, p := range hints.PreferURLContains {
p = strings.ToLower(strings.TrimSpace(p))
if p != "" && strings.Contains(mpd, p) {
return true
}
}
return false
}
// Wait pulls device JSON + local mirrored log until required fields exist.
func Wait(c *adb.Client, hints Hints, localLog string, localCap string, timeout time.Duration) (Data, error) {
deadline := time.Now().Add(timeout)
@ -104,7 +139,7 @@ func Wait(c *adb.Client, hints Hints, localLog string, localCap string, timeout
enrichFromProxyLog(cap, logText, hints)
if hints.BestEffort {
if hasUseful(cap, hints) {
if hasUseful(cap, hints) && preferSatisfied(cap, hints) {
_ = os.WriteFile(localCap, mustJSON(cap), 0o644)
return cap, nil
}
@ -116,7 +151,7 @@ func Wait(c *adb.Client, hints Hints, localLog string, localCap string, timeout
break
}
}
if !missing {
if !missing && preferSatisfied(cap, hints) {
_ = os.WriteFile(localCap, mustJSON(cap), 0o644)
return cap, nil
}
@ -125,7 +160,7 @@ func Wait(c *adb.Client, hints Hints, localLog string, localCap string, timeout
have := []string{}
keys := hints.Require
if hints.BestEffort {
keys = []string{"mpd", "license_url", "pssh", "auth", "pid"}
keys = []string{"mpd", "license_url", "pssh", "auth", "pid", "license_body"}
}
for _, k := range keys {
if cap[k] != "" {
@ -225,7 +260,8 @@ func enrichFromProxyLog(cap Data, logText string, hints Hints) {
if sc <= 0 {
return
}
if sc > bestScore {
// Prefer higher score; on a tie keep the later URL (last stream played).
if sc > bestScore || (sc == bestScore && sc > 0) {
bestScore = sc
bestMPD = u
}