Skip to content

Accept non-numeric EPG programme ids - #303

Open
bhargavz wants to merge 1 commit into
Kevinjil:masterfrom
bhargavz:fix/hex-epg-ids
Open

bhargavz wants to merge 1 commit into
Kevinjil:masterfrom
bhargavz:fix/hex-epg-ids

Conversation

@bhargavz

Copy link
Copy Markdown

Problem

EpgInfo.Id is an int bound straight to the id field of get_simple_data_table. Some Xtream providers send that field as a non-numeric string, for example a hex id like "6ae0d9df220c7". Newtonsoft can't convert that to an int, and the property isn't nullable, so NullableEventHandler doesn't ignore the error. Deserializing the listing throws, and that channel gets no programmes in the Live TV guide (LiveTvService.GetProgramsAsync) or in catch-up (CatchupChannel).

Fix

  • The JSON id is now kept as a string in a new RawId property.
  • Id stays an int, now a [JsonIgnore] computed property, so StreamService.ToGuid(...) callers are unchanged. It returns:
    • the numeric value when RawId parses as an int, so existing numeric ids, and the GUIDs built from them, stay the same;
    • otherwise a 32-bit FNV-1a hash of the id text. This is stable across runs and processes, unlike string.GetHashCode(), and it keeps distinct programmes on distinct GUIDs;
    • or, when the provider sends no id at all, the same hash of Start.Ticks.

This is the only change. It touches one file, Jellyfin.Xtream/Client/Models/EpgInfo.cs.

As a side effect, numeric EPG ids above int.MaxValue no longer throw either. They get hashed instead. This only covers EPG programme ids, so it does not fix the category/stream id overflow in #268.

Testing

  • dotnet build -c Release succeeds with 0 warnings and 0 errors (net9.0, Jellyfin 10.11.0 packages).
  • Ran a scratch console check against the built assembly. It is not part of this PR, since the repo has no test project. Results:
    • "6ae0d9df220c7" and "6ae0d9df220c8" deserialize, and each gives a different id that is the same on every call.
    • "12345" (string) and 12345 (number) both give 12345.
    • A missing id falls back to a hash of the start timestamp.
    • "2356443347" (above int32) deserializes instead of throwing.
  • The same change has run in a fork against a provider that sends hex ids. The guide and catch-up listings load, and every programme has its own GUID.

Related

🤖 Generated with Claude Code

Some providers send the programme `id` in get_simple_data_table as a
non-numeric string (e.g. hex "6ae0d9df220c7"). Deserializing that into
an int property throws, so the whole listing for the channel fails and
neither the guide nor catch-up get any programmes.

Keep the JSON id as a string (`RawId`) and derive the int `Id` used for
GUIDs from it: the numeric value when it parses as an int, otherwise an
FNV-1a hash of the text, or of the start timestamp when no id is sent.
Numeric ids keep their existing value, so existing GUIDs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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