Land the #15 lineup stack on main - #21
Merged
Merged
Conversation
Factor template rendering out of persistGuideFiles into renderXMLTV so tests can render to a buffer. The golden file is generated from the current conversion code before any model changes.
Carry the row id, affiliate callsign, and station filters through to guide.Channel, and the TMS id, release year, generic flag, and raw event filters through to guide.Program. Categories are unchanged; Filters holds the Gracenote list before Series and Finale are appended. releaseYear and isGeneric use tolerant decoders so an unexpected scalar encoding cannot fail an entire six-hour grid. The guide cache gains a schema version. An older cache is rebuilt once so the new fields are populated.
*.xmltv is ignored repo-wide, which kept the golden out of the first commit. Allowlist it explicitly.
TVGuide gains Lineup, a list of channel positions keyed by number and station that is never collapsed, and Source, which records the lineup the guide was built from. Resolved station logos are copied onto each position, the image proxy rewrite covers them, and the Jellyfin channel filter applies to them by channel number. ChannelNumberLess moves into the guide package with a strict ordering: numeric numbers first, ties broken by string, then non-numeric.
One entry per channel position, sorted by number, with station metadata, Gracenote station filters, and the resolved logo. Provider name, type, and location come from the saved setup when it matches the lineup the guide was built from. Returns 503 with Retry-After until the first guide exists, matching /api/guide.json.
scrape.Fetch(ctx, prefs, opts) downloads every six-hour slot for a lineup and assembles a guide.TVGuide: stations deduplicated in first-seen order, every lineup position retained, programs deduplicated. It does no enrichment, file I/O, or environment reads. main.runScrape now calls it, mapping progress to the setup status and cancelling the context when the active lineup changes mid-download. Behavior change: when every slot fails, the scrape is now an error (scrape.ErrNoData) instead of writing an empty guide, so the previous guide stays live and the 15-minute retry applies. Channel order in the XMLTV output is now first-seen rather than map order.
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.
Re-lands #17, #18, #19, and #20 against main. Those PRs were merged into each other's branches rather than into main, so only the CI workflow from #16 actually landed. This branch is the same linear history the stack was reviewed with, and its tree is identical to the merged tip of
feature/lineup-endpoint.Contents, unchanged from the original PRs:
/api/lineup.jsonscrapepackageCloses #15.