StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Refine provider sync flow and TV player UX
David Nashash8d52f62753b7
diff --git a/README.md b/README.mdindex f94063d9..34f9cf43 100644--- a/README.md+++ b/README.md@@ -4,38 +4,141 @@ StreamVault is a TV-first IPTV player for Android TV built with Kotlin, JetpackIt is designed for large playlists, remote-friendly browsing, fast provider switching, and a polished living-room playback experience. StreamVault supports both `M3U` playlists and `Xtream Codes`, with dedicated flows for `Live TV`, `Movies`, and `Series`.+Built for Android TV first, StreamVault focuses on the things generic IPTV apps usually get wrong: D-pad navigation, quick channel movement, large-library organization, and a player that still feels good to use from the couch. Phone and tablet installs are also supported, but the primary UX target is TV.+## Highlights- Android TV-first interface with D-pad-friendly focus, navigation, and playback flows-- Live TV with favorites, recent channels, custom groups, pinned categories, and fast channel browsing-- Movie and series libraries with detailed metadata screens, resume support, and category navigation+- Playlist support for `Xtream Codes` and `M3U` sources, including local playlist files+- Fast live-TV browsing with preview mode, favorites, recent channels, custom groups, and pinned categories+- Movie and series libraries with detailed info pages, resume support, episode switching, and auto-play for next episodes+- Full EPG support with guide search, XMLTV support, and provider archive or catch-up when available- Multi-view split-screen playback for watching multiple channels at once-- Full EPG support with now-playing data and provider archive or catch-up support when available- Strong parental controls with PIN-protected categories and automatic adult-category detection-- Global search across live channels, movies, and series-- Launcher and TV integrations including Android TV entry points and TV input support+- TV integrations including Watch Next, launcher recommendations, TV input sync, and Cast support++## Features++### Playlist Support++- `Xtream Codes`+- `M3U` playlists from URLs plus local files+- Separate onboarding and sync flows for live channels, movies, series, and guide data+- Fast switching between providers with provider-scoped settings++### Navigation And TV UX++- Designed for Android TV and D-pad navigation first+- Fast channel browsing with large-playlist friendly layouts+- Numeric remote input for direct channel entry+- Preview mode while browsing channels+- TV-friendly search and text-entry flows++### Live TV And Channel Management++- Favorites and recently watched channels+- Custom groups for personal channel collections+- Pinned categories surfaced near the top of the live guide rail+- Long-press live categories for actions like pin, hide, lock or unlock, and custom-group management+- Channel reordering for favorites and custom groups+- Channel numbering modes by group or across the full provider lineup+- Predefined filter words to make category search cleaner on noisy provider data++### Guide, Search, And Playback++- Full EPG grid view+- Program search inside the guide+- XMLTV guide support with built-in EPG source management+- Provider archive or catch-up support when the source exposes replay streams+- Global search across live TV, movies, and series+- Multi-view for watching multiple live streams at once+- Player controls for subtitles, audio tracks, aspect ratio, playback speed, video quality, and Cast++### Movies And Series++- Two VOD layouts:+ - Modern shelf-based browsing+ - Classic left-sidebar category browsing+- Detailed info pages for movies and series+- Continue watching and playback history+- Long-press VOD categories and custom groups for actions like hide, rename, delete, or reorder when applicable+- In-player episode switching for series+- Automatic next-episode playback when another episode is available++### Parental Controls++- Hide categories completely+- Lock categories behind a PIN+- Option to hide locked content from browsing views+- Adult-category detection using provider flags and category naming heuristics++### Languages And Device Support++- English plus 25 translated locale packs currently ship with the app+- Translation coverage is broad, but some locales are still machine-assisted and may need cleanup+- Built for TV first; phones and tablets are supported, but not the primary design target++### Platform Integrations++- Android TV Watch Next integration+- Launcher recommendations and TV entry points+- Android TV Input Framework channel sync+- Google Cast sender support-## Feature Set+## Quick TV Tips-- Provider onboarding for `M3U` playlists and `Xtream Codes`-- Resilient sync pipeline for live, movie, series, and EPG data-- TV-optimized search inputs and provider setup forms-- Favorites, recent history, continue watching, and playback history-- Custom favorite groups and personalized live-TV organization-- Multi-view audio focus management and split-screen planning-- Subtitle, audio-track, aspect-ratio, playback-speed, and video-track controls-- Cast integration-- Provider-scoped settings and category visibility or protection preferences+- Long-press a channel, movie, or series to add it to Favorites or a custom group.+- Long-press a live category to open category actions such as pin, hide, lock or unlock, and custom-group actions.+- In Movies and Series, long-press categories or custom groups for hide or group-management actions where available.+- Long-press a live channel to queue it for Split Screen.+- Use the number keys on a remote while in the player to jump directly to a channel.+- While watching a series, open Episodes in the player to switch episodes without backing out to the details page.## Screenshots-Add your own screenshots to `docs/images/` and update this section with the final image links when they are ready.+### Home++++### Live TV++++### Channel Preview++++### Movies++++### Movie Details++++### Series Episodes++++### Guide++++### Settings++## Download- [Download latest StreamVault.apk](https://github.com/Davidona/StreamVault-IPTV/releases/latest/download/StreamVault.apk)- Every push to `master` now triggers GitHub Actions to build a fresh APK and publish it as the latest GitHub Release asset.+## Support++If StreamVault is useful to you, you can support development here:++- [Support on Ko-fi](https://ko-fi.com/davidona)+## Project Structure- `app/` Android app UI, navigation, dependency injection, and Android TV integrationsdiff --git a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt b/app/src/main/java/com/streamvault/app/di/DatabaseModule.ktindex a500a994..2ce767c3 100644--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt@@ -50,7 +50,8 @@ object DatabaseModule {StreamVaultDatabase.MIGRATION_22_23,StreamVaultDatabase.MIGRATION_23_24,StreamVaultDatabase.MIGRATION_24_25,- StreamVaultDatabase.MIGRATION_25_26+ StreamVaultDatabase.MIGRATION_25_26,+ StreamVaultDatabase.MIGRATION_26_27)// NOTE: fallbackToDestructiveMigration() intentionally removed.// All future schema changes MUST add a corresponding Migration in StreamVaultDatabase.diff --git a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.ktindex 19765c0b..8dd371d1 100644--- a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt+++ b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt@@ -45,7 +45,10 @@ data class PlayerNavigationRequest(val archiveStartMs: Long? = null,val archiveEndMs: Long? = null,val archiveTitle: String? = null,- val returnRoute: String? = null+ val returnRoute: String? = null,+ val seriesId: Long? = null,+ val seasonNumber: Int? = null,+ val episodeNumber: Int? = null) : Serializableobject Routes {@@ -120,7 +123,10 @@ object Routes {internalId = episode.id,providerId = episode.providerId,contentType = "SERIES_EPISODE",- artworkUrl = episode.coverUrl+ artworkUrl = episode.coverUrl,+ seriesId = episode.seriesId.takeIf { it > 0L },+ seasonNumber = episode.seasonNumber,+ episodeNumber = episode.episodeNumber)}@@ -140,7 +146,10 @@ object Routes {archiveStartMs: Long? = null,archiveEndMs: Long? = null,archiveTitle: String? = null,- returnRoute: String? = null+ returnRoute: String? = null,+ seriesId: Long? = null,+ seasonNumber: Int? = null,+ episodeNumber: Int? = null): PlayerNavigationRequest {return PlayerNavigationRequest(streamUrl = streamUrl,@@ -155,7 +164,10 @@ object Routes {archiveStartMs = archiveStartMs,archiveEndMs = archiveEndMs,archiveTitle = archiveTitle,- returnRoute = returnRoute+ returnRoute = returnRoute,+ seriesId = seriesId,+ seasonNumber = seasonNumber,+ episodeNumber = episodeNumber)}@@ -342,7 +354,10 @@ fun AppNavigation(mainActivity: MainActivity) {internalId = history.contentId,providerId = history.providerId,contentType = history.contentType.name,- returnRoute = Routes.HOME+ returnRoute = Routes.HOME,+ seriesId = history.seriesId,+ seasonNumber = history.seasonNumber,+ episodeNumber = history.episodeNumber)}}@@ -534,9 +549,14 @@ fun AppNavigation(mainActivity: MainActivity) {archiveEndMs = playerRequest?.archiveEndMs,archiveTitle = playerRequest?.archiveTitle,returnRoute = playerRequest?.returnRoute,+ seriesId = playerRequest?.seriesId,+ seasonNumber = playerRequest?.seasonNumber,+ episodeNumber = playerRequest?.episodeNumber,onBack = {val route = playerRequest?.returnRoute- if (!route.isNullOrBlank()) {+ if (navController.previousBackStackEntry != null) {+ navController.popBackStack()+ } else if (!route.isNullOrBlank()) {navController.navigate(route) {popUpTo(Routes.PLAYER) { inclusive = true }launchSingleTop = truediff --git a/app/src/main/java/com/streamvault/app/ui/model/LiveTvChannelMode.kt b/app/src/main/java/com/streamvault/app/ui/model/LiveTvChannelMode.ktindex a49397ef..094ce98d 100644--- a/app/src/main/java/com/streamvault/app/ui/model/LiveTvChannelMode.kt+++ b/app/src/main/java/com/streamvault/app/ui/model/LiveTvChannelMode.kt@@ -7,6 +7,6 @@ enum class LiveTvChannelMode {companion object {fun fromStorage(value: String?): LiveTvChannelMode =- entries.firstOrNull { it.name == value } ?: COMPACT+ entries.firstOrNull { it.name == value } ?: PRO}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.ktindex e2ee87b5..c0010183 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.screens.homeimport androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.foundation.basicMarqueeimport androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.Canvasimport androidx.compose.foundation.layout.*@@ -32,9 +33,8 @@ import androidx.compose.ui.input.key.onPreviewKeyEventimport androidx.compose.material.icons.filled.Lockimport androidx.compose.material.icons.Iconsimport androidx.compose.ui.graphics.Color-import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp-import androidx.compose.ui.unit.spimport androidx.hilt.lifecycle.viewmodel.compose.hiltViewModelimport androidx.tv.material3.*import androidx.compose.material3.SnackbarHost@@ -86,7 +86,6 @@ import java.util.Dateimport java.util.Localeimport com.streamvault.app.ui.interaction.TvClickableSurfaceimport com.streamvault.app.ui.interaction.TvButton-import com.streamvault.app.ui.interaction.TvIconButtonprivate enum class FocusRestoreTarget {CATEGORY,@@ -827,62 +826,6 @@ fun HomeScreen(contentPadding = PaddingValues(bottom = 16.dp)) {- // ── Split Screen entry (under search bar) ──- if (hasSplitChannels) {- item {- Spacer(Modifier.height(8.dp))- var isFocused by remember { mutableStateOf(false) }- TvClickableSurface(- onClick = { showSplitManagerDialog = true },- modifier = Modifier- .fillMaxWidth()- .onFocusChanged { isFocused = it.isFocused },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color(0xFF0D2E16),- focusedContainerColor = Color(0xFF1B5E20)- ),- border = ClickableSurfaceDefaults.border(- border = androidx.tv.material3.Border(- border = androidx.compose.foundation.BorderStroke(- 1.dp,- Color(0xFF2E7D32)- )- )- )- ) {- Row(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 10.dp, vertical = 6.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(8.dp)- ) {- Text(- text = stringResource(R.string.action_split),- fontSize = 14.sp- )- Column(modifier = Modifier.weight(1f)) {- Text(- text = stringResource(R.string.multiview_nav),- style = MaterialTheme.typography.labelMedium,- color = Color.White,- fontWeight = FontWeight.Medium- )- Text(- text = stringResource(R.string.label_slots_count, uiState.multiviewChannelCount),- style = androidx.compose.ui.text.TextStyle(- fontSize = 9.sp,- color = Color(0xFF81C784)- )- )- }- }- }- Spacer(Modifier.height(12.dp))- }- }-items(items = visibleCategories,key = { it.id }@@ -956,15 +899,39 @@ fun HomeScreen(.padding(start = 8.dp, top = 2.dp, bottom = if (isDenseMode) 4.dp else 6.dp, end = 8.dp),verticalArrangement = Arrangement.spacedBy(if (isDenseMode) 2.dp else 4.dp)) {- Text(- text = displayedCategory?.name ?: if (hasBlockedCategorySearch) {- stringResource(R.string.home_locked_short)- } else {- stringResource(R.string.home_all_channels)- },- style = if (isDenseMode) MaterialTheme.typography.titleMedium else MaterialTheme.typography.titleLarge,- color = OnBackground- )+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = displayedCategory?.name ?: if (hasBlockedCategorySearch) {+ stringResource(R.string.home_locked_short)+ } else {+ stringResource(R.string.home_all_channels)+ },+ style = if (isDenseMode) MaterialTheme.typography.titleMedium else MaterialTheme.typography.titleLarge,+ color = OnBackground,+ maxLines = 1,+ overflow = TextOverflow.Clip,+ modifier = Modifier+ .weight(1f)+ .padding(end = 8.dp)+ .basicMarquee(+ iterations = Int.MAX_VALUE,+ initialDelayMillis = 900,+ repeatDelayMillis = 1200,+ velocity = 24.dp+ )+ )+ if (hasSplitChannels) {+ CompactSplitLauncherButton(+ slotCount = uiState.multiviewChannelCount,+ onClick = { showSplitManagerDialog = true },+ modifier = Modifier.padding(start = 12.dp)+ )+ }+ }if (isDenseMode) {Row(horizontalArrangement = Arrangement.spacedBy(10.dp),@@ -994,29 +961,19 @@ fun HomeScreen(})}- Row(- horizontalArrangement = Arrangement.spacedBy(if (isDenseMode) 8.dp else 12.dp),- verticalAlignment = Alignment.CenterVertically- ) {- SearchInput(- value = uiState.channelSearchQuery,- onValueChange = {- if (!isReorderMode) {- viewModel.updateChannelSearchQuery(it)- }- },- placeholder = stringResource(R.string.home_search_channels),- onSearch = {},- focusRequester = channelSearchFocusRequester,- modifier = Modifier.width(channelSearchWidth),- enabled = !isReorderMode- )- if (hasSplitChannels) {- StatusPill(- label = stringResource(R.string.split_count_format, stringResource(R.string.live_shell_split), uiState.multiviewChannelCount)- )- }- }+ SearchInput(+ value = uiState.channelSearchQuery,+ onValueChange = {+ if (!isReorderMode) {+ viewModel.updateChannelSearchQuery(it)+ }+ },+ placeholder = stringResource(R.string.home_search_channels),+ onSearch = {},+ focusRequester = channelSearchFocusRequester,+ modifier = Modifier.width(channelSearchWidth),+ enabled = !isReorderMode+ )}Crossfade(@@ -1385,6 +1342,52 @@ fun HomeScreen(}+@Composable+private fun CompactSplitLauncherButton(+ slotCount: Int,+ onClick: () -> Unit,+ modifier: Modifier = Modifier+) {+ TvClickableSurface(+ onClick = onClick,+ modifier = modifier+ .widthIn(min = 112.dp)+ .height(34.dp),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Primary.copy(alpha = 0.18f),+ focusedContainerColor = Primary.copy(alpha = 0.3f),+ contentColor = OnBackground+ ),+ border = ClickableSurfaceDefaults.border(+ border = androidx.tv.material3.Border(+ border = BorderStroke(1.dp, Primary.copy(alpha = 0.55f))+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier+ .padding(horizontal = 10.dp, vertical = 6.dp),+ horizontalArrangement = Arrangement.spacedBy(6.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = stringResource(R.string.action_split),+ style = MaterialTheme.typography.labelSmall,+ color = OnBackground,+ maxLines = 1+ )+ Text(+ text = stringResource(R.string.label_slots_count, slotCount),+ style = MaterialTheme.typography.labelSmall,+ color = PrimaryLight,+ maxLines = 1+ )+ }+ }+}+@Composableprivate fun LivePreviewPane(channel: Channel?,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.ktindex 4cc37c11..770f7dc3 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt@@ -1312,7 +1312,7 @@ data class HomeUiState(val selectedCategoryForOptions: Category? = null,val isChannelReorderMode: Boolean = false,val reorderCategory: Category? = null,- val liveTvChannelMode: LiveTvChannelMode = LiveTvChannelMode.COMFORTABLE,+ val liveTvChannelMode: LiveTvChannelMode = LiveTvChannelMode.PRO,val previewChannelId: Long? = null,val previewPlayerEngine: PlayerEngine? = null,val isPreviewLoading: Boolean = false,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.ktindex 285da6a9..e5d2b7e7 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt@@ -81,6 +81,7 @@ import com.streamvault.app.ui.screens.player.overlay.DiagnosticsOverlayimport com.streamvault.app.ui.screens.player.overlay.EpgOverlayimport com.streamvault.app.ui.screens.player.overlay.PlayerErrorOverlayimport com.streamvault.app.ui.screens.player.overlay.PlayerNoticeBanner+import com.streamvault.app.ui.screens.player.overlay.PlayerEpisodeSelectionDialogimport com.streamvault.app.ui.screens.player.overlay.PlayerResumePromptimport com.streamvault.app.ui.screens.player.overlay.PlayerTrackSelectionDialogimport com.streamvault.app.ui.screens.player.overlay.PlayerAspectRatioToast@@ -110,6 +111,9 @@ fun PlayerScreen(archiveStartMs: Long? = null,archiveEndMs: Long? = null,archiveTitle: String? = null,+ seriesId: Long? = null,+ seasonNumber: Int? = null,+ episodeNumber: Int? = null,returnRoute: String? = null,onBack: () -> Unit,onNavigate: ((String) -> Unit)? = null,@@ -147,7 +151,11 @@ fun PlayerScreen(val nextProgram by viewModel.nextProgram.collectAsStateWithLifecycle()val programHistory by viewModel.programHistory.collectAsStateWithLifecycle()val currentChannel by viewModel.currentChannel.collectAsStateWithLifecycle()+ val currentSeries by viewModel.currentSeries.collectAsStateWithLifecycle()+ val currentEpisode by viewModel.currentEpisode.collectAsStateWithLifecycle()+ val playbackTitle by viewModel.playbackTitle.collectAsStateWithLifecycle()val resumePrompt by viewModel.resumePrompt.collectAsStateWithLifecycle()+ val canOpenEpisodePicker = contentType == "SERIES_EPISODE" && currentSeries?.seasons?.any { it.episodes.isNotEmpty() } == trueval showChannelListOverlay by viewModel.showChannelListOverlay.collectAsStateWithLifecycle()val showCategoryListOverlay by viewModel.showCategoryListOverlay.collectAsStateWithLifecycle()@@ -181,6 +189,7 @@ fun PlayerScreen(var showSpeedSelection by remember { mutableStateOf(false) }var showProgramHistory by remember { mutableStateOf(false) }var showSplitDialog by remember { mutableStateOf(false) }+ var showEpisodePicker by remember { mutableStateOf(false) }val focusRequester = remember { FocusRequester() }val channelListFocusRequester = remember { FocusRequester() }@@ -259,7 +268,7 @@ fun PlayerScreen(// Consolidated focus management for all overlaysval liveOverlayVisible = contentType == "LIVE" && (showChannelListOverlay || showCategoryListOverlay || showEpgOverlay || showChannelInfoOverlay)- val anyOverlayVisible = liveOverlayVisible || showTrackSelection != null || showSpeedSelection || showProgramHistory || showSplitDialog || showDiagnostics+ val anyOverlayVisible = liveOverlayVisible || showTrackSelection != null || showSpeedSelection || showProgramHistory || showSplitDialog || showEpisodePicker || showDiagnosticsLaunchedEffect(contentType, showCategoryListOverlay, showChannelListOverlay, showEpgOverlay, showChannelInfoOverlay) {if (contentType == "LIVE" && (showCategoryListOverlay || showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay)) {@@ -331,7 +340,7 @@ fun PlayerScreen()}- LaunchedEffect(streamUrl, epgChannelId, title, artworkUrl, internalChannelId, categoryId, providerId, isVirtual, contentType, archiveStartMs, archiveEndMs, archiveTitle) {+ LaunchedEffect(streamUrl, epgChannelId, title, artworkUrl, internalChannelId, categoryId, providerId, isVirtual, contentType, archiveStartMs, archiveEndMs, archiveTitle, seriesId, seasonNumber, episodeNumber) {viewModel.prepare(streamUrl = streamUrl,epgChannelId = epgChannelId,@@ -344,7 +353,10 @@ fun PlayerScreen(artworkUrl = artworkUrl,archiveStartMs = archiveStartMs,archiveEndMs = archiveEndMs,- archiveTitle = archiveTitle+ archiveTitle = archiveTitle,+ seriesId = seriesId,+ seasonNumber = seasonNumber,+ episodeNumber = episodeNumber)}@@ -362,10 +374,10 @@ fun PlayerScreen(}}- LaunchedEffect(showControls, showTrackSelection, showSpeedSelection, showProgramHistory, showSplitDialog) {+ LaunchedEffect(showControls, showTrackSelection, showSpeedSelection, showProgramHistory, showSplitDialog, showEpisodePicker) {if (!showControls) {viewModel.cancelControlsAutoHide()- } else if (showTrackSelection != null || showSpeedSelection || showProgramHistory || showSplitDialog) {+ } else if (showTrackSelection != null || showSpeedSelection || showProgramHistory || showSplitDialog || showEpisodePicker) {viewModel.cancelControlsAutoHide()} else {viewModel.hideControlsAfterDelay()@@ -387,6 +399,7 @@ fun PlayerScreen(playerNotice,showProgramHistory,showSplitDialog,+ showEpisodePicker,showSpeedSelection,showTrackSelection,showDiagnostics,@@ -403,6 +416,7 @@ fun PlayerScreen(playerNotice != null -> viewModel.dismissPlayerNotice()showProgramHistory -> showProgramHistory = falseshowSplitDialog -> showSplitDialog = false+ showEpisodePicker -> showEpisodePicker = falseshowSpeedSelection -> showSpeedSelection = falseshowTrackSelection != null -> showTrackSelection = nullshowDiagnostics -> viewModel.toggleDiagnostics()@@ -448,7 +462,7 @@ fun PlayerScreen(if (showChannelListOverlay || showCategoryListOverlay || showEpgOverlay) {return@onPreviewKeyEvent false}- if (showTrackSelection != null || showSpeedSelection || showProgramHistory || showSplitDialog) {+ if (showTrackSelection != null || showSpeedSelection || showProgramHistory || showSplitDialog || showEpisodePicker) {return@onPreviewKeyEvent false}@@ -571,6 +585,8 @@ fun PlayerScreen(if (contentType == "LIVE") {viewModel.playNext()+ } else if (canOpenEpisodePicker) {+ showEpisodePicker = true} else {viewModel.toggleControls()}@@ -759,7 +775,7 @@ fun PlayerScreen(PlayerControlsOverlayHost(playerEngine = viewModel.playerEngine,visible = showControls,- title = title,+ title = playbackTitle.ifBlank { title },contentType = contentType,isPlaying = isPlaying,currentProgram = currentProgram,@@ -792,6 +808,8 @@ fun PlayerScreen(onOpenAudioTracks = { showTrackSelection = TrackType.AUDIO },onOpenVideoTracks = { showTrackSelection = TrackType.VIDEO },onOpenPlaybackSpeed = { showSpeedSelection = true },+ showEpisodesAction = canOpenEpisodePicker,+ onOpenEpisodes = { showEpisodePicker = true },onOpenSplitScreen = { showSplitDialog = true },onEnterPictureInPicture = enterPictureInPicture,onToggleMute = viewModel::toggleMute,@@ -856,6 +874,18 @@ fun PlayerScreen(onDismiss = { showSpeedSelection = false },onSelectSpeed = viewModel::setPlaybackSpeed)+ PlayerEpisodeSelectionDialog(+ visible = showEpisodePicker,+ seriesTitle = currentSeries?.name ?: playbackTitle.ifBlank { title },+ seasons = currentSeries?.seasons.orEmpty(),+ currentEpisodeId = currentEpisode?.id ?: internalChannelId,+ currentSeasonNumber = currentEpisode?.seasonNumber ?: seasonNumber,+ onDismiss = { showEpisodePicker = false },+ onSelectEpisode = { episode ->+ showEpisodePicker = false+ viewModel.playEpisode(episode)+ }+ )}// --- Overlays ---@@ -1059,6 +1089,8 @@ private fun PlayerControlsOverlayHost(onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,onOpenPlaybackSpeed: () -> Unit,+ showEpisodesAction: Boolean,+ onOpenEpisodes: () -> Unit,onOpenSplitScreen: () -> Unit,onEnterPictureInPicture: () -> Unit,onToggleMute: () -> Unit,@@ -1111,6 +1143,8 @@ private fun PlayerControlsOverlayHost(onOpenAudioTracks = onOpenAudioTracks,onOpenVideoTracks = onOpenVideoTracks,onOpenPlaybackSpeed = onOpenPlaybackSpeed,+ showEpisodesAction = showEpisodesAction,+ onOpenEpisodes = onOpenEpisodes,onOpenSplitScreen = onOpenSplitScreen,onEnterPictureInPicture = onEnterPictureInPicture,onToggleMute = onToggleMute,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex da262382..baafac33 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -20,11 +20,14 @@ import com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.Programimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.DecoderMode+import com.streamvault.domain.model.Episodeimport com.streamvault.domain.model.PlaybackHistoryimport com.streamvault.domain.model.RecordingItemimport com.streamvault.domain.model.RecordingRecurrenceimport com.streamvault.domain.model.RecordingRequestimport com.streamvault.domain.model.RecordingStatus+import com.streamvault.domain.model.Result+import com.streamvault.domain.model.Seriesimport com.streamvault.domain.model.VirtualCategoryIdsimport com.streamvault.domain.model.VideoFormatimport com.streamvault.domain.usecase.GetCustomCategories@@ -35,6 +38,7 @@ import com.streamvault.domain.repository.ChannelRepositoryimport com.streamvault.domain.repository.EpgRepositoryimport com.streamvault.domain.repository.MovieRepositoryimport com.streamvault.domain.repository.PlaybackHistoryRepository+import com.streamvault.domain.repository.SeriesRepositoryimport com.streamvault.player.PlaybackStateimport com.streamvault.player.PlayerEngineimport com.streamvault.player.PlayerError@@ -121,6 +125,7 @@ class PlayerViewModel @Inject constructor(private val epgRepository: EpgRepository,private val channelRepository: ChannelRepository,private val movieRepository: MovieRepository,+ private val seriesRepository: SeriesRepository,private val favoriteRepository: com.streamvault.domain.repository.FavoriteRepository,private val playbackHistoryRepository: PlaybackHistoryRepository,private val providerRepository: com.streamvault.domain.repository.ProviderRepository,@@ -161,6 +166,18 @@ class PlayerViewModel @Inject constructor(private val _currentChannel = MutableStateFlow<com.streamvault.domain.model.Channel?>(null)val currentChannel: StateFlow<com.streamvault.domain.model.Channel?> = _currentChannel.asStateFlow()++ private val _currentSeries = MutableStateFlow<Series?>(null)+ val currentSeries: StateFlow<Series?> = _currentSeries.asStateFlow()++ private val _currentEpisode = MutableStateFlow<Episode?>(null)+ val currentEpisode: StateFlow<Episode?> = _currentEpisode.asStateFlow()++ private val _nextEpisode = MutableStateFlow<Episode?>(null)+ val nextEpisode: StateFlow<Episode?> = _nextEpisode.asStateFlow()++ private val _playbackTitle = MutableStateFlow("")+ val playbackTitle: StateFlow<String> = _playbackTitle.asStateFlow()private val _resumePrompt = MutableStateFlow(ResumePromptState())val resumePrompt: StateFlow<ResumePromptState> = _resumePrompt.asStateFlow()@@ -262,6 +279,10 @@ class PlayerViewModel @Inject constructor(viewModelScope.launch {playerEngine.playbackState.collect { state ->_playerDiagnostics.update { it.copy(playbackStateLabel = state.name.replace('_', ' ')) }+ if (state == PlaybackState.ENDED && lastObservedPlaybackState != PlaybackState.ENDED) {+ handlePlaybackEnded()+ }+ lastObservedPlaybackState = stateif (state == PlaybackState.READY) {zapBufferWatchdogJob?.cancel()dismissRecoveredNoticeIfPresent()@@ -522,7 +543,11 @@ class PlayerViewModel @Inject constructor(private var currentContentId: Long = -1Lprivate var currentContentType: ContentType = ContentType.LIVEprivate var currentTitle: String = ""+ private var currentSeriesId: Long? = null+ private var currentSeasonNumber: Int? = null+ private var currentEpisodeNumber: Int? = nullprivate var isVirtualCategory: Boolean = false+ private var lastObservedPlaybackState: PlaybackState = PlaybackState.IDLEprivate var epgJob: Job? = nullprivate var playlistJob: Job? = null@@ -640,6 +665,131 @@ class PlayerViewModel @Inject constructor(return ++prepareRequestVersion}+ private fun clearSeriesEpisodeContext() {+ currentSeriesId = null+ currentSeasonNumber = null+ currentEpisodeNumber = null+ _currentSeries.value = null+ _currentEpisode.value = null+ _nextEpisode.value = null+ }++ private fun resolveEpisode(+ series: Series,+ episodeId: Long,+ seasonNumber: Int?,+ episodeNumber: Int?+ ): Episode? {+ val episodes = series.seasons+ .sortedBy { it.seasonNumber }+ .flatMap { season -> season.episodes.sortedBy { it.episodeNumber } }+ return episodes.firstOrNull { it.id == episodeId }+ ?: episodes.firstOrNull { it.seasonNumber == seasonNumber && it.episodeNumber == episodeNumber }+ }++ private fun findNextEpisode(series: Series, episode: Episode): Episode? {+ val orderedEpisodes = series.seasons+ .sortedBy { it.seasonNumber }+ .flatMap { season -> season.episodes.sortedBy { it.episodeNumber } }+ val currentIndex = orderedEpisodes.indexOfFirst { it.id == episode.id }+ return orderedEpisodes.getOrNull(currentIndex + 1)+ }++ private fun buildEpisodePlaybackTitle(episode: Episode): String =+ "${episode.title} - S${episode.seasonNumber}E${episode.episodeNumber}"++ private fun loadSeriesEpisodeContext(+ requestVersion: Long,+ providerId: Long,+ seriesId: Long,+ episodeId: Long,+ seasonNumber: Int?,+ episodeNumber: Int?+ ) {+ viewModelScope.launch {+ when (val result = seriesRepository.getSeriesDetails(providerId, seriesId)) {+ is Result.Success -> {+ if (!isActivePlaybackSession(requestVersion)) return@launch+ val series = result.data+ val resolvedEpisode = resolveEpisode(series, episodeId, seasonNumber, episodeNumber)+ _currentSeries.value = series+ _currentEpisode.value = resolvedEpisode+ _nextEpisode.value = resolvedEpisode?.let { findNextEpisode(series, it) }+ currentSeriesId = seriesId+ currentSeasonNumber = resolvedEpisode?.seasonNumber ?: seasonNumber+ currentEpisodeNumber = resolvedEpisode?.episodeNumber ?: episodeNumber+ if (resolvedEpisode != null && currentContentType == ContentType.SERIES_EPISODE) {+ currentArtworkUrl = resolvedEpisode.coverUrl+ ?: currentArtworkUrl+ ?: series.posterUrl+ ?: series.backdropUrl+ currentTitle = buildEpisodePlaybackTitle(resolvedEpisode)+ _playbackTitle.value = currentTitle+ }+ }++ else -> {+ if (!isActivePlaybackSession(requestVersion)) return@launch+ _currentSeries.value = null+ _currentEpisode.value = null+ _nextEpisode.value = null+ currentSeriesId = seriesId+ currentSeasonNumber = seasonNumber+ currentEpisodeNumber = episodeNumber+ }+ }+ }+ }++ private fun buildPlaybackHistorySnapshot(+ positionMs: Long,+ durationMs: Long+ ): PlaybackHistory? {+ if (positionMs < 0 || durationMs <= 0 || currentContentId == -1L || currentProviderId == -1L) {+ return null+ }+ return PlaybackHistory(+ contentId = currentContentId,+ contentType = currentContentType,+ providerId = currentProviderId,+ title = currentTitle,+ posterUrl = currentArtworkUrl,+ streamUrl = currentStreamUrl,+ resumePositionMs = positionMs,+ totalDurationMs = durationMs,+ lastWatchedAt = System.currentTimeMillis(),+ seriesId = currentSeriesId,+ seasonNumber = _currentEpisode.value?.seasonNumber ?: currentSeasonNumber,+ episodeNumber = _currentEpisode.value?.episodeNumber ?: currentEpisodeNumber+ )+ }++ private suspend fun persistPlaybackCompletion() {+ val durationMs = playerEngine.duration.value+ val completedHistory = buildPlaybackHistorySnapshot(+ positionMs = durationMs.coerceAtLeast(playerEngine.currentPosition.value),+ durationMs = durationMs+ ) ?: return+ logRepositoryFailure(+ operation = "Mark playback watched",+ result = markAsWatched(completedHistory)+ )+ watchNextManager.refreshWatchNext()+ launcherRecommendationsManager.refreshRecommendations()+ }++ private fun handlePlaybackEnded() {+ if (currentContentType == ContentType.LIVE) return+ viewModelScope.launch {+ persistPlaybackCompletion()+ if (currentContentType == ContentType.SERIES_EPISODE) {+ _nextEpisode.value?.let { episode ->+ playEpisode(episode, showResumePrompt = false)+ }+ }+ }+ }+private fun currentPlaybackIdentityUrl(): String =currentResolvedPlaybackUrl.ifBlank { currentStreamUrl }@@ -716,7 +866,11 @@ class PlayerViewModel @Inject constructor(artworkUrl: String? = null,archiveStartMs: Long? = null,archiveEndMs: Long? = null,- archiveTitle: String? = null+ archiveTitle: String? = null,+ seriesId: Long? = null,+ seasonNumber: Int? = null,+ episodeNumber: Int? = null,+ showResumePrompt: Boolean = true) {val hasArchiveRequest = archiveStartMs != null &&archiveEndMs != null &&@@ -733,13 +887,29 @@ class PlayerViewModel @Inject constructor(currentStreamUrl = streamUrlcurrentContentId = internalChannelIdcurrentTitle = title+ _playbackTitle.value = titlecurrentArtworkUrl = artworkUrlcurrentContentType = try { ContentType.valueOf(contentType) } catch (e: Exception) { ContentType.LIVE }currentProviderId = providerId+ currentSeriesId = seriesId?.takeIf { it > 0L }+ currentSeasonNumber = seasonNumber+ currentEpisodeNumber = episodeNumbercurrentStreamClassLabel = if (hasArchiveRequest) "Catch-up" else "Primary"if (!hasArchiveRequest) {pendingCatchUpUrls = emptyList()}+ if (currentContentType == ContentType.SERIES_EPISODE && providerId > 0 && currentSeriesId != null) {+ loadSeriesEpisodeContext(+ requestVersion = requestVersion,+ providerId = providerId,+ seriesId = currentSeriesId ?: -1L,+ episodeId = internalChannelId,+ seasonNumber = seasonNumber,+ episodeNumber = episodeNumber+ )+ } else {+ clearSeriesEpisodeContext()+ }if (currentContentType != ContentType.LIVE) {lastRecordedLivePlaybackKey = nullrecentChannelsJob?.cancel()@@ -798,7 +968,7 @@ class PlayerViewModel @Inject constructor(}// 1. Check for Resume Position for VODs- if (currentContentType != ContentType.LIVE && currentContentId != -1L && currentProviderId != -1L) {+ if (showResumePrompt && currentContentType != ContentType.LIVE && currentContentId != -1L && currentProviderId != -1L) {viewModelScope.launch {val history = playbackHistoryRepository.getPlaybackHistory(currentContentId, currentContentType, currentProviderId)if (!isActivePlaybackSession(requestVersion, streamUrl)) return@launch@@ -898,6 +1068,7 @@ class PlayerViewModel @Inject constructor(refreshCurrentChannelRecording()if (channel != null) {currentTitle = channel.name.ifBlank { currentTitle }+ _playbackTitle.value = currentTitlecurrentStreamUrl = if (currentStreamClassLabel == "Catch-up") currentStreamUrl else channel.streamUrlupdateStreamClass(when {@@ -937,18 +1108,8 @@ class PlayerViewModel @Inject constructor(val pos = playerEngine.currentPosition.valueval dur = playerEngine.duration.value- if (pos > 0 && dur > 0 && currentContentId != -1L && currentProviderId != -1L) {- val history = PlaybackHistory(- contentId = currentContentId,- contentType = currentContentType,- providerId = currentProviderId,- title = currentTitle,- posterUrl = currentArtworkUrl,- streamUrl = currentStreamUrl,- resumePositionMs = pos,- totalDurationMs = dur,- lastWatchedAt = System.currentTimeMillis()- )+ if (pos > 0 && dur > 0) {+ val history = buildPlaybackHistorySnapshot(pos, dur) ?: returnlogRepositoryFailure(operation = "Persist playback resume position",result = playbackHistoryRepository.updateResumePosition(history)@@ -1427,6 +1588,7 @@ class PlayerViewModel @Inject constructor(currentChannelIndex = indexcurrentContentId = channel.idcurrentTitle = channel.name+ _playbackTitle.value = currentTitlecurrentStreamUrl = channel.streamUrlpendingCatchUpUrls = emptyList()updateStreamClass("Primary")@@ -1783,6 +1945,25 @@ class PlayerViewModel @Inject constructor(fun pause() = playerEngine.pause()fun seekForward() = playerEngine.seekForward()fun seekBackward() = playerEngine.seekBackward()++ fun playEpisode(episode: Episode, showResumePrompt: Boolean = true) {+ prepare(+ streamUrl = episode.streamUrl,+ epgChannelId = null,+ internalChannelId = episode.id,+ categoryId = -1,+ providerId = episode.providerId,+ isVirtual = false,+ contentType = ContentType.SERIES_EPISODE.name,+ title = buildEpisodePlaybackTitle(episode),+ artworkUrl = episode.coverUrl ?: _currentSeries.value?.posterUrl ?: _currentSeries.value?.backdropUrl,+ seriesId = currentSeriesId ?: episode.seriesId.takeIf { it > 0L },+ seasonNumber = episode.seasonNumber,+ episodeNumber = episode.episodeNumber,+ showResumePrompt = showResumePrompt+ )+ }+fun toggleMute() {val now = SystemClock.elapsedRealtime()if (now - lastMuteToggleAtMs < MUTE_TOGGLE_DEBOUNCE_MS) returndiff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.ktindex 1429dac4..ae70ab47 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt@@ -126,6 +126,8 @@ fun PlayerControlsOverlay(onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,onOpenPlaybackSpeed: () -> Unit = {},+ showEpisodesAction: Boolean = false,+ onOpenEpisodes: () -> Unit = {},onOpenSplitScreen: () -> Unit,onEnterPictureInPicture: () -> Unit = {},onToggleMute: () -> Unit,@@ -203,6 +205,8 @@ fun PlayerControlsOverlay(onOpenAudioTracks = onOpenAudioTracks,onOpenVideoTracks = onOpenVideoTracks,onOpenPlaybackSpeed = onOpenPlaybackSpeed,+ showEpisodesAction = showEpisodesAction,+ onOpenEpisodes = onOpenEpisodes,onOpenSplitScreen = onOpenSplitScreen,onEnterPictureInPicture = onEnterPictureInPicture,onToggleMute = onToggleMute,@@ -518,6 +522,8 @@ private fun PlayerBottomBar(onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,onOpenPlaybackSpeed: () -> Unit,+ showEpisodesAction: Boolean,+ onOpenEpisodes: () -> Unit,onOpenSplitScreen: () -> Unit,onEnterPictureInPicture: () -> Unit,onToggleMute: () -> Unit,@@ -533,6 +539,7 @@ private fun PlayerBottomBar(onSeekPreviewPositionChanged: (Long?) -> Unit,modifier: Modifier = Modifier) {+ val isVod = contentType != "LIVE"Box(modifier = modifier.fillMaxWidth()@@ -541,11 +548,20 @@ private fun PlayerBottomBar(colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.84f))))- .padding(horizontal = 32.dp, vertical = 24.dp)+ .padding(+ horizontal = if (isVod) 18.dp else 32.dp,+ vertical = if (isVod) 14.dp else 24.dp+ )) {Surface(- modifier = Modifier.fillMaxWidth(),- shape = RoundedCornerShape(28.dp),+ modifier = if (isVod) {+ Modifier+ .fillMaxWidth(0.88f)+ .align(Alignment.Center)+ } else {+ Modifier.fillMaxWidth()+ },+ shape = RoundedCornerShape(if (isVod) 22.dp else 28.dp),colors = SurfaceDefaults.colors(containerColor = Color(0xFF0C1624).copy(alpha = 0.92f))) {Column(@@ -559,7 +575,10 @@ private fun PlayerBottomBar()))- .padding(horizontal = 24.dp, vertical = 22.dp)+ .padding(+ horizontal = if (isVod) 18.dp else 24.dp,+ vertical = if (isVod) 14.dp else 22.dp+ )) {if (contentType == "LIVE") {PlayerLiveInfo(@@ -615,6 +634,8 @@ private fun PlayerBottomBar(onOpenAudioTracks = onOpenAudioTracks,onOpenVideoTracks = onOpenVideoTracks,onOpenPlaybackSpeed = onOpenPlaybackSpeed,+ showEpisodesAction = showEpisodesAction,+ onOpenEpisodes = onOpenEpisodes,onEnterPictureInPicture = onEnterPictureInPicture,onToggleMute = onToggleMute,isCastConnected = isCastConnected,@@ -807,6 +828,8 @@ private fun PlayerVodInfo(onOpenAudioTracks: () -> Unit,onOpenVideoTracks: () -> Unit,onOpenPlaybackSpeed: () -> Unit,+ showEpisodesAction: Boolean,+ onOpenEpisodes: () -> Unit,onEnterPictureInPicture: () -> Unit,onToggleMute: () -> Unit,isCastConnected: Boolean,@@ -823,34 +846,34 @@ private fun PlayerVodInfo(val compactControls = screenWidth < 700.dpval tabletControls = !isTelevisionDevice && screenWidth >= 700.dp && screenWidth < 1280.dpval transportButtonSize = when {- compactControls -> 48.dp- tabletControls -> 52.dp- else -> 56.dp+ compactControls -> 42.dp+ tabletControls -> 46.dp+ else -> 50.dp}val playButtonSize = when {- compactControls -> 60.dp- tabletControls -> 66.dp- else -> 72.dp+ compactControls -> 54.dp+ tabletControls -> 58.dp+ else -> 62.dp}val playIconSize = when {- compactControls -> 28.dp- tabletControls -> 30.dp- else -> 34.dp+ compactControls -> 24.dp+ tabletControls -> 26.dp+ else -> 30.dp}val seekPreviewWidth = when {- compactControls -> 180.dp- tabletControls -> 200.dp- else -> 220.dp+ compactControls -> 148.dp+ tabletControls -> 168.dp+ else -> 188.dp}val outerSpacing = when {- compactControls -> 12.dp- tabletControls -> 14.dp- else -> 18.dp+ compactControls -> 10.dp+ tabletControls -> 12.dp+ else -> 14.dp}val transportGroupHorizontalPadding = when {- compactControls -> 8.dp- tabletControls -> 9.dp- else -> 10.dp+ compactControls -> 6.dp+ tabletControls -> 7.dp+ else -> 8.dp}val playbackLabel = stringResource(R.string.player_playback_label)@@ -862,12 +885,15 @@ private fun PlayerVodInfo(if (subtitleTrackCount > 0) {add(PlayerActionSpec(stringResource(R.string.player_subs), onOpenSubtitleTracks))}- if (audioTrackCount > 0) {- add(PlayerActionSpec(stringResource(R.string.player_audio), onOpenAudioTracks))- }if (videoQualityCount > 0) {add(PlayerActionSpec(stringResource(R.string.player_video_quality), onOpenVideoTracks))}+ if (showEpisodesAction) {+ add(PlayerActionSpec(stringResource(R.string.player_episodes), onOpenEpisodes))+ }+ if (audioTrackCount > 0) {+ add(PlayerActionSpec(stringResource(R.string.player_audio), onOpenAudioTracks))+ }add(PlayerActionSpec(stringResource(R.string.player_playback_speed_value, formatPlaybackSpeedLabel(playbackSpeed)),@@ -927,13 +953,13 @@ private fun PlayerVodInfo(Spacer(modifier = Modifier.height(14.dp))Surface(- shape = RoundedCornerShape(24.dp),+ shape = RoundedCornerShape(20.dp),colors = SurfaceDefaults.colors(containerColor = Color.White.copy(alpha = 0.06f))) {Row(modifier = Modifier.fillMaxWidth()- .padding(horizontal = 18.dp, vertical = 16.dp),+ .padding(horizontal = 14.dp, vertical = 12.dp),horizontalArrangement = Arrangement.spacedBy(outerSpacing),verticalAlignment = Alignment.CenterVertically) {diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.ktindex 2a67345f..24d3307e 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.kt@@ -7,38 +7,54 @@ import androidx.compose.foundation.focusGroupimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxHeightimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.items+import androidx.compose.foundation.lazy.itemsIndexedimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember+import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clipimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusPropertiesimport androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.input.key.onPreviewKeyEvent+import androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport androidx.compose.ui.window.Dialogimport androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Borderimport androidx.tv.material3.ClickableSurfaceDefaultsimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaultsimport androidx.tv.material3.Text+import coil3.compose.AsyncImageimport com.streamvault.app.R+import com.streamvault.app.ui.design.AppColorsimport com.streamvault.app.ui.design.requestFocusSafelyimport com.streamvault.app.ui.screens.player.PlayerNoticeActionimport com.streamvault.app.ui.screens.player.PlayerNoticeState@@ -53,6 +69,8 @@ import com.streamvault.app.ui.theme.SurfaceElevatedimport com.streamvault.app.ui.theme.SurfaceHighlightimport com.streamvault.app.ui.theme.PrimaryLightimport com.streamvault.app.ui.theme.TextSecondary+import com.streamvault.domain.model.Episode+import com.streamvault.domain.model.Seasonimport com.streamvault.player.PlayerErrorimport com.streamvault.player.PlayerTrackimport com.streamvault.player.TrackType@@ -388,6 +406,401 @@ fun PlayerSpeedSelectionDialog(}}+@Composable+fun PlayerEpisodeSelectionDialog(+ visible: Boolean,+ seriesTitle: String,+ seasons: List<Season>,+ currentEpisodeId: Long,+ currentSeasonNumber: Int?,+ onDismiss: () -> Unit,+ onSelectEpisode: (Episode) -> Unit+) {+ if (!visible) return++ val availableSeasons = remember(seasons) { seasons.filter { it.episodes.isNotEmpty() } }+ if (availableSeasons.isEmpty()) return++ val totalEpisodeCount = remember(availableSeasons) { availableSeasons.sumOf { it.episodes.size } }++ var selectedSeasonNumber by remember(visible, currentSeasonNumber, availableSeasons) {+ mutableStateOf(currentSeasonNumber ?: availableSeasons.first().seasonNumber)+ }+ val selectedSeason = availableSeasons.firstOrNull { it.seasonNumber == selectedSeasonNumber }+ ?: availableSeasons.first()+ val selectedEpisode = remember(selectedSeason, currentEpisodeId) {+ selectedSeason.episodes.firstOrNull { it.id == currentEpisodeId }+ }+ val selectedSeasonFocusRequester = remember(visible, selectedSeason.seasonNumber) { FocusRequester() }+ val episodeEntryFocusRequester = remember(visible, selectedSeason.seasonNumber, currentEpisodeId) { FocusRequester() }++ LaunchedEffect(availableSeasons, selectedSeasonNumber) {+ if (availableSeasons.none { it.seasonNumber == selectedSeasonNumber }) {+ selectedSeasonNumber = availableSeasons.first().seasonNumber+ }+ }++ LaunchedEffect(visible, selectedSeason.seasonNumber) {+ episodeEntryFocusRequester.requestFocusSafely(+ tag = "PlayerEpisodeSelectionDialog",+ target = "Selected episode option"+ )+ }++ Dialog(+ onDismissRequest = onDismiss,+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.68f))+ .clickable(onClick = onDismiss),+ contentAlignment = Alignment.Center+ ) {+ Surface(+ modifier = Modifier+ .widthIn(min = 680.dp, max = 940.dp)+ .fillMaxWidth(0.88f)+ .heightIn(max = 640.dp)+ .onPreviewKeyEvent { event ->+ if (event.nativeKeyEvent.action != KeyEvent.ACTION_DOWN) return@onPreviewKeyEvent false+ when (event.nativeKeyEvent.keyCode) {+ KeyEvent.KEYCODE_DPAD_UP,+ KeyEvent.KEYCODE_DPAD_DOWN,+ KeyEvent.KEYCODE_DPAD_LEFT,+ KeyEvent.KEYCODE_DPAD_RIGHT,+ KeyEvent.KEYCODE_DPAD_CENTER,+ KeyEvent.KEYCODE_ENTER,+ KeyEvent.KEYCODE_NUMPAD_ENTER,+ KeyEvent.KEYCODE_BACK -> false+ else -> true+ }+ },+ shape = RoundedCornerShape(20.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.CanvasElevated.copy(alpha = 0.98f)),+ border = Border(+ border = androidx.compose.foundation.BorderStroke(1.dp, AppColors.Outline)+ )+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.BrandMuted.copy(alpha = 0.10f),+ AppColors.CanvasElevated,+ AppColors.Canvas+ )+ )+ )+ .padding(18.dp),+ verticalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ Text(+ text = stringResource(R.string.player_episodes),+ style = MaterialTheme.typography.headlineSmall,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ Text(+ text = seriesTitle,+ style = MaterialTheme.typography.bodyLarge,+ color = TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )++ Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {+ PlayerEpisodeStatPill(text = "${availableSeasons.size} seasons")+ PlayerEpisodeStatPill(text = "$totalEpisodeCount episodes")+ PlayerEpisodeStatPill(+ text = selectedEpisode?.let { "Now on S${it.seasonNumber}E${it.episodeNumber}" }+ ?: selectedSeason.name,+ accent = true+ )+ }+ }++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ Surface(+ modifier = Modifier+ .width(190.dp)+ .fillMaxHeight(),+ shape = RoundedCornerShape(16.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.Surface.copy(alpha = 0.78f))+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(14.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Text(+ text = stringResource(R.string.series_seasons),+ style = MaterialTheme.typography.titleMedium,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ Text(+ text = "Choose a season, then move right for episodes.",+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextTertiary+ )+ LazyColumn(+ modifier = Modifier.fillMaxWidth(),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ items(availableSeasons, key = { it.seasonNumber }) { season ->+ val isSelectedSeason = season.seasonNumber == selectedSeason.seasonNumber+ TvClickableSurface(+ onClick = { selectedSeasonNumber = season.seasonNumber },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (isSelectedSeason) AppColors.BrandMuted.copy(alpha = 0.72f) else AppColors.SurfaceElevated.copy(alpha = 0.62f),+ focusedContainerColor = AppColors.Surface.copy(alpha = 0.76f),+ contentColor = Color.White,+ focusedContentColor = Color.White+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ border = androidx.compose.foundation.BorderStroke(+ 1.dp,+ if (isSelectedSeason) AppColors.Brand else AppColors.Outline+ )+ ),+ focusedBorder = Border(+ border = androidx.compose.foundation.BorderStroke(2.dp, AppColors.Focus)+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier+ .then(+ if (isSelectedSeason) Modifier.focusRequester(selectedSeasonFocusRequester) else Modifier+ )+ .focusProperties { right = episodeEntryFocusRequester }+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),+ verticalArrangement = Arrangement.spacedBy(2.dp)+ ) {+ Text(+ text = season.name,+ style = MaterialTheme.typography.labelMedium,+ fontWeight = FontWeight.Bold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ Text(+ text = "${season.episodes.size} episodes",+ style = MaterialTheme.typography.bodySmall,+ color = if (isSelectedSeason) AppColors.TextPrimary else AppColors.TextSecondary+ )+ }+ }+ }+ }+ }+ }++ Surface(+ modifier = Modifier.weight(1f),+ shape = RoundedCornerShape(16.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.Surface.copy(alpha = 0.70f))+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(14.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {+ Text(+ text = selectedSeason.name,+ style = MaterialTheme.typography.titleMedium,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ Text(+ text = "${selectedSeason.episodes.size} episodes ready to play",+ style = MaterialTheme.typography.bodySmall,+ color = TextSecondary+ )+ }+ selectedEpisode?.let { episode ->+ PlayerEpisodeStatPill(+ text = buildEpisodeCodeLabel(episode),+ accent = true+ )+ }+ }++ LazyColumn(+ modifier = Modifier+ .fillMaxWidth()+ .heightIn(max = 440.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ itemsIndexed(selectedSeason.episodes, key = { _, episode -> episode.id }) { index, episode ->+ val isSelectedEpisode = episode.id == currentEpisodeId+ TvClickableSurface(+ onClick = { onSelectEpisode(episode) },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (isSelectedEpisode) AppColors.BrandMuted.copy(alpha = 0.62f) else AppColors.SurfaceElevated.copy(alpha = 0.44f),+ focusedContainerColor = AppColors.Surface.copy(alpha = 0.74f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ border = androidx.compose.foundation.BorderStroke(+ 1.dp,+ if (isSelectedEpisode) AppColors.Brand else AppColors.Outline+ )+ ),+ focusedBorder = Border(+ border = androidx.compose.foundation.BorderStroke(2.dp, AppColors.Focus)+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier+ .fillMaxWidth()+ .then(+ if ((selectedEpisode == null && index == 0) || episode.id == selectedEpisode?.id) {+ Modifier.focusRequester(episodeEntryFocusRequester)+ } else {+ Modifier+ }+ )+ .focusProperties {+ if (index == 0) {+ left = selectedSeasonFocusRequester+ }+ }+ ) {+ Column(modifier = Modifier.fillMaxWidth()) {+ PlayerEpisodeListItem(+ episode = episode,+ selected = isSelectedEpisode,+ modifier = Modifier.fillMaxWidth()+ )+ if (isSelectedEpisode) {+ Text(+ text = stringResource(R.string.player_selected),+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.BrandStrong,+ modifier = Modifier.padding(start = 14.dp, end = 14.dp, bottom = 8.dp)+ )+ }+ }+ }+ }+ }+ }+ }+ }+ }+ }+ }+ }+}++@Composable+private fun PlayerEpisodeStatPill(+ text: String,+ accent: Boolean = false+) {+ Surface(+ shape = RoundedCornerShape(999.dp),+ colors = SurfaceDefaults.colors(+ containerColor = if (accent) AppColors.BrandMuted.copy(alpha = 0.78f) else AppColors.SurfaceElevated.copy(alpha = 0.70f)+ )+ ) {+ Text(+ text = text,+ style = MaterialTheme.typography.labelSmall,+ color = if (accent) AppColors.BrandStrong else AppColors.TextSecondary,+ modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp)+ )+ }+}++@Composable+private fun PlayerEpisodeListItem(+ episode: Episode,+ selected: Boolean,+ modifier: Modifier = Modifier+) {+ Row(+ modifier = modifier.padding(horizontal = 10.dp, vertical = 10.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Box(+ modifier = Modifier+ .width(120.dp)+ .height(68.dp)+ .background(AppColors.SurfaceEmphasis.copy(alpha = 0.72f), RoundedCornerShape(12.dp))+ .clip(RoundedCornerShape(12.dp)),+ contentAlignment = Alignment.Center+ ) {+ if (!episode.coverUrl.isNullOrBlank()) {+ AsyncImage(+ model = episode.coverUrl,+ contentDescription = episode.title,+ contentScale = ContentScale.Crop,+ modifier = Modifier.fillMaxSize()+ )+ } else {+ Text(+ text = buildEpisodeCodeLabel(episode),+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextSecondary+ )+ }+ }++ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(4.dp)+ ) {+ Text(+ text = episode.title,+ style = MaterialTheme.typography.titleSmall,+ color = Color.White,+ fontWeight = if (selected) FontWeight.Bold else FontWeight.SemiBold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ Text(+ text = buildEpisodeMetaLabel(episode),+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ episode.plot?.takeIf { it.isNotBlank() }?.let { plot ->+ Text(+ text = plot,+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextTertiary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+}+private fun formatPlaybackSpeedLabel(speed: Float): String {return if (speed % 1f == 0f) {"${speed.toInt()}x"@@ -433,6 +846,23 @@ private fun TrackSelectionItem(}}+private fun buildEpisodeCodeLabel(episode: Episode): String = buildString {+ append("S")+ append(episode.seasonNumber)+ append("E")+ append(episode.episodeNumber)+}++private fun buildEpisodeMetaLabel(episode: Episode): String = buildString {+ append(stringResourceFallbackEpisode(episode.episodeNumber))+ episode.duration?.takeIf { it.isNotBlank() }?.let {+ append(" • ")+ append(it)+ }+}++private fun stringResourceFallbackEpisode(episodeNumber: Int): String = "Episode $episodeNumber"+@Composablefun PlayerResumePrompt(title: String,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.ktindex 2f8e0c7d..f4c6e497 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.screens.providerimport androidx.compose.animation.animateColorAsState+import androidx.compose.animation.AnimatedVisibilityimport androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.animation.core.tweenimport androidx.compose.foundation.BorderStroke@@ -20,6 +21,7 @@ import androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.foundation.verticalScrollimport androidx.compose.material3.CircularProgressIndicatorimport androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.RadioButtonimport androidx.compose.material3.Switchimport androidx.compose.runtime.*import androidx.compose.runtime.saveable.rememberSaveable@@ -61,6 +63,7 @@ import com.streamvault.app.ui.components.dialogs.PremiumDialogimport com.streamvault.app.ui.components.shell.StatusPillimport com.streamvault.app.ui.theme.*import com.streamvault.data.util.ProviderInputSanitizer+import com.streamvault.domain.model.ProviderEpgSyncModeimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.delayimport kotlinx.coroutines.launch@@ -244,6 +247,7 @@ fun ProviderSetupScreen(onLoginXtream = { viewModel.loginXtream(serverUrl, username, password, name) },onAddM3u = { viewModel.addM3u(m3uUrl, name) },onToggleFastSync = { viewModel.updateXtreamFastSyncEnabled(!uiState.xtreamFastSyncEnabled) },+ onSelectEpgSyncMode = viewModel::updateEpgSyncMode,modifier = Modifier.weight(1f).fillMaxHeight())}@@ -271,6 +275,7 @@ fun ProviderSetupScreen(onLoginXtream = { viewModel.loginXtream(serverUrl, username, password, name) },onAddM3u = { viewModel.addM3u(m3uUrl, name) },onToggleFastSync = { viewModel.updateXtreamFastSyncEnabled(!uiState.xtreamFastSyncEnabled) },+ onSelectEpgSyncMode = viewModel::updateEpgSyncMode,modifier = Modifier.weight(1f).fillMaxWidth())}@@ -300,6 +305,7 @@ private fun ProviderFormContent(onLoginXtream: () -> Unit,onAddM3u: () -> Unit,onToggleFastSync: () -> Unit,+ onSelectEpgSyncMode: (ProviderEpgSyncMode) -> Unit,modifier: Modifier = Modifier) {val scrollState = rememberScrollState()@@ -361,34 +367,12 @@ private fun ProviderFormContent(imeAction = ImeAction.Done))- // Fast Sync toggle- Row(- modifier = Modifier- .fillMaxWidth()- .background(Surface, RoundedCornerShape(12.dp))- .border(1.dp, SurfaceHighlight, RoundedCornerShape(12.dp))- .clickable { onToggleFastSync() }- .padding(horizontal = 16.dp, vertical = 12.dp),- horizontalArrangement = Arrangement.spacedBy(12.dp),- verticalAlignment = Alignment.CenterVertically- ) {- Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text(- text = androidx.compose.ui.res.stringResource(R.string.setup_xtream_fast_sync_label),- style = MaterialTheme.typography.titleSmall,- color = TextPrimary- )- Text(- text = androidx.compose.ui.res.stringResource(R.string.setup_xtream_fast_sync_helper),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }- Switch(- checked = uiState.xtreamFastSyncEnabled,- onCheckedChange = { onToggleFastSync() }- )- }+ AdvancedProviderOptionsSection(+ sourceType = sourceType,+ uiState = uiState,+ onToggleFastSync = onToggleFastSync,+ onSelectEpgSyncMode = onSelectEpgSyncMode+ )FormErrors(uiState.validationError, uiState.error)ActionButton(text = when {@@ -407,6 +391,12 @@ private fun ProviderFormContent(placeholder = androidx.compose.ui.res.stringResource(R.string.setup_m3u_hint),keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri, imeAction = ImeAction.Done))+ AdvancedProviderOptionsSection(+ sourceType = sourceType,+ uiState = uiState,+ onToggleFastSync = onToggleFastSync,+ onSelectEpgSyncMode = onSelectEpgSyncMode+ )FormErrors(uiState.validationError, uiState.error)ActionButton(text = when {@@ -430,6 +420,12 @@ private fun ProviderFormContent(fileImportError?.let {Text(text = it, style = MaterialTheme.typography.bodyMedium, color = ErrorColor)}+ AdvancedProviderOptionsSection(+ sourceType = sourceType,+ uiState = uiState,+ onToggleFastSync = onToggleFastSync,+ onSelectEpgSyncMode = onSelectEpgSyncMode+ )FormErrors(uiState.validationError, uiState.error)ActionButton(text = when {@@ -446,6 +442,219 @@ private fun ProviderFormContent(}}+@Composable+private fun AdvancedProviderOptionsSection(+ sourceType: SourceType,+ uiState: ProviderSetupState,+ onToggleFastSync: () -> Unit,+ onSelectEpgSyncMode: (ProviderEpgSyncMode) -> Unit+) {+ var showAdvancedOptions by rememberSaveable(sourceType) { mutableStateOf(false) }++ LaunchedEffect(uiState.isEditing, uiState.epgSyncMode, uiState.xtreamFastSyncEnabled, sourceType) {+ val hasNonDefaultSelection = uiState.epgSyncMode != ProviderEpgSyncMode.UPFRONT ||+ (sourceType == SourceType.XTREAM && !uiState.xtreamFastSyncEnabled)+ if (uiState.isEditing && hasNonDefaultSelection) {+ showAdvancedOptions = true+ }+ }++ Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {+ Surface(+ onClick = { showAdvancedOptions = !showAdvancedOptions },+ modifier = Modifier+ .fillMaxWidth()+ .mouseClickable(onClick = { showAdvancedOptions = !showAdvancedOptions }),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (showAdvancedOptions) Primary.copy(alpha = 0.12f) else Surface,+ focusedContainerColor = Primary.copy(alpha = 0.24f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ BorderStroke(+ 1.dp,+ if (showAdvancedOptions) Primary.copy(alpha = 0.45f) else SurfaceHighlight+ )+ ),+ focusedBorder = Border(BorderStroke(3.dp, PrimaryLight))+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(4.dp)+ ) {+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_advanced_options_label),+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_advanced_options_helper),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ Text(+ text = if (showAdvancedOptions) {+ androidx.compose.ui.res.stringResource(R.string.setup_advanced_options_hide)+ } else {+ androidx.compose.ui.res.stringResource(R.string.setup_advanced_options_show)+ },+ style = MaterialTheme.typography.labelMedium,+ color = PrimaryLight+ )+ }+ }++ AnimatedVisibility(visible = showAdvancedOptions) {+ Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {+ if (sourceType == SourceType.XTREAM) {+ Surface(+ onClick = onToggleFastSync,+ modifier = Modifier+ .fillMaxWidth()+ .mouseClickable(onClick = onToggleFastSync),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (uiState.xtreamFastSyncEnabled) Primary.copy(alpha = 0.1f) else Surface,+ focusedContainerColor = Primary.copy(alpha = 0.22f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ BorderStroke(+ 1.dp,+ if (uiState.xtreamFastSyncEnabled) Primary.copy(alpha = 0.4f) else SurfaceHighlight+ )+ ),+ focusedBorder = Border(BorderStroke(3.dp, PrimaryLight))+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_xtream_fast_sync_label),+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_xtream_fast_sync_helper),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ Switch(+ checked = uiState.xtreamFastSyncEnabled,+ onCheckedChange = { onToggleFastSync() }+ )+ }+ }+ }++ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(Surface, RoundedCornerShape(12.dp))+ .border(1.dp, SurfaceHighlight, RoundedCornerShape(12.dp))+ .padding(horizontal = 16.dp, vertical = 12.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_epg_sync_mode_label),+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_epg_sync_mode_helper),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ ProviderEpgSyncMode.entries.forEach { mode ->+ EpgSyncModeOptionRow(+ mode = mode,+ selected = uiState.epgSyncMode == mode,+ onSelect = { onSelectEpgSyncMode(mode) }+ )+ }+ }+ }+ }+ }+}++@Composable+private fun EpgSyncModeOptionRow(+ mode: ProviderEpgSyncMode,+ selected: Boolean,+ onSelect: () -> Unit+) {+ val titleRes = when (mode) {+ ProviderEpgSyncMode.UPFRONT -> R.string.setup_epg_sync_mode_upfront_title+ ProviderEpgSyncMode.BACKGROUND -> R.string.setup_epg_sync_mode_background_title+ ProviderEpgSyncMode.SKIP -> R.string.setup_epg_sync_mode_skip_title+ }+ val descriptionRes = when (mode) {+ ProviderEpgSyncMode.UPFRONT -> R.string.setup_epg_sync_mode_upfront_description+ ProviderEpgSyncMode.BACKGROUND -> R.string.setup_epg_sync_mode_background_description+ ProviderEpgSyncMode.SKIP -> R.string.setup_epg_sync_mode_skip_description+ }+ Surface(+ onClick = onSelect,+ modifier = Modifier+ .fillMaxWidth()+ .mouseClickable(onClick = onSelect),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (selected) Primary.copy(alpha = 0.12f) else Color.Transparent,+ focusedContainerColor = if (selected) Primary.copy(alpha = 0.26f) else SurfaceHighlight.copy(alpha = 0.9f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ BorderStroke(+ 1.dp,+ if (selected) Primary.copy(alpha = 0.45f) else Color.Transparent+ )+ ),+ focusedBorder = Border(BorderStroke(3.dp, PrimaryLight))+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ RadioButton(+ selected = selected,+ onClick = onSelect+ )+ Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {+ Text(+ text = androidx.compose.ui.res.stringResource(titleRes),+ style = MaterialTheme.typography.bodyMedium,+ color = TextPrimary+ )+ Text(+ text = androidx.compose.ui.res.stringResource(descriptionRes),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ }+ }+}+@Composableprivate fun FormErrors(validationError: String?, error: String?) {validationError?.let {diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.ktindex 09b976c1..5f09395c 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt@@ -2,6 +2,7 @@ package com.streamvault.app.ui.screens.providerimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScope+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.repository.ProviderRepositoryimport com.streamvault.domain.usecase.M3uProviderSetupCommand@@ -59,6 +60,7 @@ class ProviderSetupViewModel @Inject constructor(username = provider.username,password = "",m3uUrl = provider.m3uUrl,+ epgSyncMode = provider.epgSyncMode,xtreamFastSyncEnabled = provider.xtreamFastSyncEnabled,selectedTab = if (provider.type == ProviderType.M3U) 1 else 0,m3uTab = if (provider.m3uUrl.startsWith("file://")) 1 else 0@@ -76,6 +78,10 @@ class ProviderSetupViewModel @Inject constructor(_uiState.update { it.copy(xtreamFastSyncEnabled = enabled) }}+ fun updateEpgSyncMode(mode: ProviderEpgSyncMode) {+ _uiState.update { it.copy(epgSyncMode = mode) }+ }+fun loginXtream(serverUrl: String, username: String, password: String, name: String) {_uiState.update { it.copy(validationError = null, error = null) }@@ -90,6 +96,7 @@ class ProviderSetupViewModel @Inject constructor(password = password,name = name,xtreamFastSyncEnabled = _uiState.value.xtreamFastSyncEnabled,+ epgSyncMode = _uiState.value.epgSyncMode,existingProviderId = existingId),onProgress = { msg -> _uiState.update { it.copy(syncProgress = msg) } }@@ -157,6 +164,7 @@ class ProviderSetupViewModel @Inject constructor(M3uProviderSetupCommand(url = url,name = name,+ epgSyncMode = _uiState.value.epgSyncMode,existingProviderId = existingId),onProgress = { msg -> _uiState.update { it.copy(syncProgress = msg) } }@@ -208,5 +216,6 @@ data class ProviderSetupState(val username: String = "",val password: String = "",val m3uUrl: String = "",+ val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,val xtreamFastSyncEnabled: Boolean = true)diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.ktindex ce246727..fe204eb5 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt@@ -143,7 +143,7 @@ class SettingsViewModel @Inject constructor(lastSpeedTestEstimated = false,isIncognitoMode = false,useXtreamTextClassification = true,- liveTvChannelMode = LiveTvChannelMode.COMPACT,+ liveTvChannelMode = LiveTvChannelMode.PRO,liveTvCategoryFilters = emptyList(),liveTvQuickFilterVisibilityMode = LiveTvQuickFilterVisibilityMode.ALWAYS_VISIBLE,liveChannelNumberingMode = ChannelNumberingMode.GROUP,@@ -1051,7 +1051,7 @@ data class SettingsUiState(val recordingStorageState: RecordingStorageState = RecordingStorageState(),val isIncognitoMode: Boolean = false,val useXtreamTextClassification: Boolean = true,- val liveTvChannelMode: LiveTvChannelMode = LiveTvChannelMode.COMFORTABLE,+ val liveTvChannelMode: LiveTvChannelMode = LiveTvChannelMode.PRO,val liveTvCategoryFilters: List<String> = emptyList(),val liveTvQuickFilterVisibilityMode: LiveTvQuickFilterVisibilityMode = LiveTvQuickFilterVisibilityMode.ALWAYS_VISIBLE,val liveChannelNumberingMode: ChannelNumberingMode = ChannelNumberingMode.GROUP,diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 26fb0a32..9a336c9d 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -656,8 +656,20 @@<string name="setup_connecting">Connecting...</string><string name="setup_save">Save Changes</string><string name="setup_login">Login</string>+ <string name="setup_advanced_options_label">Advanced Options</string>+ <string name="setup_advanced_options_helper">Control how guide data is fetched during provider setup and refresh.</string>+ <string name="setup_advanced_options_show">Show</string>+ <string name="setup_advanced_options_hide">Hide</string><string name="setup_xtream_fast_sync_label">Fast Sync</string><string name="setup_xtream_fast_sync_helper">Xtream only. Loads VOD categories first and fetches movie rows on demand. Recommended for very large providers.</string>+ <string name="setup_epg_sync_mode_label">EPG Sync</string>+ <string name="setup_epg_sync_mode_helper">Upfront keeps today’s behavior. Background finishes setup first, and Skip leaves guide refresh for later.</string>+ <string name="setup_epg_sync_mode_upfront_title">Full EPG now</string>+ <string name="setup_epg_sync_mode_upfront_description">Download provider and external guide data during setup before it finishes.</string>+ <string name="setup_epg_sync_mode_background_title">Load EPG in background</string>+ <string name="setup_epg_sync_mode_background_description">Finish setup first, then fetch guide data automatically in the background.</string>+ <string name="setup_epg_sync_mode_skip_title">Skip EPG for now</string>+ <string name="setup_epg_sync_mode_skip_description">Do not fetch guide data automatically. You can refresh EPG later from Settings.</string><string name="setup_m3u_hint">M3U URL</string><string name="setup_tab_url">URL</string><string name="setup_tab_file">File</string>@@ -725,6 +737,7 @@<string name="player_epg_short">EPG</string><string name="player_multiview_short">Multiview</string><string name="player_quality_short">Quality</string>+ <string name="player_episodes">Episodes</string><string name="player_resume_title">Resume Playback</string><string name="player_resume_desc">Do you want to resume %1$s from where you left off?</string><string name="player_resume_start_over">Start Over</string>diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/27.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/27.jsonnew file mode 100644index 00000000..03b94430--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/27.json@@ -0,0 +1,3001 @@+{+ "formatVersion": 1,+ "database": {+ "version": 27,+ "identityHash": "e20755f02807fe36c153bebda1644630",+ "entities": [+ {+ "tableName": "providers",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `server_url` TEXT NOT NULL, `username` TEXT NOT NULL, `password` TEXT NOT NULL, `m3u_url` TEXT NOT NULL, `epg_url` TEXT NOT NULL, `is_active` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `epg_sync_mode` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "serverUrl",+ "columnName": "server_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "username",+ "columnName": "username",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "password",+ "columnName": "password",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uUrl",+ "columnName": "m3u_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgUrl",+ "columnName": "epg_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isActive",+ "columnName": "is_active",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "maxConnections",+ "columnName": "max_connections",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "expirationDate",+ "columnName": "expiration_date",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "apiVersion",+ "columnName": "api_version",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "allowedOutputFormatsJson",+ "columnName": "allowed_output_formats_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSyncMode",+ "columnName": "epg_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "xtreamFastSyncEnabled",+ "columnName": "xtream_fast_sync_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncedAt",+ "columnName": "last_synced_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_providers_server_url_username",+ "unique": true,+ "columnNames": [+ "server_url",+ "username"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username` ON `${TABLE_NAME}` (`server_url`, `username`)"+ }+ ]+ },+ {+ "tableName": "channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "qualityOptionsJson",+ "columnName": "quality_options_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channels_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_channels_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_channels_logical_group_id",+ "unique": false,+ "columnNames": [+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id_logical_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_preferences",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`channel_id`) REFERENCES `channels`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "aspectRatio",+ "columnName": "aspect_ratio",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_preferences_channel_id",+ "unique": true,+ "columnNames": [+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_preferences_channel_id` ON `${TABLE_NAME}` (`channel_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "channels",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "channel_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channels_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`channels`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "channels",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_UPDATE BEFORE UPDATE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_DELETE BEFORE DELETE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_UPDATE AFTER UPDATE ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_INSERT AFTER INSERT ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "movies",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_movies_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movies_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_movies_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_movies_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movies_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`movies`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "movies",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_UPDATE BEFORE UPDATE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_DELETE BEFORE DELETE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_UPDATE AFTER UPDATE ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_INSERT AFTER INSERT ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "series",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `series_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_series_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_series_provider_id_series_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_series_provider_id_series_id` ON `${TABLE_NAME}` (`provider_id`, `series_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "series",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "episodes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "episodeId",+ "columnName": "episode_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "coverUrl",+ "columnName": "cover_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_episodes_series_id",+ "unique": false,+ "columnNames": [+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"+ },+ {+ "name": "index_episodes_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_episodes_provider_id_episode_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "episode_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "series",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "series_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "categories",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_categories_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_categories_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ },+ {+ "name": "index_categories_provider_id_category_id_type",+ "unique": true,+ "columnNames": [+ "provider_id",+ "category_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channel_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movie_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `series_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `series_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "series_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "category_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "category_id",+ "type"+ ]+ },+ "indices": [+ {+ "name": "index_category_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_category_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ },+ {+ "name": "index_category_import_stage_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "programs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "hasArchive",+ "columnName": "has_archive",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_programs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_programs_provider_id_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_start_time_end_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_programs_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_start_time` ON `${TABLE_NAME}` (`start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`, `end_time`)"+ }+ ]+ },+ {+ "tableName": "favorites",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `added_at` INTEGER NOT NULL, FOREIGN KEY(`group_id`) REFERENCES `virtual_groups`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "groupId",+ "columnName": "group_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_favorites_content_id_content_type_group_id",+ "unique": true,+ "columnNames": [+ "content_id",+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_content_id_content_type_group_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `group_id`)"+ },+ {+ "name": "index_favorites_content_type_group_id",+ "unique": false,+ "columnNames": [+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_content_type_group_id` ON `${TABLE_NAME}` (`content_type`, `group_id`)"+ },+ {+ "name": "index_favorites_group_id_position",+ "unique": false,+ "columnNames": [+ "group_id",+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_group_id_position` ON `${TABLE_NAME}` (`group_id`, `position`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "virtual_groups",+ "onDelete": "SET NULL",+ "onUpdate": "NO ACTION",+ "columns": [+ "group_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "virtual_groups",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconEmoji",+ "columnName": "icon_emoji",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_virtual_groups_position",+ "unique": false,+ "columnNames": [+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_position` ON `${TABLE_NAME}` (`position`)"+ },+ {+ "name": "index_virtual_groups_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_content_type` ON `${TABLE_NAME}` (`content_type`)"+ }+ ]+ },+ {+ "tableName": "playback_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `poster_url` TEXT, `stream_url` TEXT NOT NULL, `resume_position_ms` INTEGER NOT NULL, `total_duration_ms` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `watched_status` TEXT NOT NULL, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resumePositionMs",+ "columnName": "resume_position_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalDurationMs",+ "columnName": "total_duration_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchedStatus",+ "columnName": "watched_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_history_content_id_content_type_provider_id",+ "unique": true,+ "columnNames": [+ "content_id",+ "content_type",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_history_content_id_content_type_provider_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `provider_id`)"+ },+ {+ "name": "index_playback_history_last_watched_at",+ "unique": false,+ "columnNames": [+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_last_watched_at` ON `${TABLE_NAME}` (`last_watched_at`)"+ },+ {+ "name": "index_playback_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "sync_metadata",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_movie_attempt` INTEGER NOT NULL, `last_movie_success` INTEGER NOT NULL, `last_movie_partial` INTEGER NOT NULL, `live_count` INTEGER NOT NULL, `movie_count` INTEGER NOT NULL, `series_count` INTEGER NOT NULL, `epg_count` INTEGER NOT NULL, `last_sync_status` TEXT NOT NULL, `movie_sync_mode` TEXT NOT NULL, `movie_warnings_count` INTEGER NOT NULL, `movie_catalog_stale` INTEGER NOT NULL, `live_avoid_full_until` INTEGER NOT NULL, `movie_avoid_full_until` INTEGER NOT NULL, `series_avoid_full_until` INTEGER NOT NULL, `live_sequential_failures_remembered` INTEGER NOT NULL, `live_healthy_sync_streak` INTEGER NOT NULL, `movie_parallel_failures_remembered` INTEGER NOT NULL, `movie_healthy_sync_streak` INTEGER NOT NULL, `series_sequential_failures_remembered` INTEGER NOT NULL, `series_healthy_sync_streak` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSync",+ "columnName": "last_live_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSync",+ "columnName": "last_movie_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSync",+ "columnName": "last_series_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSync",+ "columnName": "last_epg_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieAttempt",+ "columnName": "last_movie_attempt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSuccess",+ "columnName": "last_movie_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMoviePartial",+ "columnName": "last_movie_partial",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveCount",+ "columnName": "live_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCount",+ "columnName": "movie_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesCount",+ "columnName": "series_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgCount",+ "columnName": "epg_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncStatus",+ "columnName": "last_sync_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieSyncMode",+ "columnName": "movie_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieWarningsCount",+ "columnName": "movie_warnings_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCatalogStale",+ "columnName": "movie_catalog_stale",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveAvoidFullUntil",+ "columnName": "live_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieAvoidFullUntil",+ "columnName": "movie_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesAvoidFullUntil",+ "columnName": "series_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveSequentialFailuresRemembered",+ "columnName": "live_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveHealthySyncStreak",+ "columnName": "live_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieParallelFailuresRemembered",+ "columnName": "movie_parallel_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieHealthySyncStreak",+ "columnName": "movie_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesSequentialFailuresRemembered",+ "columnName": "series_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesHealthySyncStreak",+ "columnName": "series_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "url",+ "columnName": "url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastRefreshAt",+ "columnName": "last_refresh_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_sources_url",+ "unique": true,+ "columnNames": [+ "url"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_sources_url` ON `${TABLE_NAME}` (`url`)"+ }+ ]+ },+ {+ "tableName": "provider_epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `epg_source_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_epg_sources_provider_id_epg_source_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_epg_sources_provider_id_epg_source_id` ON `${TABLE_NAME}` (`provider_id`, `epg_source_id`)"+ },+ {+ "name": "index_provider_epg_sources_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_epg_sources_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `display_name` TEXT NOT NULL, `normalized_name` TEXT NOT NULL, `icon_url` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "normalizedName",+ "columnName": "normalized_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconUrl",+ "columnName": "icon_url",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_channels_epg_source_id_xmltv_channel_id",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id_xmltv_channel_id` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`)"+ },+ {+ "name": "index_epg_channels_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_channels_normalized_name",+ "unique": false,+ "columnNames": [+ "normalized_name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_normalized_name` ON `${TABLE_NAME}` (`normalized_name`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_programmes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `title` TEXT NOT NULL, `subtitle` TEXT, `description` TEXT NOT NULL, `category` TEXT, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `episode_info` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "subtitle",+ "columnName": "subtitle",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeInfo",+ "columnName": "episode_info",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_programmes_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_start_time` ON `${TABLE_NAME}` (`start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_epg_mappings",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_channel_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `source_type` TEXT NOT NULL, `epg_source_id` INTEGER, `xmltv_channel_id` TEXT, `match_type` TEXT, `confidence` REAL NOT NULL, `is_manual_override` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerChannelId",+ "columnName": "provider_channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "matchType",+ "columnName": "match_type",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "confidence",+ "columnName": "confidence",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "isManualOverride",+ "columnName": "is_manual_override",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_epg_mappings_provider_id_provider_channel_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "provider_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id_provider_channel_id` ON `${TABLE_NAME}` (`provider_id`, `provider_channel_id`)"+ },+ {+ "name": "index_channel_epg_mappings_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ }+ ],+ "setupQueries": [+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e20755f02807fe36c153bebda1644630')"+ ]+ }+}\ No newline at end of filediff --git a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.ktindex 2b790cac..d30d6ede 100644--- a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt+++ b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt@@ -2,6 +2,7 @@ package com.streamvault.data.localimport androidx.room.TypeConverterimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderType@@ -18,6 +19,12 @@ class RoomEnumConverters {@TypeConverterfun toProviderStatus(value: String?): ProviderStatus? = value?.let(ProviderStatus::valueOf)+ @TypeConverter+ fun fromProviderEpgSyncMode(value: ProviderEpgSyncMode?): String? = value?.name++ @TypeConverter+ fun toProviderEpgSyncMode(value: String?): ProviderEpgSyncMode? = value?.let(ProviderEpgSyncMode::valueOf)+@TypeConverterfun fromContentType(value: ContentType?): String? = value?.namediff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.ktindex e8cabfe6..7944a102 100644--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt@@ -37,7 +37,7 @@ import com.streamvault.data.local.entity.*EpgProgrammeEntity::class,ChannelEpgMappingEntity::class],- version = 26,+ version = 27,exportSchema = true // ← was false; schema JSON now tracked in version control)@TypeConverters(RoomEnumConverters::class)@@ -1200,6 +1200,12 @@ abstract class StreamVaultDatabase : RoomDatabase() {}}+ val MIGRATION_26_27 = object : Migration(26, 27) {+ override fun migrate(database: SupportSQLiteDatabase) {+ database.execSQL("ALTER TABLE providers ADD COLUMN epg_sync_mode TEXT NOT NULL DEFAULT 'UPFRONT'")+ }+ }+val MIGRATION_24_25 = object : Migration(24, 25) {override fun migrate(database: SupportSQLiteDatabase) {// ── epg_sources ──diff --git a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt b/data/src/main/java/com/streamvault/data/local/entity/Entities.ktindex 1e699617..8c9664cc 100644--- a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt+++ b/data/src/main/java/com/streamvault/data/local/entity/Entities.kt@@ -7,6 +7,7 @@ import androidx.room.Fts4import androidx.room.Indeximport androidx.room.PrimaryKeyimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderType@@ -29,6 +30,7 @@ data class ProviderEntity(@ColumnInfo(name = "expiration_date") val expirationDate: Long? = null,@ColumnInfo(name = "api_version") val apiVersion: String? = null,@ColumnInfo(name = "allowed_output_formats_json") val allowedOutputFormatsJson: String = "[]",+ @ColumnInfo(name = "epg_sync_mode") val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,@ColumnInfo(name = "xtream_fast_sync_enabled") val xtreamFastSyncEnabled: Boolean = false,val status: ProviderStatus = ProviderStatus.UNKNOWN,@ColumnInfo(name = "last_synced_at") val lastSyncedAt: Long = 0,diff --git a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.ktindex bdccfbfa..8898efdd 100644--- a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt+++ b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt@@ -25,6 +25,7 @@ fun ProviderEntity.toDomain() = Provider(expirationDate = expirationDate,apiVersion = apiVersion,allowedOutputFormats = decodeAllowedOutputFormats(allowedOutputFormatsJson),+ epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = xtreamFastSyncEnabled,status = status,lastSyncedAt = lastSyncedAt,@@ -45,6 +46,7 @@ fun Provider.toEntity() = ProviderEntity(expirationDate = expirationDate,apiVersion = apiVersion,allowedOutputFormatsJson = encodeAllowedOutputFormats(allowedOutputFormats),+ epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = xtreamFastSyncEnabled,status = status,lastSyncedAt = lastSyncedAt,diff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex 5659f992..948be1f5 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -14,8 +14,12 @@ import com.streamvault.domain.model.*import com.streamvault.domain.provider.IptvProviderimport com.streamvault.domain.repository.ProviderRepositoryimport com.streamvault.domain.repository.SyncMetadataRepository+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJobimport kotlinx.coroutines.flow.Flowimport kotlinx.coroutines.flow.map+import kotlinx.coroutines.launchimport javax.inject.Injectimport javax.inject.Singleton@@ -28,6 +32,8 @@ class ProviderRepositoryImpl @Inject constructor(private val syncManager: SyncManager,private val syncMetadataRepository: SyncMetadataRepository) : ProviderRepository {+ private val repositoryScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+override fun getProviders(): Flow<List<Provider>> =providerDao.getAll().map { entities -> entities.map { it.toPublicDomain() } }@@ -74,6 +80,7 @@ class ProviderRepositoryImpl @Inject constructor(password: String,name: String,xtreamFastSyncEnabled: Boolean,+ epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> {@@ -111,6 +118,7 @@ class ProviderRepositoryImpl @Inject constructor(serverUrl = normalizedServerUrl,username = normalizedUsername,password = effectivePassword,+ epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = xtreamFastSyncEnabled,isActive = true,lastSyncedAt = 0,@@ -121,6 +129,7 @@ class ProviderRepositoryImpl @Inject constructor(} else {val newData = authResult.data.copy(name = normalizedName.ifBlank { authResult.data.name },+ epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = xtreamFastSyncEnabled)val newId = providerDao.insert(newData.toSecureEntity())@@ -136,6 +145,7 @@ class ProviderRepositoryImpl @Inject constructor(ProviderStatus.ACTIVE}updateProviderSyncStatus(providerData.id, finalStatus, System.currentTimeMillis())+ maybeScheduleBackgroundEpgSync(providerData.id)Result.success(providerData.copy(status = finalStatus))}is Result.Error -> {@@ -156,6 +166,7 @@ class ProviderRepositoryImpl @Inject constructor(override suspend fun validateM3u(url: String,name: String,+ epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> = try {@@ -184,6 +195,7 @@ class ProviderRepositoryImpl @Inject constructor(name = if (normalizedName.isNotBlank()) normalizedName else existingProvider.name,serverUrl = normalizedUrl,m3uUrl = normalizedUrl,+ epgSyncMode = epgSyncMode,isActive = true,lastSyncedAt = 0)@@ -195,6 +207,7 @@ class ProviderRepositoryImpl @Inject constructor(type = ProviderType.M3U,serverUrl = normalizedUrl,m3uUrl = normalizedUrl,+ epgSyncMode = epgSyncMode,status = ProviderStatus.ACTIVE)val newId = providerDao.insert(provider.toSecureEntity())@@ -211,6 +224,7 @@ class ProviderRepositoryImpl @Inject constructor(ProviderStatus.ACTIVE}updateProviderSyncStatus(providerData.id, finalStatus, System.currentTimeMillis())+ maybeScheduleBackgroundEpgSync(providerData.id)Result.success(providerData.copy(status = finalStatus))}is Result.Error -> {@@ -250,6 +264,7 @@ class ProviderRepositoryImpl @Inject constructor(ProviderStatus.ACTIVE}updateProviderSyncStatus(providerId, finalStatus, System.currentTimeMillis())+ maybeScheduleBackgroundEpgSync(providerId)syncResult}is Result.Error -> {@@ -408,6 +423,16 @@ class ProviderRepositoryImpl @Inject constructor(providerDao.update(updated)}+ private suspend fun maybeScheduleBackgroundEpgSync(providerId: Long) {+ val provider = providerDao.getById(providerId) ?: return+ if (provider.epgSyncMode != ProviderEpgSyncMode.BACKGROUND) {+ return+ }+ repositoryScope.launch {+ syncManager.scheduleBackgroundEpgSync(providerId)+ }+ }+private fun normalizeXtreamPrograms(providerId: Long,channelId: String,diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt b/data/src/main/java/com/streamvault/data/sync/SyncManager.ktindex 86e373f9..e46aa166 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt@@ -34,6 +34,7 @@ import com.streamvault.data.util.UrlSecurityPolicyimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.Movie+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.Series@@ -45,6 +46,9 @@ import com.streamvault.domain.repository.EpgSourceRepositoryimport com.streamvault.domain.repository.SyncMetadataRepositoryimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.CancellationException+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Job+import kotlinx.coroutines.SupervisorJobimport kotlinx.coroutines.asyncimport kotlinx.coroutines.awaitAllimport kotlinx.coroutines.coroutineScope@@ -53,6 +57,7 @@ import kotlinx.coroutines.flow.Flowimport kotlinx.coroutines.flow.StateFlowimport kotlinx.coroutines.flow.firstimport kotlinx.coroutines.flow.map+import kotlinx.coroutines.launchimport kotlinx.coroutines.withContextimport kotlinx.coroutines.TimeoutCancellationExceptionimport kotlinx.coroutines.withTimeout@@ -296,6 +301,8 @@ class SyncManager @Inject constructor(val syncState: StateFlow<SyncState> = syncStateTracker.aggregateStateval syncStatesByProvider: StateFlow<Map<Long, SyncState>> = syncStateTracker.statesByProviderprivate val providerSyncMutexes = ConcurrentHashMap<Long, Mutex>()+ private val backgroundEpgScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+ private val backgroundEpgJobs = ConcurrentHashMap<Long, Job>()private val xtreamCatalogHttpService: OkHttpXtreamApiService by lazy {OkHttpXtreamApiService(client = okHttpClient,@@ -316,12 +323,66 @@ class SyncManager @Inject constructor(}suspend fun onProviderDeleted(providerId: Long) {+ backgroundEpgJobs.remove(providerId)?.cancel()syncStateTracker.reset(providerId)providerSyncMutexes.remove(providerId)xtreamAdaptiveSyncPolicy.forgetProvider(providerId)syncCatalogStore.clearProviderStaging(providerId)}+ fun scheduleBackgroundEpgSync(providerId: Long) {+ backgroundEpgJobs.remove(providerId)?.cancel()+ val job = backgroundEpgScope.launch {+ withProviderLock(providerId) {+ val providerEntity = providerDao.getById(providerId) ?: return@withProviderLock+ val provider = providerEntity+ .copy(password = CredentialCrypto.decryptIfNeeded(providerEntity.password))+ .toDomain()+ try {+ publishSyncState(providerId, SyncState.Syncing("Downloading EPG..."))+ val warnings = syncProviderEpg(+ provider = provider,+ metadata = syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id),+ now = System.currentTimeMillis(),+ force = true,+ onProgress = null+ )+ publishSyncState(+ providerId,+ if (warnings.isEmpty()) {+ SyncState.Success()+ } else {+ SyncState.Partial("Background EPG sync completed with warnings", warnings)+ }+ )+ updateSyncStatusMetadata(+ providerId = providerId,+ status = if (warnings.isEmpty()) "SUCCESS" else "PARTIAL"+ )+ } catch (e: CancellationException) {+ throw e+ } catch (e: Exception) {+ Log.e(TAG, "Background EPG sync failed for provider $providerId: ${syncErrorSanitizer.throwableMessage(e)}")+ publishSyncState(+ providerId,+ SyncState.Partial(+ message = "Background EPG sync completed with warnings",+ warnings = listOf(syncErrorSanitizer.userMessage(e, "EPG sync failed"))+ )+ )+ updateSyncStatusMetadata(providerId = providerId, status = "PARTIAL")+ }+ }+ }+ job.invokeOnCompletion {+ backgroundEpgJobs.remove(providerId, job)+ }+ backgroundEpgJobs[providerId] = job+ }++ private fun shouldSyncEpgUpfront(provider: Provider): Boolean =+ provider.epgSyncMode == ProviderEpgSyncMode.UPFRONT+suspend fun sync(providerId: Long,force: Boolean = false,@@ -804,45 +865,14 @@ class SyncManager @Inject constructor(syncMetadataRepository.updateMetadata(metadata)}- if (force || ContentCachePolicy.shouldRefresh(metadata.lastEpgSync, ContentCachePolicy.EPG_TTL_MILLIS, now)) {- try {- progress(provider.id, onProgress, "Downloading EPG...")- val base = provider.serverUrl.trimEnd('/')- val xmltvUrl = provider.epgUrl.ifBlank {- XtreamUrlFactory.buildXmltvUrl(base, provider.username, provider.password)- }- UrlSecurityPolicy.validateXtreamEpgUrl(xmltvUrl)?.let { message ->- throw IllegalStateException(message)- }- retryTransient { epgRepository.refreshEpg(provider.id, xmltvUrl) }- val epgCount = programDao.countByProvider(provider.id)- metadata = metadata.copy(- lastEpgSync = now,- epgCount = epgCount- )- syncMetadataRepository.updateMetadata(metadata)- if (epgCount == 0) {- warnings.add("EPG imported zero programs; live guide will fall back to on-demand Xtream data.")- }- } catch (e: CancellationException) {- throw e- } catch (e: Exception) {- Log.e(TAG, "EPG sync failed (non-fatal): ${sanitizeThrowableMessage(e)}")- warnings.add("EPG XMLTV sync failed; live guide will fall back to on-demand Xtream data.")- }- }-- // Refresh external EPG sources assigned to this provider, then run resolution- try {- progress(provider.id, onProgress, "Refreshing external EPG sources...")- epgSourceRepository.refreshAllForProvider(provider.id)- progress(provider.id, onProgress, "Resolving EPG mappings...")- epgSourceRepository.resolveForProvider(provider.id)- } catch (e: CancellationException) {- throw e- } catch (e: Exception) {- Log.e(TAG, "External EPG resolution failed (non-fatal): ${sanitizeThrowableMessage(e)}")- warnings.add("External EPG source refresh/resolution failed.")+ if (shouldSyncEpgUpfront(provider)) {+ warnings += syncProviderEpg(+ provider = provider,+ metadata = metadata,+ now = now,+ force = force,+ onProgress = onProgress+ )}return if (warnings.isEmpty()) SyncOutcome() else SyncOutcome(partial = true, warnings = warnings)@@ -882,30 +912,86 @@ class SyncManager @Inject constructor(syncMetadataRepository.updateMetadata(metadata)}- val currentEpgUrl = providerDao.getById(provider.id)?.epgUrl ?: provider.epgUrl- if (!currentEpgUrl.isNullOrBlank() && (force || ContentCachePolicy.shouldRefresh(metadata.lastEpgSync, ContentCachePolicy.EPG_TTL_MILLIS, now))) {- val epgValidationError = UrlSecurityPolicy.validateOptionalEpgUrl(currentEpgUrl)- if (epgValidationError != null) {- warnings.add(epgValidationError)- } else {- try {- progress(provider.id, onProgress, "Downloading EPG...")- retryTransient { epgRepository.refreshEpg(provider.id, currentEpgUrl) }- metadata = metadata.copy(- lastEpgSync = now,- epgCount = programDao.countByProvider(provider.id)- )- syncMetadataRepository.updateMetadata(metadata)- } catch (e: CancellationException) {- throw e- } catch (e: Exception) {- Log.e(TAG, "EPG sync failed (non-fatal): ${sanitizeThrowableMessage(e)}")- warnings.add("EPG sync failed")+ if (shouldSyncEpgUpfront(provider)) {+ warnings += syncProviderEpg(+ provider = provider,+ metadata = metadata,+ now = now,+ force = force,+ onProgress = onProgress+ )+ }++ return if (warnings.isEmpty()) SyncOutcome() else SyncOutcome(partial = true, warnings = warnings)+ }++ private suspend fun syncProviderEpg(+ provider: Provider,+ metadata: SyncMetadata,+ now: Long,+ force: Boolean,+ onProgress: ((String) -> Unit)?+ ): List<String> {+ var updatedMetadata = metadata+ val warnings = mutableListOf<String>()++ when (provider.type) {+ ProviderType.XTREAM_CODES -> {+ if (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSync, ContentCachePolicy.EPG_TTL_MILLIS, now)) {+ try {+ progress(provider.id, onProgress, "Downloading EPG...")+ val base = provider.serverUrl.trimEnd('/')+ val xmltvUrl = provider.epgUrl.ifBlank {+ XtreamUrlFactory.buildXmltvUrl(base, provider.username, provider.password)+ }+ UrlSecurityPolicy.validateXtreamEpgUrl(xmltvUrl)?.let { message ->+ throw IllegalStateException(message)+ }+ retryTransient { epgRepository.refreshEpg(provider.id, xmltvUrl) }+ val epgCount = programDao.countByProvider(provider.id)+ updatedMetadata = updatedMetadata.copy(+ lastEpgSync = now,+ epgCount = epgCount+ )+ syncMetadataRepository.updateMetadata(updatedMetadata)+ if (epgCount == 0) {+ warnings.add("EPG imported zero programs; live guide will fall back to on-demand Xtream data.")+ }+ } catch (e: CancellationException) {+ throw e+ } catch (e: Exception) {+ Log.e(TAG, "EPG sync failed (non-fatal): ${sanitizeThrowableMessage(e)}")+ warnings.add("EPG XMLTV sync failed; live guide will fall back to on-demand Xtream data.")+ }+ }+ }++ ProviderType.M3U -> {+ val currentEpgUrl = providerDao.getById(provider.id)?.epgUrl ?: provider.epgUrl+ if (!currentEpgUrl.isNullOrBlank() && (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSync, ContentCachePolicy.EPG_TTL_MILLIS, now))) {+ val epgValidationError = UrlSecurityPolicy.validateOptionalEpgUrl(currentEpgUrl)+ if (epgValidationError != null) {+ warnings.add(epgValidationError)+ } else {+ try {+ progress(provider.id, onProgress, "Downloading EPG...")+ retryTransient { epgRepository.refreshEpg(provider.id, currentEpgUrl) }+ updatedMetadata = updatedMetadata.copy(+ lastEpgSync = now,+ epgCount = programDao.countByProvider(provider.id)+ )+ syncMetadataRepository.updateMetadata(updatedMetadata)+ } catch (e: CancellationException) {+ throw e+ } catch (e: Exception) {+ Log.e(TAG, "EPG sync failed (non-fatal): ${sanitizeThrowableMessage(e)}")+ warnings.add("EPG sync failed")+ }+ }}}}- // Refresh external EPG sources assigned to this provider, then run resolutiontry {progress(provider.id, onProgress, "Refreshing external EPG sources...")epgSourceRepository.refreshAllForProvider(provider.id)@@ -918,7 +1004,7 @@ class SyncManager @Inject constructor(warnings.add("External EPG source refresh/resolution failed.")}- return if (warnings.isEmpty()) SyncOutcome() else SyncOutcome(partial = true, warnings = warnings)+ return warnings}private suspend fun syncEpgOnly(diff --git a/docs/images/ChannelView.png b/docs/images/ChannelView.pngnew file mode 100644index 00000000..3c61c97bBinary files /dev/null and b/docs/images/ChannelView.png differdiff --git a/docs/images/Guide.png b/docs/images/Guide.pngnew file mode 100644index 00000000..c9dd43acBinary files /dev/null and b/docs/images/Guide.png differdiff --git a/docs/images/Home.png b/docs/images/Home.pngnew file mode 100644index 00000000..7f41067bBinary files /dev/null and b/docs/images/Home.png differdiff --git a/docs/images/LiveTV.png b/docs/images/LiveTV.pngnew file mode 100644index 00000000..2da25766Binary files /dev/null and b/docs/images/LiveTV.png differdiff --git a/docs/images/MovieInfo.png b/docs/images/MovieInfo.pngnew file mode 100644index 00000000..25ba4236Binary files /dev/null and b/docs/images/MovieInfo.png differdiff --git a/docs/images/Movies.png b/docs/images/Movies.pngnew file mode 100644index 00000000..7c2769e7Binary files /dev/null and b/docs/images/Movies.png differdiff --git a/docs/images/SeriesEpisodes.png b/docs/images/SeriesEpisodes.pngnew file mode 100644index 00000000..7daee8ccBinary files /dev/null and b/docs/images/SeriesEpisodes.png differdiff --git a/docs/images/Settings.png b/docs/images/Settings.pngnew file mode 100644index 00000000..4ea9f68fBinary files /dev/null and b/docs/images/Settings.png differdiff --git a/domain/src/main/java/com/streamvault/domain/model/Provider.kt b/domain/src/main/java/com/streamvault/domain/model/Provider.ktindex d4918381..26e085b3 100644--- a/domain/src/main/java/com/streamvault/domain/model/Provider.kt+++ b/domain/src/main/java/com/streamvault/domain/model/Provider.kt@@ -14,6 +14,7 @@ data class Provider(val expirationDate: Long? = null,val apiVersion: String? = null,val allowedOutputFormats: List<String> = emptyList(),+ val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,val xtreamFastSyncEnabled: Boolean = true,val status: ProviderStatus = ProviderStatus.UNKNOWN,val lastSyncedAt: Long = 0L,@@ -34,6 +35,12 @@ enum class ProviderType {M3U}+enum class ProviderEpgSyncMode {+ UPFRONT,+ BACKGROUND,+ SKIP+}+enum class ProviderStatus {ACTIVE,PARTIAL,diff --git a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.ktindex 0966edc4..0df4e7b4 100644--- a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt@@ -2,6 +2,7 @@ package com.streamvault.domain.repositoryimport com.streamvault.domain.model.Programimport com.streamvault.domain.model.Provider+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.Resultimport kotlinx.coroutines.flow.Flow@@ -13,8 +14,8 @@ interface ProviderRepository {suspend fun updateProvider(provider: Provider): Result<Unit>suspend fun deleteProvider(id: Long): Result<Unit>suspend fun setActiveProvider(id: Long): Result<Unit>- suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, xtreamFastSyncEnabled: Boolean, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>- suspend fun validateM3u(url: String, name: String, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>+ suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, xtreamFastSyncEnabled: Boolean, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>+ suspend fun validateM3u(url: String, name: String, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>suspend fun refreshProviderData(providerId: Long,force: Boolean = false,diff --git a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.ktindex c71d94a3..2e0bf126 100644--- a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt+++ b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt@@ -2,6 +2,7 @@ package com.streamvault.domain.usecaseimport com.streamvault.domain.manager.ProviderSetupInputValidatorimport com.streamvault.domain.model.Provider+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.Resultimport com.streamvault.domain.repository.ProviderRepositoryimport javax.inject.Inject@@ -12,12 +13,14 @@ data class XtreamProviderSetupCommand(val password: String,val name: String,val xtreamFastSyncEnabled: Boolean = true,+ val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,val existingProviderId: Long? = null)data class M3uProviderSetupCommand(val url: String,val name: String,+ val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,val existingProviderId: Long? = null)@@ -48,6 +51,7 @@ class ValidateAndAddProvider @Inject constructor(password = command.password,name = validated.data.name,xtreamFastSyncEnabled = command.xtreamFastSyncEnabled,+ epgSyncMode = command.epgSyncMode,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()@@ -70,6 +74,7 @@ class ValidateAndAddProvider @Inject constructor(is Result.Success -> providerRepository.validateM3u(url = validated.data.url,name = validated.data.name,+ epgSyncMode = command.epgSyncMode,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()diff --git a/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.kt b/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.ktindex e827d1df..56ba8daa 100644--- a/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.kt+++ b/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.kt@@ -4,6 +4,7 @@ import com.google.common.truth.Truth.assertThatimport com.streamvault.domain.manager.ProviderSyncStateReaderimport com.streamvault.domain.model.Programimport com.streamvault.domain.model.Provider+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.Result@@ -107,6 +108,7 @@ private class FakeSyncProviderRepository(password: String,name: String,xtreamFastSyncEnabled: Boolean,+ epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> = error("Not used in test")@@ -114,6 +116,7 @@ private class FakeSyncProviderRepository(override suspend fun validateM3u(url: String,name: String,+ epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> = error("Not used in test")diff --git a/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.kt b/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.ktindex 4c64e08b..239dcdc4 100644--- a/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.kt+++ b/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.kt@@ -5,6 +5,7 @@ import com.streamvault.domain.manager.ProviderSetupInputValidatorimport com.streamvault.domain.model.Programimport com.streamvault.domain.manager.ValidatedM3uProviderInputimport com.streamvault.domain.manager.ValidatedXtreamProviderInput+import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderType@@ -64,6 +65,7 @@ class ValidateAndAddProviderTest {password = "secret",name = " Premium ",xtreamFastSyncEnabled = true,+ epgSyncMode = ProviderEpgSyncMode.BACKGROUND,existingProviderId = 7L))@@ -76,6 +78,7 @@ class ValidateAndAddProviderTest {password = "secret",name = "Premium",xtreamFastSyncEnabled = true,+ epgSyncMode = ProviderEpgSyncMode.BACKGROUND,id = 7L))@@ -100,6 +103,7 @@ class ValidateAndAddProviderTest {M3uProviderSetupCommand(url = "file://playlist.m3u",name = "Local Playlist",+ epgSyncMode = ProviderEpgSyncMode.SKIP,existingProviderId = 11L))@@ -109,6 +113,7 @@ class ValidateAndAddProviderTest {M3uCall(url = "file://playlist.m3u",name = "Local Playlist",+ epgSyncMode = ProviderEpgSyncMode.SKIP,id = 11L))@@ -148,12 +153,14 @@ private data class XtreamCall(val password: String,val name: String,val xtreamFastSyncEnabled: Boolean,+ val epgSyncMode: ProviderEpgSyncMode,val id: Long?)private data class M3uCall(val url: String,val name: String,+ val epgSyncMode: ProviderEpgSyncMode,val id: Long?)@@ -181,20 +188,22 @@ private class FakeProviderRepository : ProviderRepository {password: String,name: String,xtreamFastSyncEnabled: Boolean,+ epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> {- lastXtreamCall = XtreamCall(serverUrl, username, password, name, xtreamFastSyncEnabled, id)+ lastXtreamCall = XtreamCall(serverUrl, username, password, name, xtreamFastSyncEnabled, epgSyncMode, id)return Result.success(provider(id = id ?: 1L, name = name, type = ProviderType.XTREAM_CODES))}override suspend fun validateM3u(url: String,name: String,+ epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> {- lastM3uCall = M3uCall(url, name, id)+ lastM3uCall = M3uCall(url, name, epgSyncMode, id)return Result.success(provider(id = id ?: 2L, name = name, type = ProviderType.M3U, m3uUrl = url))}