streamd: optional keys, per-stream proxy, auto deps; agent module.yaml sync; RTE AutoPlay; Telegram release announces
All checks were successful
release / build-and-upload (push) Successful in 6m20s
modules-release / build-and-upload (push) Successful in 4m51s

- streamd: MPD-only start, proxy field, ffmpeg/NRE/mp4decrypt auto-install
- GET/PUT /api/modules for module.yaml sync; agent sync_modules
- RTE Live-tab AutoPlay fixes; modules zip named bbc/rte/tg4.zip
- Telegram notify scripts wired into Forgejo release workflows
This commit is contained in:
404errordeveloper 2026-10-09 00:17:23 +02:00
parent f9c28be3f1
commit ac8701b5a6
36 changed files with 1460 additions and 143 deletions

View file

@ -87,10 +87,12 @@ func (c Config) withDefaults() Config {
t.AfterLiveTab = provider.Duration(t.AfterLiveTab.D(2 * time.Second))
t.AfterChip = provider.Duration(t.AfterChip.D(2 * time.Second))
if len(c.UI.LaunchDescContains) == 0 {
c.UI.LaunchDescContains = []string{"live tab", "header logo"}
c.UI.LaunchDescContains = []string{"live tab", "header logo", "Home tab"}
}
if len(c.UI.LiveTabDescRE) == 0 {
c.UI.LiveTabDescRE = []string{"Live tab"}
// Anchor to the bottom-nav desc ("Live tab, 2 out of 5"). Bare "Live"
// also matches home "Watch Live" / "Live Event".
c.UI.LiveTabDescRE = []string{"^Live tab"}
}
c.Synthetic = c.Synthetic.WithDefaults()
return c

View file

@ -50,8 +50,9 @@ channels:
# vc12: "…"
ui:
launch_desc_contains: ["live tab", "header logo", "Live"]
live_tab_desc_re: ["Live tab", "Live"]
# "Live" alone matches home "Watch Live" / "Live Event" — keep anchored to the bottom tab.
launch_desc_contains: ["live tab", "header logo", "Home tab"]
live_tab_desc_re: ["^Live tab"]
timeouts:
launch_wait_ui: 30s

View file

@ -84,7 +84,7 @@ func (a *App) Launch(c *adb.Client) error {
}, time.Duration(a.cfg.Timeouts.LaunchWaitUI))
}
// AutoPlay navigates to a live channel and waits for playback.
// AutoPlay opens the Live tab (when needed), taps the channel chip, then Play.
func (a *App) AutoPlay(c *adb.Client, channel string) error {
id, err := a.Resolve(channel)
if err != nil {
@ -94,13 +94,9 @@ func (a *App) AutoPlay(c *adb.Client, channel string) error {
fmt.Printf("[*] Auto-play %s…\n", a.Label(id))
c.DismissShadeIfFocused()
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
DescRE: a.cfg.UI.LiveTabDescRE,
}, time.Duration(a.cfg.Timeouts.LiveTab)); err != nil {
return fmt.Errorf("live tab: %w", err)
if err := a.openLiveTab(c); err != nil {
return err
}
time.Sleep(time.Duration(a.cfg.Timeouts.AfterLiveTab))
if err := a.tapChipThenPlay(c, ch); err != nil {
return err
}

View file

@ -9,9 +9,58 @@ import (
"drmdecryption/uiflow"
)
// openLiveTab taps the bottom-nav Live tab and waits for channel chips.
// Home also shows a "Watch Live" label and a "Live Event" row — those must not
// match. The real control's content-desc is "Live tab, N out of 5".
func (a *App) openLiveTab(c *adb.Client) error {
c.DismissShadeIfFocused()
if nodes, err := c.DumpUI(a.CacheDir()); err == nil && a.onLiveTab(nodes) {
fmt.Println("[*] already on Live tab")
return nil
}
fmt.Println("[*] open Live tab…")
if err := uiflow.TapUI(c, a.CacheDir(), uiflow.Match{
DescRE: a.cfg.UI.LiveTabDescRE,
Pick: uiflow.PickSmallest,
}, time.Duration(a.cfg.Timeouts.LiveTab)); err != nil {
return fmt.Errorf("live tab: %w", err)
}
time.Sleep(time.Duration(a.cfg.Timeouts.AfterLiveTab))
deadline := time.Now().Add(time.Duration(a.cfg.Timeouts.LiveTab))
for time.Now().Before(deadline) {
nodes, err := c.DumpUI(a.CacheDir())
if err == nil && a.onLiveTab(nodes) {
fmt.Println("[*] Live tab ready")
return nil
}
time.Sleep(700 * time.Millisecond)
}
return fmt.Errorf("Live tab did not open")
}
// onLiveTab is true when channel chips are on screen. Home often embeds the
// same chip rail, so this also short-circuits when Play is already reachable
// without tapping the bottom-nav Live tab.
func (a *App) onLiveTab(nodes []adb.Node) bool {
return a.chipCount(nodes) >= 1
}
func (a *App) chipCount(nodes []adb.Node) int {
n := 0
for _, ch := range a.cfg.Channels {
pats := uiflow.CompileRes(ch.ChipDesc)
if adb.FindSmallest(nodes, pats) != nil {
n++
}
}
return n
}
// tapChipThenPlay is this app's navigation idiom: on the Live tab, tap the
// channel chip, then the large hero Play button that appears. If the hero button
// is already on screen, tap it directly.
// is already on screen for this channel, tap it directly.
func (a *App) tapChipThenPlay(c *adb.Client, ch Channel) error {
playPats := uiflow.CompileRes(ch.PlayDesc)
chipPats := uiflow.CompileRes(ch.ChipDesc)
@ -21,18 +70,30 @@ func (a *App) tapChipThenPlay(c *adb.Client, ch Channel) error {
return err
}
if cand := a.findHeroPlay(nodes, playPats); cand != nil {
fmt.Printf("[*] tap Play @ %d,%d\n", cand.CX(), cand.CY())
return c.Tap(cand.CX(), cand.CY())
x, y := playTapXY(cand)
fmt.Printf("[*] tap Play %q @ %d,%d\n", cand.Desc, x, y)
return c.Tap(x, y)
}
chip := adb.FindSmallest(nodes, chipPats)
if chip == nil {
chip, err = c.WaitFor(a.CacheDir(), nil, chipPats, time.Duration(a.cfg.Timeouts.ChipWait))
if err != nil {
return fmt.Errorf("chip not found: %w", err)
deadline := time.Now().Add(time.Duration(a.cfg.Timeouts.ChipWait))
for time.Now().Before(deadline) {
nodes, err = c.DumpUI(a.CacheDir())
if err == nil {
if chip = adb.FindSmallest(nodes, chipPats); chip != nil {
break
}
}
time.Sleep(700 * time.Millisecond)
}
if chip == nil {
return fmt.Errorf("chip not found for %s", ch.Label)
}
}
fmt.Printf("[*] tap chip @ %d,%d\n", chip.CX(), chip.CY())
// Chip text nodes are often clickable=false; their centre sits inside a
// larger clickable parent, so a centre tap still lands on the parent.
fmt.Printf("[*] tap chip %q @ %d,%d\n", chip.Desc, chip.CX(), chip.CY())
_ = c.Tap(chip.CX(), chip.CY())
time.Sleep(time.Duration(a.cfg.Timeouts.AfterChip))
@ -41,13 +102,14 @@ func (a *App) tapChipThenPlay(c *adb.Client, ch Channel) error {
nodes, err = c.DumpUI(a.CacheDir())
if err == nil {
if cand := a.findHeroPlay(nodes, playPats); cand != nil {
fmt.Printf("[*] tap Play @ %d,%d\n", cand.CX(), cand.CY())
return c.Tap(cand.CX(), cand.CY())
x, y := playTapXY(cand)
fmt.Printf("[*] tap Play %q @ %d,%d\n", cand.Desc, x, y)
return c.Tap(x, y)
}
}
time.Sleep(700 * time.Millisecond)
}
return fmt.Errorf("Play button did not appear")
return fmt.Errorf("Play button did not appear for %s", ch.Label)
}
// findHeroPlay accepts a Play match only if it is big enough to be the hero
@ -59,3 +121,14 @@ func (a *App) findHeroPlay(nodes []adb.Node, playPats []*regexp.Regexp) *adb.Nod
}
return cand
}
// playTapXY aims at the play icon in the upper half of the hero. The geometric
// centre of the large "Play RTEONE…" node often lands below the hit target and
// the tap is ignored.
func playTapXY(n *adb.Node) (int, int) {
h := n.Y2 - n.Y1
if h < 1 {
return n.CX(), n.CY()
}
return n.CX(), n.Y1 + h*2/5
}