streamd: preview quality picker, dashboard polish, C4 wrap keys
- 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:
parent
b3955bd81e
commit
066e018749
113 changed files with 19002 additions and 1541 deletions
160
apps/modules/my5/my5.go
Normal file
160
apps/modules/my5/my5.go
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
// Package my5 is the Channel 5 (My5 / "5") Live TV provider module.
|
||||
// Live TV uses a left-rail of channel logos (no content-desc); selection is by logo_index.
|
||||
package my5
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"drmdecryption/adb"
|
||||
appreg "drmdecryption/app"
|
||||
"drmdecryption/capture"
|
||||
"drmdecryption/modules/provider"
|
||||
"drmdecryption/mpd"
|
||||
"drmdecryption/uiflow"
|
||||
)
|
||||
|
||||
func init() {
|
||||
appreg.Register(Name, New)
|
||||
appreg.RegisterFlags(bindFlags)
|
||||
}
|
||||
|
||||
func bindFlags(fs *flag.FlagSet) {
|
||||
fs.StringVar(&flags.packageName, Name+".package", "", "override "+Name+" android package id")
|
||||
fs.StringVar(&flags.caHash, Name+".ca-hash", "", "override "+Name+" MITM CA subject hash")
|
||||
fs.StringVar(&flags.proxyBin, Name+".proxy-bin", "", "override "+Name+" on-device MITM binary")
|
||||
}
|
||||
|
||||
// App is the My5 plugin.
|
||||
type App struct {
|
||||
*provider.Base
|
||||
cfg Config
|
||||
}
|
||||
|
||||
// New constructs the plugin from module.yaml + flags + env.
|
||||
func New() (appreg.App, error) {
|
||||
cfg, res, err := loadConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
labels := make(map[string]string, len(cfg.Channels))
|
||||
for id, ch := range cfg.Channels {
|
||||
labels[id] = ch.Label
|
||||
}
|
||||
return &App{Base: provider.New(Name, cfg.Common, labels, res), cfg: cfg}, nil
|
||||
}
|
||||
|
||||
// KeyMode: My5 live uses a raw Widevine license response (Cassie).
|
||||
func (a *App) KeyMode() string { return "raw" }
|
||||
|
||||
// CaptureHints: transparent MITM should yield the DASH MPD (+ license_url).
|
||||
func (a *App) CaptureHints() capture.Hints {
|
||||
return a.Hints("mpd")
|
||||
}
|
||||
|
||||
// CaptureHintsFor prefers URL substrings for this live channel when known.
|
||||
func (a *App) CaptureHintsFor(channel string) capture.Hints {
|
||||
h := a.CaptureHints()
|
||||
id, err := a.Resolve(channel)
|
||||
if err != nil {
|
||||
id = strings.ToLower(strings.TrimSpace(channel))
|
||||
}
|
||||
// Prefer patterns filled after first successful captures; safe no-ops until then.
|
||||
prefer := map[string][]string{
|
||||
"channel5": {"channel5", "c5-", "/c5"},
|
||||
"5usa": {"5usa", "usa"},
|
||||
"5star": {"5star", "star"},
|
||||
"5action": {"5action", "action"},
|
||||
"5select": {"5select", "select"},
|
||||
}
|
||||
if p, ok := prefer[id]; ok {
|
||||
h.PreferURLContains = p
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
// UseTransparentMITM: UK VPN on-device conflicts with Wi‑Fi http_proxy.
|
||||
func (a *App) UseTransparentMITM() bool { return true }
|
||||
|
||||
func (a *App) MPDRewriter() mpd.Rewriter { return mpd.Passthrough{} }
|
||||
|
||||
func (a *App) Channels() []appreg.Channel {
|
||||
out := make([]appreg.Channel, 0, len(a.cfg.Channels))
|
||||
for _, id := range a.ChannelIDs() {
|
||||
out = append(out, appreg.Channel{ID: id, Label: a.Label(id)})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Launch cold-starts My5 and dismisses common first-run prompts.
|
||||
func (a *App) Launch(c *adb.Client) error {
|
||||
c.EnsureAwake()
|
||||
fmt.Printf("[*] Launching %s (%s)…\n", Name, a.Package())
|
||||
c.ForceStop(a.Package())
|
||||
time.Sleep(400 * time.Millisecond)
|
||||
if err := uiflow.MonkeyLaunch(c, a.Package()); err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Duration(a.cfg.Timeouts.LaunchSettle))
|
||||
c.DismissShadeIfFocused()
|
||||
a.dismissOnboarding(c)
|
||||
if err := uiflow.WaitUI(c, a.CacheDir(), uiflow.Match{
|
||||
DescContains: a.cfg.UI.LaunchDescContains,
|
||||
TextContains: a.cfg.UI.LaunchDescContains,
|
||||
}, time.Duration(a.cfg.Timeouts.LaunchWaitUI)); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "[!] launch UI wait: %v — continue and play manually\n", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AutoPlay opens Live TV, taps the channel logo by index, then the Now EPG cell.
|
||||
func (a *App) AutoPlay(c *adb.Client, channel string) error {
|
||||
id, err := a.Resolve(channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ch := a.cfg.Channels[id]
|
||||
fmt.Printf("[*] Auto-play %s (logo %d)…\n", a.Label(id), ch.LogoIndex)
|
||||
c.EnsureAwake()
|
||||
c.DismissShadeIfFocused()
|
||||
// Capture host normally Launch()s first; still start the app if we landed on the launcher.
|
||||
if !a.appFocused(c) {
|
||||
if err := a.Launch(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
a.dismissOnboarding(c)
|
||||
|
||||
if err := a.openLiveTab(c); err != nil {
|
||||
return fmt.Errorf("Live TV tab: %w", err)
|
||||
}
|
||||
if err := a.tapChannelLogo(c, ch); err != nil {
|
||||
return fmt.Errorf("channel logo %s: %w", a.Label(id), err)
|
||||
}
|
||||
if err := a.tapNowCell(c, ch); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "[!] Now cell tap: %v — relying on embedded player\n", err)
|
||||
}
|
||||
return uiflow.WaitPlayback(c, a.CacheDir(), a.Package(), uiflow.PlaybackOpts{
|
||||
Timeout: time.Duration(a.cfg.Timeouts.Playback),
|
||||
SoftFail: true,
|
||||
OrDescContains: []string{
|
||||
"Pause",
|
||||
"Unmute",
|
||||
"Cast",
|
||||
},
|
||||
OrResourceContains: []string{
|
||||
"c5player",
|
||||
"video_view",
|
||||
"video_player",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) VideoSelect() string { return "for=best" }
|
||||
func (a *App) AudioSelect() string { return "for=best" }
|
||||
func (a *App) RewriterName() string { return "none" }
|
||||
func (a *App) LiveWaitSeconds() int { return 2 }
|
||||
func (a *App) TSReadyBytes() int64 { return 256 << 10 }
|
||||
Loading…
Add table
Add a link
Reference in a new issue