Applies to: Protocol and format interpretation for developers inspecting authorized media delivery.

The useful distinctions

  • xmltv_ns uses season, episode, and part components separated by dots.
  • Its component indexes start at zero.
  • The system attribute distinguishes numbering schemes; onscreen is the DTD default.

Convert indexes, retain counts

In the synthetic row, season index two converts to displayed season three and episode index four to displayed episode five. The final component zero slash one means the first part out of a total of one part. Add one to the index when producing a human-facing number; do not add one to the total. Keeping those operations separate is especially useful for a two-part story, where indexes zero and one share the same total two.

Do not parse every label as the same system

The companion onscreen value is a label using an editorial S03E05 convention. That convention is helpful for this example but is not the grammar of every onscreen value. An identifier may contain letters, production codes, or punctuation. Store the declared system with the original value and only run the parser associated with that system. If a component is absent in a source row, keep it unknown rather than replacing it with zero; zero is a real first index. A mismatch between two numbering systems should produce an audit finding for an editor, not an automatic overwrite. Different catalogues can group specials and seasons differently even when they refer to the same programme.

Worked example · synthetic

2 + 1 gives season 3; 4 + 1 gives episode 5. The denominator 1 is already a total. Both values are retained because they use explicitly different systems.

Synthetic text example; no network operation has been performed.

<tv>
  <programme start="20261108110000 +0000" channel="workshop.example">
    <title>Clay and Colour</title>
    <episode-num system="xmltv_ns">2.4.0/1</episode-num>
    <episode-num system="onscreen">S03E05</episode-num>
  </programme>
</tv>

Check the interpretation

  • Parse by declared system.
  • Distinguish an empty component from zero.
  • Check index/total relationships without incrementing totals.