Repository navigation
fix(templates): a segment channel's date and time variables read its own session (#1148) - #1149
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pyswaps the session start into the event before resolving, whilenaming.py::_resolve_templatepassed only the segment code and keptevent.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_contextanchors a segment channel'sGameContextto 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 MMAsegment_timesfor 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.