Skip to content

fix(templates): a segment channel's date and time variables read its own session (#1148) - #1149

Merged
egyptiangio merged 1 commit into
devfrom
fix/1148-session-channel-name-time
Oct 24, 2026
Merged

egyptiangio merged 1 commit into
devfrom
fix/1148-session-channel-name-time

Conversation

@egyptiangio

Copy link
Copy Markdown
Collaborator

Fixes #1148 (bead teamarr-4lzv).

Problem. With an event channel name of {league} | {session_name} · {game_day_short} {game_time}, every session channel of a race weekend was named with Practice 1's day and time. The guide for the same channels was right: xmltv.py swaps the session start into the event before resolving, while naming.py::_resolve_template passed only the segment code and kept event.start_time, the weekend's first session. The sync rename goes through the same naming code, so existing channels carried the wrong time for good.

Fix. One place: ContextBuilder._build_game_context anchors a segment channel's GameContext to its own segment's start (segment_start_time): the event's session with that code (earliest running when a code repeats, the same rule as lifecycle timing), or ESPN's MMA segment_times for a card segment. Every reader of the context then agrees on what "the game time" is for that channel: channel name, logo URL, conditional descriptions, the sync rename and the guide. The guide's own swap stays and is now a no-op for racing. Existing session channels are renamed by the next sync.

Scope note. MMA card segments get the same treatment ({game_time} on a prelims channel reads the prelims start, as the guide already did). That is the same defect in the same line; flagging it because it renames existing MMA channels whose name template uses a time variable.

Tests. tests/templates/test_segment_start_context.py: the reporter's template on a four-session weekend (each channel reads its own day and time), logo URL date, sync parity, no segment / unknown segment unchanged, repeated session code anchors to the earliest running, MMA segment times.

Docs. Notes under Card Segments and the Motorsports note in docs/guide/epg/variables.md.

…own session (#1148)

A race weekend is one Event whose sessions[] each get a channel, and
event.start_time is the weekend's first session. The guide path swapped
the session start into the event before resolving, but the channel-name
path (creation and the sync rename) passed only the segment code, so
{game_time} / {game_day_short} in a session channel's name printed
Practice 1's time on every channel while the guide showed each session's
own. The context builder now anchors a segment channel's GameContext to
its own segment's start (segment_start_time: the event's matching
session, earliest running first like the lifecycle timing, or ESPN's MMA
segment_times), so name, logo URL, conditions, the sync rename and the
guide all agree. Existing channels are renamed by the next sync.
@egyptiangio
egyptiangio merged commit 85b5fe5 into dev Oct 24, 2026
8 checks passed
@egyptiangio
egyptiangio deleted the fix/1148-session-channel-name-time branch October 24, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant