feat: precompute stream grouping during source sync (#13)

Move variant grouping work out of Live TV rendering into the
catalog pipeline: a liveProjectionService builds the logical channel
projection (schema in liveProjectionSchema) whenever a source is
added, synced or modified (name change, new address), and the
projection is served through a /live route. ChannelList now consumes
the precomputed projection via a liveChannelProjection client
service, recalculating only when the catalog changes. Cover
projection building, incremental recompute and client consumption
with tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-02 15:35:02 +02:00
parent 7b6525708c
commit 9f97020996
16 changed files with 619 additions and 10 deletions

View File

@ -93,7 +93,7 @@
const buckets = new Map();
channels.forEach(channel => {
const fingerprint = normalizeChannelName(channel.name) || `channel-${getVariantKey(channel)}`;
const fingerprint = channel.logicalFingerprint || normalizeChannelName(channel.name) || `channel-${getVariantKey(channel)}`;
if (!buckets.has(fingerprint)) buckets.set(fingerprint, []);
buckets.get(fingerprint).push(channel);
});
@ -139,10 +139,10 @@
]));
return {
...preferredVariant,
id: `logical:${fingerprint}`,
id: preferredVariant.logicalId || `logical:${fingerprint}`,
fingerprint,
displayName: displayNameForFingerprint(fingerprint),
name: displayNameForFingerprint(fingerprint),
displayName: preferredVariant.logicalDisplayName || displayNameForFingerprint(fingerprint),
name: preferredVariant.logicalDisplayName || displayNameForFingerprint(fingerprint),
variants,
visibleVariants,
preferredVariant,