Full audit of CLAUDE.md, AGENTS.md, README.md and docs/architecture/ against the codebase; every fix is backed by current code: - remove documented-but-unimplemented IPTVNATOR_DISABLE_HARDWARE_ACCELERATION flag (no reads anywhere in apps/, libs/, tools/) - CLAUDE.md: add epg_channel_mappings to the schema table list - m3u-playlist-module: *-tab dirs -> *-view (+recent-view), selectActivePlaylist, real PlaylistState shape, ChannelEpgMetadata instead of removed EnrichedChannel, actual /workspace/playlists routes, per-view outputs, live-epg-panel-state key - workspace-dashboard: per-rail Settings.dashboardRails toggles, three missing rails in the diagram, split live-favorites/recent-live rails, welcome-dashboard empty-state type, RECENTLY_WATCHED_LIVE_TV title key - stalker-portal: CategoryContentViewComponent for vod/series, collection-route components for favorites/recent, corrected series-view/favorites-button paths, actor/:personId route, epg panel selectors - category-management: reloadCategories lives in with-content.feature.ts, workspace-context-panel owns the dialog, XtreamPendingRestoreService flow - stalker-mock-server (+app README): scenario-seeded faker, resetAll() clears content cache too, ordinal season episode ids, handlers/ dir location - sqlite-db-worker: cancellation shipped (drop from out-of-scope), full operations module list - portal-detail-navigation: replace three removed component paths - tmdb-metadata-enrichment: details cache keys are id:<tmdbId>|v2 - electron-security: CSP frame-src youtube-nocookie exception, sandbox: !frameCopyExperiment nuance - download-manager: libs/portal/xtream instead of xtream-electron folder, data-driven downloads nav, drop removed app-search-result-item note - playlist-backup-restore: settings-backup facade owns the import handoff - workspace-shell: functional workspaceEntryRedirect, playlists route children - iptvnator-ui-guidelines: EPG card radius 11px, detail-view mixin is `base` - embedded-mpv-native, player-controls-contract: minor precision fixes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5.0 KiB
Playlist Backup/Restore Architecture
This document describes the versioned playlist backup/restore flow used by the settings screen.
Entry Points
- UI:
/Users/4gray/Code/iptvnator/apps/web/src/app/settings/settings-backup-section.component.ts(embedded insettings.component.html), with the file read/handoff in/Users/4gray/Code/iptvnator/apps/web/src/app/settings/settings-backup.facade.ts - Backup service:
/Users/4gray/Code/iptvnator/libs/services/src/lib/playlist-backup.service.ts - Manifest types:
/Users/4gray/Code/iptvnator/libs/shared/interfaces/src/lib/playlist-backup.interface.ts - Xtream pending restore storage:
/Users/4gray/Code/iptvnator/libs/services/src/lib/xtream-pending-restore.service.ts
Manifest Contract
Backups are versioned JSON manifests, not raw Playlist[] dumps and not SQLite
database snapshots.
Top-level shape:
kind: "iptvnator-playlist-backup"version: 1exportedAtincludeSecretssettings?.epgUrlsplaylists[]
The manifest is portable across machines because it stores playlist definitions and portable user state, while excluding cache-only database content.
Export Scope
M3U
M3U backups are self-contained.
- Always export canonical
rawM3ufromPlaylistsService.getRawPlaylistById() - Preserve source metadata when available:
- original source kind:
url,file, ortext - original URL
userAgent,referrer,originfilePathHintfor provenance only
- original source kind:
- Export playlist-scoped user state:
- favorites by channel URL
- recently viewed M3U items
- hidden group titles
The embedded raw text is the canonical restore artifact. The internal parsed playlist object graph is not the backup format.
Xtream
Xtream backups export only connection metadata plus portable user state.
- Connection metadata:
serverUrlusernamepassword
- User state:
- hidden categories by
{ categoryType, xtreamId } - favorites by
{ contentType, xtreamId, addedAt?, position? } - recently viewed by
{ contentType, xtreamId, viewedAt } - playback positions as
PlaybackPositionData[]
- hidden categories by
Explicitly excluded:
- cached categories/content rows
- import-status flags and other app-state cache markers
- downloads
Stalker
Stalker backups export connection metadata plus playlist-scoped favorites/recent state.
- Exported connection fields:
portalUrlmacAddressisFullStalkerPortalusernamepassworduserAgentreferrerorigin- serial/device/signature fields when present
- Exported user state:
- favorites snapshots
- recently viewed snapshots
Explicitly excluded:
stalkerTokenstalkerAccountInfo- playback positions in v1
App Settings
Only EPG source URLs are backed up at the app-settings level.
- Exported:
settings.epgUrls - Excluded: cached EPG database content
Import Flow
The settings backup facade (settings-backup.facade.ts, driven by
settings-backup-section.component.ts) reads the file (file.text()) and
hands its contents to PlaylistBackupService.importBackup().
The service:
- Validates the manifest kind/version before any writes.
- Rejects legacy raw
Playlist[]JSON blobs. - Builds stable source fingerprints for merge-vs-create decisions.
- Upserts playlists into app playlist storage.
- Restores provider-specific user state.
Fingerprint rules:
- M3U URL playlists: normalized URL
- M3U without URL: hash of canonical
rawM3u - Xtream: normalized
serverUrl + username - Stalker: normalized
portalUrl + macAddress
If a fingerprint matches an existing playlist:
- keep the existing playlist ID
- update mutable metadata from the backup
- replace playlist-scoped state with the backup payload
If no fingerprint matches:
- create a new playlist
- reuse
exportedIdonly when it is unused - otherwise generate a new UUID
Xtream Restore Contract
Xtream restore is type-aware end to end. The app no longer stores plain
xtream_id[] arrays for refresh/import restore because IDs can collide across
live, movie, and series.
Runtime contract:
- shared shape:
XtreamPendingRestoreState - persisted in local storage by playlist ID
- consumed by:
- Xtream refresh actions
- settings backup import
- Xtream content initialization
Electron restore behavior:
- Category import reads pending hidden-category state while saving categories.
- After content import, favorites/recent state is restored by typed
{ contentType, xtreamId }matching. - Playback positions are cleared and re-applied from backup state.
For existing Xtream playlists with a fully populated offline cache, backup import applies the restore immediately. Otherwise the typed restore payload is left pending until the next Xtream initialization/import.
Current UX
The settings page now exports/imports “playlist backups” instead of the old raw JSON application dump.
- Export filename:
iptvnator-playlist-backup-YYYY-MM-DD.json - Import summary reports:
- imported
- merged
- skipped
- failed