Skip to content

Keep raw Gracenote fields on channels and programs - #17

Merged
daniel-widrick merged 3 commits into
ci/test-workflowfrom
feature/raw-gracenote-fields
Sep 13, 2026
Merged

daniel-widrick merged 3 commits into
ci/test-workflowfrom
feature/raw-gracenote-fields

Conversation

@daniel-widrick

Copy link
Copy Markdown
Owner

PR 1 of #15. Stacked on #16 (CI); the base will move to main once that merges.

Changes

  • web.JSONChannel gains id, affiliateCallSign, stationFilters. web.JSONProgram gains tmsId, releaseYear, isGeneric.
  • guide.Channel gains PlacementID, AffiliateCallSign, Filters. guide.Program gains Filters (raw Gracenote filters before Series/Finale are appended), TMSID, ReleaseYear, Generic. All are internal fields not referenced by the template.
  • releaseYear and isGeneric decode through tolerant FlexString / FlexBool types, so an unexpected encoding on one optional field cannot discard a whole grid.
  • Gracenote's literal "null" affiliate callsign normalizes to empty.
  • Guide cache gets a schema version. A cache from an earlier build is rebuilt once on upgrade so the new fields are populated.
  • renderXMLTV is factored out of persistGuideFiles so 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 that Categories keeps its historical shape.
  • main: golden XMLTV test; legacy cache without a version is not loaded, current one is.

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.
@daniel-widrick
daniel-widrick merged commit 5773884 into ci/test-workflow Sep 13, 2026
1 check passed
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