Electronic program guide
The electronic program guide (EPG) turns channel schedule data into current-program context and browsable programme views. It keeps lookups tied to the right guide source, then presents the result beside playback so a viewer can inspect schedules, open programme details, and use an eligible past programme for catch-up actions. See Viewing experience for the wider channel-to-playback flow and Media playback for the player side.
Guide data lifecycle
The guide follows a path from a schedule source to a shared programme model and then to channel-specific views. Desktop runtimes can import XMLTV data into local storage. Provider integrations can also request schedule data for the selected channel.
This diagram shows how schedule data becomes current context or a browsable guide and then becomes a detail or playback action.
flowchart LR
A[XMLTV source or provider API] --> B[EPG access boundary]
B --> C[Stored or provider programme data]
C --> D[Channel identity match]
D --> E[Shared programme model]
E --> F[Current-program context]
E --> G[Timeline or list guide]
G --> H[Details or catch-up action]
Schedule import
Schedule import brings XMLTV feeds into the desktop EPG data set. The runtime checks source freshness before a fetch and reports queued, active, complete, or failed work. Fresh data is reused instead of fetched again. A forced retry can refresh a source after an error or a trust decision. (apps/…/epg-fetch.service.ts• L7-16, apps/…/epg-fetch.service.ts• L29-86, apps/…/epg-worker.service.ts• L11-24)
The renderer starts an import only after settings load and source reconciliation. It removes empty and duplicate URLs and retires the request if source ownership changes before the runtime fetch starts. This prevents a removed source from being re-added by a delayed import. (libs/…/epg.service.ts• L104-123)
An import completion refreshes both cached current-program answers and the schedule for the open channel. A schedule refill keeps the channel and archive window that the viewer opened, asks the backend to reject an unreadable store instead of treating it as an empty schedule, and leaves the visible schedule in place when the background refill fails. (libs/…/epg.service.ts• L42-63, libs/…/epg.service.ts• L173-205, libs/…/epg-schedule-feed.ts• L9-19, libs/…/epg-schedule-feed.ts• L52-100)
The import keeps channel and programme records tied to their source URL. A source refresh replaces the relevant current and future schedule while preserving the separation between feeds. Duplicate programme records are reduced during storage so later queries return a stable schedule. (apps/…/epg-database.ts• L23-59, apps/…/epg-database.ts• L78-155)
Import progress is shown as a queue and as per-source status. The progress panel shortens remote and local source labels for the row while keeping the full value in the tooltip. Its compact controls stay inside the scrollable panel and adapt the panel and action layout for narrow screens. The panel can be minimized while its header keeps loading and queued counts visible. It can also retry failed work or ask the user to trust a blocked private-network source or TLS host. Progress generations prevent an older event from replacing newer source state. The panel view loads only when an import is visible, and a visible fallback alert reports a failed view load so import errors are not hidden. (libs/…/epg-progress.service.ts• L56-87, libs/…/epg-progress.service.ts• L89-149, libs/…/epg-progress-panel.component.ts• L7-32, libs/…/epg-progress-panel-view.component.ts• L55-229, libs/…/epg-progress-panel-view.component.html• L1-179, libs/…/epg-import-display-url.ts• L1-47, libs/…/epg-progress-panel-view.component.scss• L13-22, libs/…/epg-progress-panel-view.component.scss• L35-153, libs/…/epg-progress-panel-view.component.scss• L212-289, libs/…/epg-progress-panel.component.scss• L1-22)
References: apps/…/epg-fetch.service.ts• L7-16 apps/…/epg-fetch.service.ts• L29-86 apps/…/epg-worker.service.ts• L11-24 libs/…/epg.service.ts• L42-63 libs/…/epg.service.ts• L104-123 libs/…/epg.service.ts• L173-205 libs/…/epg-schedule-feed.ts• L9-100 apps/…/epg-database.ts• L23-59 apps/…/epg-database.ts• L78-155 libs/…/epg-progress.service.ts• L56-149 libs/…/epg-progress-panel.component.ts• L7-32 libs/…/epg-progress-panel-view.component.ts• L55-229 libs/…/epg-progress-panel-view.component.html• L1-179 libs/…/epg-import-display-url.ts• L1-47 libs/…/epg-progress-panel-view.component.scss• L13-22 libs/…/epg-progress-panel-view.component.scss• L35-153 libs/…/epg-progress-panel-view.component.scss• L212-289 libs/…/epg-progress-panel.component.scss• L1-22
Provider schedule access
Provider views load a schedule for the selected live channel instead of requiring the whole guide to load first. Xtream can use the provider schedule or local XMLTV data. A user preference sets the source priority when both are available. A playlist-scoped manual mapping can replace the channel's source identifier before lookup so both paths use the intended guide channel. A source revision prevents an old result from replacing newer selection state. (libs/…/with-epg.feature.ts• L135-229, libs/…/xtream-xmltv-fallback.service.ts• L108-131)
Stalker access supports a short schedule for the active channel and a wider schedule for many live channels. The wider result is grouped by normalized channel identity and kept for the selected portal and time period. A saved XMLTV mapping replaces the portal schedule for that channel, even when the mapped guide has no programmes, so the sources are not merged by accident. (libs/…/with-stalker-epg.feature.ts• L171-205, libs/…/with-stalker-epg.feature.ts• L224-303, libs/…/with-stalker-epg.feature.ts• L304-463)
Large channel views use a throttled preview path. It batches local current-program lookups, limits provider requests, caches results for a short period, and discards results from an older channel selection. This keeps scrolling from producing unnecessary provider traffic or stale programme labels. (libs/…/epg-queue.service.ts• L29-45, libs/…/epg-queue.service.ts• L130-221)
References: libs/…/with-epg.feature.ts• L135-229 libs/…/xtream-xmltv-fallback.service.ts• L108-131 libs/…/with-stalker-epg.feature.ts• L171-205 libs/…/with-stalker-epg.feature.ts• L224-303 libs/…/with-stalker-epg.feature.ts• L304-463 libs/…/epg-queue.service.ts• L29-45 libs/…/epg-queue.service.ts• L130-221
Channel and programme matching
The guide needs a shared identity before it can place a programme beside a channel. The matching layer accepts source-specific channel fields, applies saved EPG mappings when needed, and returns programme records that downstream views can use without knowing the source format.
Channel identity
For M3U channels, the guide lookup key prefers the channel's EPG identifier. It falls back to the EPG name and then the display name. This order lets a well-formed source match directly while still giving common playlists a usable fallback. (libs/…/channel-epg-lookup.util.ts• L3-11)
Manual EPG mappings correct cases where a playlist identity does not match the channel identifier in the guide feed. Mappings are resolved before batch lookups and are scoped to the owning playlist in portal flows. The same stream number in two playlists can therefore use different guide identities. (libs/…/epg-queue.service.ts• L147-165, libs/…/epg-queue.service.ts• L237-288, apps/…/epg-query.service.ts• L36-71)
References: libs/…/channel-epg-lookup.util.ts• L3-11 libs/…/epg-queue.service.ts• L147-165 libs/…/epg-queue.service.ts• L237-288 apps/…/epg-query.service.ts• L36-71
Programme model
The shared EpgProgram model represents one airing with start and stop times, a channel key, and a title. It can also carry description, category, episode, icon, rating, and numeric time values. Provider records use a different EpgItem shape, so portal data is flattened into EpgProgram before it reaches the common guide views. Stalker data follows the same path after its portal-specific time fields and channel identifiers are normalized. (libs/…/epg-program.model.ts• L4-16, libs/…/epg-item.interface.ts• L1-13, libs/…/unified-live-epg-summary.util.ts• L42-53, libs/…/with-stalker-epg.feature.ts• L589-653)
The data layer normalizes valid dates to ISO form and drops rows with unusable times. Guide utilities prefer a numeric timestamp when one exists, then use the date string. This gives source-specific data one consistent basis for sorting, day selection, progress, and current-program checks. (libs/…/epg-program-normalization.util.ts• L3-37, libs/…/epg-program.utils.ts• L5-26)
References: libs/…/epg-program.model.ts• L4-16 libs/…/epg-item.interface.ts• L1-13 libs/…/unified-live-epg-summary.util.ts• L42-53 libs/…/with-stalker-epg.feature.ts• L589-653 libs/…/epg-program-normalization.util.ts• L3-37 libs/…/epg-program.utils.ts• L5-26
Current-program context
Channel lists use a lighter form of the guide. They request the current programme and channel metadata in batches, then keep that information beside the channel rather than replacing the channel record. A progress value comes from the airing's time range and refreshes as time moves forward. (libs/…/channel-list-container.component.ts• L364-381, libs/…/channel-list-container.component.ts• L399-448, libs/…/epg-enrichment.util.ts• L15-73)
The current-program lookup applies one source-scope ladder to single-channel and batch requests. It checks the caller's playlist sources first, then configured global sources, and only uses every imported source when the caller opts into anySourceFallback; older runtimes use per-channel requests without changing that order. A scoped single-channel miss or recoverable scoped error can continue to the configured global sources, while an opted-in any-source retry is kept separate from the scoped result. This keeps a channel in one playlist from using a same-named programme from another guide while still supporting surfaces with no playlist context. (libs/…/epg-current-programs.lookup.ts• L13-20, libs/…/epg-current-programs.lookup.ts• L46-73, libs/…/epg-current-programs.lookup.ts• L100-143, libs/…/epg-current-programs.lookup.ts• L146-173, libs/…/epg-single-program.lookup.ts• L9-13, libs/…/epg-single-program.lookup.ts• L93-135)
The same current programme supplies the compact summary shown by live viewing panels. Xtream selection state sorts provider items and identifies the current airing from its start-inclusive and stop-exclusive time range. This connects the channel list, playback header, and full guide without making each surface repeat source-specific schedule rules. (libs/…/unified-live-epg-summary.util.ts• L10-39, libs/…/live-stream-layout.component.ts• L169-222, libs/…/with-epg.feature.ts• L50-75, libs/…/with-epg.feature.ts• L93-103)
References: libs/…/channel-list-container.component.ts• L364-381 libs/…/channel-list-container.component.ts• L399-448 libs/…/epg-enrichment.util.ts• L15-73 libs/…/epg-current-programs.lookup.ts• L13-20 libs/…/epg-current-programs.lookup.ts• L46-173 libs/…/epg-single-program.lookup.ts• L9-135 libs/…/unified-live-epg-summary.util.ts• L10-39 libs/…/live-stream-layout.component.ts• L169-222 libs/…/with-epg.feature.ts• L50-75 libs/…/with-epg.feature.ts• L93-103
Guide presentation
The EPG UI presents one schedule through timeline and list views. A host supplies the selected channel, programme data, loading state, selected date, and archive capability. The guide then presents that data and emits channel, detail, and playback actions.
Timeline view
The timeline places programmes on a time axis that spans the loaded schedule and always includes the current time. It marks past, current, and future airings, shows day boundaries, and lets the viewer change scale or jump to the current point. The view updates its clock during use and returns to the current programme when a channel schedule loads. Its toolbar can collapse the schedule into a live or archive summary, return to live, open the full guide, or show that history is available without catch-up playback. (libs/…/epg-timeline.utils.ts• L48-119, libs/…/epg-timeline.component.ts• L130-215, libs/…/epg-timeline.component.ts• L306-324, libs/…/epg-timeline.component.html• L8-177, libs/…/epg-timeline.component.html• L180-241)
When the timeline has no rows to show, its empty state explains whether the selected day is empty, the channel has no mapping, the provider has no guide data, M3U guide setup is needed, or loading failed. It offers only the action that fits the reason, such as jumping to today or the nearest day, opening settings, or retrying. The message fills the space below the toolbar so it remains visible in compact inline panels. (libs/…/epg-timeline-empty-state.component.ts• L12-67, libs/…/epg-timeline-empty-state.component.ts• L69-155, libs/…/epg-timeline-empty-state.component.scss• L4-16, libs/…/epg-timeline-empty-state.component.scss• L18-83)
At a broad time scale, adjacent short airings can appear as one expandable group. More detailed scales expose the individual programmes. This keeps a dense schedule readable while preserving access to each airing. (libs/…/epg-timeline.component.ts• L343-349, libs/…/epg-timeline-track.component.html• L17-33, libs/…/epg-timeline-track.component.scss• L390-439)
Timeline blocks adapt their content to the available width. Wide blocks can show time, title, and a description preview. Narrow blocks reduce to a compact title or marker while still exposing the current, playing, and catch-up states. (libs/…/epg-timeline-track.component.html• L35-121, libs/…/epg-timeline-track.component.scss• L54-126, libs/…/epg-timeline-track.component.scss• L223-290)
Long schedules keep their full horizontal track and render only a buffered range around the visible ribbon. Scrolling, resizing, day changes, and channel changes update that range while preserving the schedule positions. This lets the viewer browse a multi-day schedule without placing every programme block in the page at once. (libs/…/epg-timeline-window.controller.ts• L22-119, libs/…/epg-timeline-window.controller.ts• L135-195, libs/…/epg-timeline.component.ts• L196-215)
Zoom keeps a time position under the viewport or cursor while the timeline changes scale. The timeline track adapts its block content to the available width, shows a description preview when space allows, and uses a focused popover for truncated programme names. A popover closes when its block leaves the rendered range, so windowing cannot leave details for a programme that is no longer visible. (libs/…/epg-timeline-zoom.controller.ts• L21-35, libs/…/epg-timeline-zoom.controller.ts• L49-127, libs/…/epg-timeline-track.component.ts• L36-76)
The timeline treats a programme that crosses midnight as present on both affected days. It rejects impossible time ranges before rendering them. These rules keep the selected day, the live marker, and the visible blocks in agreement. (libs/…/epg-timeline.utils.ts• L175-199)
References: libs/…/epg-timeline.utils.ts• L48-119 libs/…/epg-timeline.component.ts• L130-215 libs/…/epg-timeline.component.ts• L306-349 libs/…/epg-timeline-track.component.html• L17-121 libs/…/epg-timeline-track.component.scss• L54-126 libs/…/epg-timeline-track.component.scss• L223-290 libs/…/epg-timeline-track.component.scss• L390-439 libs/…/epg-timeline-window.controller.ts• L22-119 libs/…/epg-timeline-window.controller.ts• L135-295 libs/…/epg-timeline-zoom.controller.ts• L21-127 libs/…/epg-timeline-track.component.ts• L36-153 libs/…/epg-timeline.utils.ts• L175-199 libs/…/epg-timeline-empty-state.component.ts• L12-155 libs/…/epg-timeline-empty-state.component.scss• L4-83
List view
The list view presents the same schedule as one vertical day list. It filters programmes by overlap with the selected local day, sorts and de-duplicates them, then labels each row as past, current, or future. It shares the timeline's date, empty-state, summary, detail, and archive meaning. (libs/…/epg-list-view.utils.ts• L15-39, libs/…/epg-list-view.utils.ts• L57-123, libs/…/epg-list-view.component.ts• L137-196)
The list keeps the same host contract as the timeline while removing the wide time ribbon. It supports day changes, a jump to the current day, and a nearest day with data. A viewer can therefore switch view shape without changing channel selection or playback actions. (libs/…/epg-list-view.component.ts• L77-108, libs/…/epg-list-view.component.ts• L241-267)
Rows make the current airing, an airing playing from the archive, and a catch-up-eligible airing distinct. Selecting the current row returns to live playback, while an eligible past row starts catch-up and the detail action keeps the same archive rules. Focus has its own visible state, so keyboard selection does not remove the time or archive state. (libs/…/epg-list-view.component.ts• L266-323, libs/…/epg-list-view-row.component.scss• L16-20, libs/…/epg-list-view-row.component.scss• L171-217)
References: libs/…/epg-list-view.utils.ts• L15-39 libs/…/epg-list-view.utils.ts• L57-123 libs/…/epg-list-view.component.ts• L77-108 libs/…/epg-list-view.component.ts• L137-196 libs/…/epg-list-view.component.ts• L241-323 libs/…/epg-list-view-row.component.scss• L16-20 libs/…/epg-list-view-row.component.scss• L171-217
Multi-channel guide
The multi-channel guide expands the view from one active channel to many channels at once. Its host supplies scoped channel rows and programme access through a common source contract. The guide handles day changes, time scale, density, channel filters, programme search, and playback or detail actions. Switching scope also clears scope-local search and focus so old results cannot act on the new channel set. (libs/…/epg-guide.component.ts• L55-137, libs/…/epg-guide.component.ts• L301-344, libs/…/epg-guide-source.ts• L56-84)
The guide loads programme data for visible rows and loads coverage for the full scope. It can then filter to channels with schedule data before those rows enter view. It keeps old responses from changing a new day or scope. Programme loads are lazy and coverage loads are separate, so the “only with EPG” filter can work before every row is visible. (libs/…/epg-guide-programs.service.ts• L32-37, libs/…/epg-guide-programs.service.ts• L80-201, libs/…/epg-guide.component.ts• L145-235, libs/…/epg-guide.component.ts• L334-372)
The guide keeps the selected day, clock, zoom, row density, channel filter, and “only with EPG” choice in one view state. The clock refreshes the live marker once per minute. Zoom, density, and the coverage filter persist across guide visits. (libs/…/epg-guide-view-state.ts• L25-60, libs/…/epg-guide-view-state.ts• L80-125)
The toolbar is a presentational control surface for that state. It exposes day navigation, a jump to now, scope selection, the coverage filter, density, zoom, channel filtering, and optional programme search through outputs, while the guide shell remains the owner of state and actions. The coverage filter stays disabled until coverage is loaded. Text fields clear their value on the first Escape and then release focus so a later Escape can reach the guide. (libs/…/epg-guide-toolbar.component.ts• L23-132, libs/…/epg-guide-toolbar.component.html• L1-166)
The toolbar wraps its controls when the guide sits in a narrow pane. Search moves to a full-width row on small screens, while the channel column stays visible as the schedule lane moves. This keeps date, scope, filter, and search controls usable beside a player or split view. (libs/…/epg-guide-toolbar.component.scss• L8-29, libs/…/epg-guide-toolbar.component.scss• L189-267, libs/…/epg-guide-row.component.scss• L21-32)
Guide rows keep the channel identity visible beside the schedule lane. They distinguish hover, active, keyboard-focus, past, current, and playing states, then reduce programme content as the lane becomes narrow or the guide becomes compact. This preserves channel context and action targets while the schedule changes width. (libs/…/epg-guide-row.component.scss• L4-19, libs/…/epg-guide-row.component.scss• L21-49, libs/…/epg-guide-row.component.scss• L148-225)
Keyboard navigation gives the multi-channel grid a predictable focus model. Arrow keys move between channel rows and programme blocks. Enter selects a channel. I opens programme details. N returns to the live point. Page Up and Page Down change the day. The guide keeps one tabbable grid cell and waits for a virtual row to render before moving browser focus to it. Focus follows the channel rather than a stale row number when filters or scope changes reorder the grid. Toolbar fields, buttons, and the player keep their own keys. (libs/…/epg-guide-keyboard.controller.ts• L35-76, libs/…/epg-guide-viewport.controller.ts• L159-202, libs/…/epg-guide.component.ts• L163-179, libs/…/epg-guide.component.ts• L263-277, libs/…/epg-guide.component.ts• L391-434)
The guide also keeps the selected content visible while it loads rows on demand. It requests the first screenful before virtual scrolling reports a range, adds a buffer around visible rows, and reveals focused blocks on both axes. A jump to the current time moves the time lane and active channel together, so one scroll does not cancel the other. (libs/…/epg-guide-viewport.controller.ts• L89-156, libs/…/epg-guide-viewport.controller.ts• L204-237, libs/…/epg-guide-scroll.util.ts• L9-80)
Selecting a row activates its channel and closes the guide. A click on the channel that is already playing live does not restart playback, while the same action during catch-up returns to live viewing. (libs/…/epg-guide.component.ts• L350-388)
The multi-channel view is a runtime-backed feature. It does not claim to browse stored EPG channels when the browser or desktop bridge lacks the required capability. (libs/…/epg-runtime-bridge.service.ts• L91-107, libs/…/multi-epg-container.component.ts• L263-267)
References: libs/…/epg-guide.component.ts• L55-137 libs/…/epg-guide.component.ts• L145-235 libs/…/epg-guide.component.ts• L254-268 libs/…/epg-guide.component.ts• L301-388 libs/…/epg-guide.component.ts• L391-449 libs/…/epg-guide-source.ts• L56-84 libs/…/epg-guide-programs.service.ts• L32-37 libs/…/epg-guide-programs.service.ts• L80-201 libs/…/epg-guide-keyboard.controller.ts• L35-76 libs/…/epg-guide-viewport.controller.ts• L89-237 libs/…/epg-guide-scroll.util.ts• L9-80 libs/…/epg-guide-view-state.ts• L25-125 libs/…/epg-guide-toolbar.component.ts• L23-132 libs/…/epg-guide-toolbar.component.html• L1-166 libs/…/epg-guide-toolbar.component.scss• L8-29 libs/…/epg-guide-toolbar.component.scss• L189-267 libs/…/epg-guide-row.component.scss• L4-225 libs/…/epg-runtime-bridge.service.ts• L91-107 libs/…/multi-epg-container.component.ts• L263-267
Details and playback actions
Programme details provide the title, channel, time range, description, artwork, duration, and optional programme tags in one shared dialog. Timeline, list, guide, and channel-row surfaces use the same dialog service, so the viewer sees one action model wherever details open. The dialog can offer live playback, catch-up playback, a catch-up URL copy, or a catch-up download when the host says the selected airing is eligible. (libs/…/epg-programme-dialog.service.ts• L19-39, libs/…/epg-item-description.component.html• L1-69, libs/…/epg-item-description.component.html• L71-150, libs/…/epg-archive-copy.service.ts• L6-37, libs/…/epg-archive-download.service.ts• L6-59)
The dialog reads the EPG display offset when it opens. This keeps its date and time display aligned with the timeline, list, and current-program summary even when different surfaces open the same programme. It shows the channel name and logo when available, falls back to programme artwork or a glyph, keeps archive tools beside their notice, and keeps one dismiss action before the primary playback action. On narrow screens, the actions stack without clipping translated labels. (libs/…/epg-item-description.component.ts• L42-101, libs/…/epg-item-description.component.html• L1-19, libs/…/epg-item-description.component.html• L71-150, libs/…/epg-item-description.component.scss• L36-76, libs/…/epg-item-description.component.scss• L160-243)
Archive eligibility depends on channel archive support, the programme age, and the programme state. The guide distinguishes a schedule that can be viewed from a schedule that can also be played or downloaded. A past or current programme outside the archive window remains information only. Copy accepts only HTTP(S) URLs. Download avoids duplicate requests and reports when the resolved stream is not a supported download format. (libs/…/epg-archive.util.ts• L12-51, libs/…/epg-timeline.component.ts• L354-426, libs/…/epg-list-view.component.ts• L269-327, libs/…/epg-archive-copy.service.ts• L14-37, libs/…/epg-archive-download.service.ts• L13-59)
References: libs/…/epg-programme-dialog.service.ts• L19-39 libs/…/epg-item-description.component.ts• L42-101 libs/…/epg-item-description.component.html• L1-150 libs/…/epg-item-description.component.scss• L36-76 libs/…/epg-item-description.component.scss• L160-257 libs/…/epg-archive-copy.service.ts• L6-37 libs/…/epg-archive-download.service.ts• L6-59 libs/…/epg-archive.util.ts• L12-51 libs/…/epg-timeline.component.ts• L354-426 libs/…/epg-list-view.component.ts• L269-327
Runtime and state boundary
EPG access crosses a client-runtime boundary because import, local storage, and broad schedule browsing are desktop capabilities. The renderer uses one bridge service to call supported operations and to turn missing operations into empty or unavailable results instead of making direct platform assumptions. Read helpers load on demand, so importing guide sources does not load lookup code until a subscribed read needs it.
Runtime capabilities
The runtime capability service reports support for import, programme lookup, current-program batches, channel metadata, freshness checks, data management, channel browsing, programme search, and mapping. The bridge checks each capability before it calls the matching desktop operation. It also covers channel search and progress events. Partial or browser runtimes can therefore keep supported guide features without claiming the full EPG surface. (libs/…/runtime-capabilities.service.ts• L72-130, libs/…/epg-runtime-bridge.service.ts• L33-101, libs/…/epg-runtime-bridge.service.ts• L118-225, libs/…/epg-runtime-bridge.service.ts• L228-391)
References: libs/…/runtime-capabilities.service.ts• L72-130 libs/…/epg-runtime-bridge.service.ts• L33-101 libs/…/epg-runtime-bridge.service.ts• L118-225 libs/…/epg-runtime-bridge.service.ts• L228-391
Query and cache state
The EPG service is the renderer-facing source for imports, channel programmes, current programmes, and channel metadata. It passes playlist scope and global source settings into the lookup layer, uses the provider clock for current-airing decisions, and clears current-program answers when guide sources change. It also tracks the open channel schedule: the schedule reader loads on the first channel access, and imports, source changes, mapping changes, or display-offset changes refill that schedule. (libs/…/epg.service.ts• L42-63, libs/…/epg.service.ts• L66-113, libs/…/epg.service.ts• L173-205, libs/…/epg.service.ts• L208-313, libs/…/epg-schedule-feed.ts• L21-108)
Current-program answers use a short shared cache whose identity includes the channel, source scope, and display offset. The cache also shares an in-flight request, so several channel surfaces can ask the same question without creating duplicate work. Entries expire after 60 seconds, and a changed display offset cannot reuse a verdict made under the old setting. (libs/…/epg-program-cache.ts• L6-28, libs/…/epg-program-cache.ts• L45-67, libs/…/epg-program-cache.ts• L70-86, libs/…/epg-program-cache.ts• L109-165)
An open-channel schedule uses numbered reads. Only the latest read for the still-open channel and current display offset can publish, so a late response from a previous channel, refill, or offset cannot replace the visible schedule. A failed background refill leaves the prior schedule visible, while an ordinary opening read can report a failure and clear the schedule. (libs/…/epg-schedule-feed.ts• L9-19, libs/…/epg-schedule-feed.ts• L52-95)
Import progress is separate from programme display state. The progress service tracks each source and exposes retry or trust actions for security failures. It ignores older progress generations and waits for source reconciliation before retrying a failed import. Source-status and progress-panel views turn that state into freshness, queue, loading, and error feedback. Source status first reflects an active import state, then checks whether the source is fresh within a 12-hour window. A completed live fetch marks that source fresh without waiting for another freshness request. (libs/…/epg-progress.service.ts• L16-39, libs/…/epg-progress.service.ts• L48-112, libs/…/epg-progress.service.ts• L114-149, libs/…/epg-source-status.component.ts• L36-91)
References: libs/…/epg.service.ts• L42-63 libs/…/epg.service.ts• L66-113 libs/…/epg.service.ts• L173-205 libs/…/epg.service.ts• L208-313 libs/…/epg-schedule-feed.ts• L21-108 libs/…/epg-lookup-loader.ts• L13-47 libs/…/epg-lookups.ts• L7-25 libs/…/epg-current-programs.lookup.ts• L46-173 libs/…/epg-single-program.lookup.ts• L23-135 libs/…/epg-program-cache.ts• L45-165 libs/…/epg-progress.service.ts• L16-149 libs/…/epg-source-status.component.ts• L36-91
Related pages
Viewing experience
Read Viewing experience for the parent model that connects channel selection, playback, current-program context, and guide actions.
References: libs/…/video-player.component.html• L114-195 libs/…/live-stream-layout.component.html• L165-207
Media playback
Read Media playback for player surfaces, stream-engine choice, runtime support, recovery, and the handoff from a guide action to playback.
References: libs/…/web-player-view.component.ts• L87-124 libs/…/resolve-active-epg-program.util.ts• L5-24
Change checklist
When these files or sections are changed, remember to consider these:
- Keep
EpgProgram, providerEpgItem, and every conversion path aligned. A new or renamed time field can change sorting, current-program checks, and date display without a type error at every boundary. - Keep channel lookup keys and manual mapping keys aligned across M3U channels, portal streams, stored EPG channels, and batch queries. A mismatch can leave a playable channel without schedule data.
- Keep bridge methods, runtime capability flags, preload exposure, and guide empty states aligned. A new guide action must not appear in a runtime that cannot answer it.
- Keep source priority, source scoping, freshness, and cache invalidation aligned. A refresh, clock-offset change, or mapping change must not leave an older programme visible as current. The single-channel and batch lookup paths must walk the same scope ladder.
- Keep lazy lookup loading aligned with the enabled preference and source revision. A disabled guide or retired source must not start a code load or query after the caller subscribes.
- Keep lookup-module load failure separate from guide-data failure. A failed lazy chunk must return the empty result and remain retryable on the next lookup.
- Keep the open-channel schedule read contract aligned with refill triggers. Channel changes, keyless channels, source changes, imports, archive windows, and display offsets must not restore or retain the wrong schedule.
- Keep schedule publication guards aligned with the visible channel and offset. A failed refill must not clear a usable schedule, while an ordinary read failure must not leave old channel data visible.
- Keep timeline overlap rules and list overlap rules aligned for programmes that cross midnight or have malformed time ranges.
- Keep archive-window checks aligned with the catch-up URL builders used by the playback hosts. Guide actions must reflect what the active channel can actually play.
- Keep archive copy and download eligibility aligned with URL resolution and runtime download support. A visible action must not expose a credential-bearing or unsupported URL.
- Keep portal mapping ownership aligned with provider fallback behavior. An empty mapped guide must still prevent portal schedule data from appearing for that channel.
- Keep source labels and tooltips aligned with import state. A shortened label must not replace the full source value needed for retry, trust, or error handling.
- Keep progress generations and retry reconciliation aligned with source ownership. A late event or retry must not restore an import that settings removed.
- Keep the deferred progress-panel trigger aligned with its load-error fallback. A failed panel view must still report an active import and its errors.
- Keep freshness badge precedence aligned with progress updates. A completed import must not remain stale while the source-status view waits for a second freshness check.
- Keep guide coverage and lazy row loading aligned with day and scope changes. A failed coverage chunk must not hide rows, and an old programme response must not populate a new window.
- Keep persisted guide preferences aligned with the guide controls. Zoom, density, and the coverage filter must remain valid when their allowed values change.
- Keep the toolbar inputs and outputs aligned with guide state. A control that emits a value the host does not apply, or a coverage filter that ignores its loading state, can leave the controls out of sync with the guide.
- Keep keyboard ownership and roving focus aligned with the guide grid. Document-level keys must not steal input from toolbar controls or the player, and a filtered or recycled row must not leave Enter acting on a different channel.
- Keep scope changes aligned with search and focus state. Scope-local search hits and focused rows must not survive into a different channel set.
- Keep channel activation aligned with playback mode. Selecting the already-live channel must not restart its stream, while selecting it during catch-up must return to live playback.
- Keep horizontal and vertical reveal actions in one scroll operation when they share an animation. Separate smooth scrolls can cancel each other and leave the guide at the wrong time or row.
- Keep the shared programme dialog configuration aligned with every surface that opens details. A change to action order, archive tools, or narrow-screen layout must preserve the common result contract.
- Keep the timeline's full track geometry aligned with its rendered window. Scroll, resize, zoom, day, and axis changes must not expose a blank range or omit the block that the ribbon shows.
- Keep zoom anchoring aligned with window updates. A clamped or coalesced zoom must render the attainable range before the browser applies the new scroll position.
- Keep timeline block focus and popover state aligned with windowing. Removing a focused block must not leave a tooltip or keyboard action attached to an unrendered programme.
- Keep the guide's responsive surfaces aligned with the shared EPG theme tokens. A light or dark theme change must preserve contrast for live, selected, past, and archive states.
- Keep timeline empty reasons, translated messages, and available actions aligned. A reason must not show a retry, settings, or day-navigation action that does not apply to the missing schedule.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A channel has no matching EPG identity or has a stale manual mapping | The stream plays but the guide shows no programme data | Resolve the preferred channel key and apply playlist-aware mappings before querying |
| A programme has invalid dates or a stop time at or before its start | The row is dropped or could otherwise show an impossible range | Normalize dates and reject invalid time ranges before guide rendering |
| An XMLTV source is stale, blocked, or fails during import | Current programmes and schedules remain empty or old | Check freshness, report progress and actionable trust errors, then allow retry or forced refresh |
| The client lacks a required EPG bridge method | Import, search, or multi-channel browsing cannot complete | Gate each operation with its runtime capability and show the matching unavailable state |
| A provider returns no schedule for a stream | The guide may have no data even though the channel is valid | Apply the configured provider/XMLTV source order and use the mapped EPG channel when available |
| A saved portal mapping has no programmes in its mapped guide | Portal programmes can reappear even though the user selected an XMLTV source | Preserve mapping ownership separately from mapped programme rows and suppress provider fallback |
| A schedule request completes after the user changes channel, offset, source, scope, portal, day, or time window | Old programmes can replace the schedule for the new context | Tag reads with channel, offset, source, or request generations and ignore stale results |
| A background schedule refill cannot read the store | A transient database error can erase the schedule already on screen | Use the refill error mode, keep the prior schedule, and avoid a duplicate toast |
| A lazy lookup starts after guide disablement or source revision change | A retired request can load code or query data for an inactive source | Capture enabled state and source revision at request creation and check both before querying |
| A lazy lookup chunk fails to load | The guide request fails or prevents later reads from recovering | Return the empty result, clear the failed module promise, and retry on the next lookup |
| A current-program cache key omits source scope or display offset | A channel can show a programme from another guide or an old current-airing verdict | Include normalized scope and offset in single and batch cache identities |
| A progress event belongs to an older import generation | A late completion or error can replace the current source state | Ignore progress with an older generation than the stored row |
| A retry starts while source settings reconciliation is still active | The old source can be fetched again after the user removed it | Wait for reconciliation and verify that the same progress row still owns the retry |
| A past programme is outside the channel archive window | Details are available but catch-up playback must not start | Check archive support and the allowed age before exposing a playback action |
| A resolved archive URL is not HTTP(S) or is an unsupported stream file | Copy or download can expose an unsafe URL or fail as a file transfer | Validate the URL scheme, reject duplicate downloads, and report unsupported HLS downloads |
| A source label contains a long path, query, or local file path | The import panel becomes hard to scan or displays sensitive URL parts in the row | Render a compact host-and-file or local-file label and keep the full value in the tooltip |
| The deferred progress-panel view cannot load while an import is active | Import progress and import errors are not visible | Keep the shell mounted and show its load-error alert while the import remains visible |
| Freshness is checked while an import is still active | The status badge can show stale or unknown during work, or hide an import error | Give loading, queued, complete, and error progress states priority over freshness |
| A guide coverage request fails for only part of the channel set | The filter can hide channels that have schedule data | Fail open with unknown coverage until all coverage chunks succeed |
| A guide key is handled while focus is in a toolbar control or player | The guide changes channel or day instead of the focused control | Require guide ownership for all keys except Escape and ignore foreign interactive targets |
| A virtual row is not rendered when focus moves to it | Browser focus stays on an old cell or leaves the guide | Wait for the requested row to render before focusing the single tabbable grid cell |
| A scope change leaves a search result or focused row alive | A result or key action targets a channel outside the current scope | Clear scope-local search and reconcile focus when the channel set changes |
| A guide click activates the already-live channel again | Playback restarts or a double-click causes repeated activation | Treat an already-live active row as selected without restarting it; allow catch-up mode to activate live playback |
| The now jump uses separate smooth scrolls for the lane and active row | The browser cancels one animation and opens at the wrong time or row | Scroll both axes with one operation |
| Long timeline renders every programme block at once | Channel selection creates excessive page work before the stream starts | Keep the full track width but render a buffered range around the ribbon |
| A zoom, resize, or axis change leaves the rendered window at its old centre | The ribbon can show blank content or omit blocks at the attainable scroll position | Update the window for the anchored or measured viewport before relying on a later scroll event |
| A focused timeline block leaves the rendered range | Its popover can describe a programme that is no longer shown | Tie popover state to the current rendered item set and clear it when the block is removed |
| A toolbar output is not applied by the guide shell | The visible date, scope, filter, or density control can differ from the guide state | Keep toolbar inputs and outputs mapped to the shell's single view state |
Key files
| File | Why to read it |
|---|---|
| libs/…/epg.service.ts | Renderer-facing EPG access, source scope, provider-clock decisions, refresh invalidation, open-channel schedule ownership, and import ownership |
| libs/…/epg-schedule-feed.ts | Open-channel schedule reads, refill behavior, archive-window retention, and stale-response protection |
| libs/…/epg-lookup-loader.ts | Lazy lookup loading and retirement of reads after disablement or source changes |
| libs/…/epg-lookups.ts | Composition of single-channel, batch, and metadata read helpers |
| libs/…/epg-current-programs.lookup.ts | Source-scope order, batch lookup, legacy per-channel fallback, and optional any-source retry |
| libs/…/epg-single-program.lookup.ts | Single-channel scope lookup, current-airing selection, and scoped fallback behavior |
| libs/…/epg-program-cache.ts | Short-lived current-program cache and in-flight request sharing by scope and display offset |
| libs/…/epg-runtime-bridge.service.ts | Runtime boundary, capability gates, guide queries, mapping access, and progress events |
| libs/…/epg-progress.service.ts | Import progress generations, retry ownership, trust actions, and source reconciliation |
| apps/…/epg-fetch.service.ts | Source freshness checks and import orchestration |
| apps/…/epg-database.ts | High-level relationship between imported channels, programmes, sources, and stored schedule data |
| apps/…/epg-query.service.ts | Channel matching and programme query behavior in the desktop data layer |
| libs/…/epg-program.model.ts | Shared programme contract used by source adapters and guide views |
| libs/…/channel-epg-lookup.util.ts | Channel identity fallback order for playlist-based guide lookup |
| libs/…/epg-guide.component.ts | Multi-channel guide coordination, channel activation, search, scope changes, focus, and guide actions |
| libs/…/epg-guide-toolbar.component.ts | Presentational guide controls, state inputs, action outputs, and field keyboard behavior |
| libs/…/epg-guide-toolbar.component.scss | Responsive guide controls and narrow-pane layout |
| libs/…/epg-guide-row.component.scss | Channel-column layout, programme state styling, focus treatment, and compact row presentation |
| libs/…/epg-guide-keyboard.controller.ts | Keyboard ownership, grid navigation, action keys, and focus state |
| libs/…/epg-guide-viewport.controller.ts | Virtual row loading, focus reveal, initial rendering, and two-axis guide scrolling |
| libs/…/epg-guide-scroll.util.ts | Pure geometry for now, row, and programme-block reveal behavior |
| libs/…/epg-guide-view-state.ts | Guide day, clock, zoom, density, channel filtering, coverage filtering, and persisted view preferences |
| libs/…/epg-guide-source.ts | Host contract for scoped channels, programme windows, coverage, search, and playback |
| libs/…/epg-guide-programs.service.ts | Lazy programme loading, full-scope coverage, request generations, and row status |
| libs/…/epg-timeline.component.ts | Timeline guide contract, date state, live marker, zoom, windowed rendering, empty states, and guide actions |
| libs/…/epg-timeline-empty-state.component.ts | Empty-schedule reasons and the actions that fit each reason |
| libs/…/epg-timeline-empty-state.component.scss | Empty-state sizing, centering, tones, and compact-panel layout |
| libs/…/epg-timeline-track.component.html | Timeline programme, group, live, archive, and detail actions |
| libs/…/epg-timeline-window.controller.ts | Visible timeline range, buffered rendering, and viewport updates during scroll, resize, and zoom |
| libs/…/epg-timeline-zoom.controller.ts | Timeline scale changes and cursor or viewport anchoring |