Keep raw Gracenote fields on channels and programs - #17
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.
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.
PR 1 of #15. Stacked on #16 (CI); the base will move to main once that merges.
Changes
web.JSONChannelgainsid,affiliateCallSign,stationFilters.web.JSONProgramgainstmsId,releaseYear,isGeneric.guide.ChannelgainsPlacementID,AffiliateCallSign,Filters.guide.ProgramgainsFilters(raw Gracenote filters before Series/Finale are appended),TMSID,ReleaseYear,Generic. All are internal fields not referenced by the template.releaseYearandisGenericdecode through tolerantFlexString/FlexBooltypes, so an unexpected encoding on one optional field cannot discard a whole grid."null"affiliate callsign normalizes to empty.renderXMLTVis factored out ofpersistGuideFilesso tests can render to a buffer. No behavior change.XMLTV is unchanged
The first commit adds a golden test that renders a fixture through the real conversion path and commits the output, generated before any type changes. The second commit makes the changes and the golden still passes. Regenerate deliberately with
go test -run TestXMLTVGolden -update .Tests
web: fixture decode covering every new field, a duplicate lineup position, and number/string/null encodings; table tests for both tolerant decoders including malformed input.guide: conversion tests for the new channel and program fields, null normalization, nil-vs-empty filters, and thatCategorieskeeps its historical shape.main: golden XMLTV test; legacy cache without a version is not loaded, current one is.