Fix/epg collision - #224
Open
sparrowjack63 wants to merge 1 commit into
Open
Conversation
Prefer streamId (always unique per channel) as the guide lookup key. epgChannelId is still used for provider-native programme joins, so no schema change and provider-guide behaviour is preserved. Fixes Davidona#210.
sparrowjack63
force-pushed
the
fix/epg-collision
branch
from
August 29, 2026 13:37
82c67b1 to
1527282
Compare
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.
Problem
The EPG guide displays the same programme on multiple unrelated channels
when the provider returns a non-unique
epg_channel_id.Some Xtream panels populate
epg_channel_idpoorly: dozens of unrelatedchannels share a single placeholder value (the same id repeated across many
different channels). Each of these channels is correctly resolved to a
distinct external XMLTV
xmltv_channel_id, yet the guide shows onechannel's programmes on all of them.
Root cause
getResolvedProgrammes()fetches programmes correctly (via the uniquexmltvChannelIdfor external,channelIdfor provider-native), but storesthem in the result map keyed by
epgChannelId:When several channels share the same
epgChannelId, they collide on the samemap entry — the last one processed wins, and every other channel inherits its
guide. The grid reads back with the same
epgChannelId-first key(
Channel.guideLookupKey()), so the collision is consistent end to end.Reproduction
epg_channel_idfor several unrelated channels.xmltv_channel_id.Example: two unrelated channels (say channel A and channel B) each map to
their own XMLTV entry with different programmes, but because both carry the
same provider
epg_channel_id, the guide shows channel B's programme onchannel A as well.
Setting
channels.epg_channel_id = NULL(without touchingchannel_epg_mappings) immediately fixes the guide — isolating the keycollision as the cause.
Fix
Prefer
streamId(always unique per channel within a provider) as the guidelookup key, in both the producer (
EpgResolutionEngine.getResolvedProgrammes,external + provider blocks), the consumer (
Channel.guideLookupKey), and theplayback path (
getResolvedProgramsForPlaybackChannel).epgChannelIdis still used for provider-native programme joins(
ProgramDao.getForChannelsSyncjoins onchannel_id = epgChannelId), so:channel, never the lookup key used to fetch them.
Testing
./gradlew testDebugUnitTestpasses.epg_channel_idvalues intact in the DB, each channel now shows its own distinct programme.
Before the patch, they shared one guide.
Fixes #210.