StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Add provider guide and channel logo source policies
David Nashashbd21ee4b5148
diff --git a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt b/app/src/main/java/com/streamvault/app/di/DatabaseModule.ktindex 064515e1..a4648ccb 100644--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt@@ -101,7 +101,8 @@ object DatabaseModule {StreamVaultDatabase.MIGRATION_57_58,StreamVaultDatabase.MIGRATION_58_59,StreamVaultDatabase.MIGRATION_59_60,- StreamVaultDatabase.MIGRATION_60_61+ StreamVaultDatabase.MIGRATION_60_61,+ StreamVaultDatabase.MIGRATION_61_62)// 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/pairing/ProviderQrPairingManager.kt b/app/src/main/java/com/streamvault/app/pairing/ProviderQrPairingManager.ktindex d719a56e..b60dc682 100644--- a/app/src/main/java/com/streamvault/app/pairing/ProviderQrPairingManager.kt+++ b/app/src/main/java/com/streamvault/app/pairing/ProviderQrPairingManager.kt@@ -12,6 +12,8 @@ import com.google.zxing.BarcodeFormatimport com.google.zxing.EncodeHintTypeimport com.google.zxing.qrcode.QRCodeWriterimport com.streamvault.domain.model.ProviderEpgSyncMode+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ProviderXtreamLiveSyncModeimport com.streamvault.domain.model.StalkerAuthModeimport com.streamvault.domain.repository.ProviderRepository@@ -235,7 +237,9 @@ class ProviderQrPairingManager @Inject constructor(M3uProviderSetupCommand(url = form["m3uUrl"].orEmpty(),name = name,- epgSyncMode = ProviderEpgSyncMode.BACKGROUND+ epgSyncMode = ProviderEpgSyncMode.BACKGROUND,+ guideSourcePolicy = GuideSourcePolicy.AUTO,+ channelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED),onProgress = ::updateProgress)@@ -247,7 +251,9 @@ class ProviderQrPairingManager @Inject constructor(username = form["username"].orEmpty(),password = form["password"].orEmpty(),name = name,- epgSyncMode = ProviderEpgSyncMode.BACKGROUND+ epgSyncMode = ProviderEpgSyncMode.BACKGROUND,+ guideSourcePolicy = GuideSourcePolicy.AUTO,+ channelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED),onProgress = ::updateProgress)@@ -267,7 +273,9 @@ class ProviderQrPairingManager @Inject constructor(password = form["password"].orEmpty(),name = name,epgSyncMode = ProviderEpgSyncMode.BACKGROUND,- xtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO+ xtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO,+ guideSourcePolicy = GuideSourcePolicy.AUTO,+ channelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED),onProgress = ::updateProgress)diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.ktindex 9312cf87..14a621ea 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt@@ -16,6 +16,7 @@ import com.streamvault.domain.model.CombinedCategoryimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.EpgOverrideCandidateimport com.streamvault.domain.model.Favorite+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.Programimport com.streamvault.domain.model.VirtualCategoryIdsimport com.streamvault.domain.repository.ChannelRepository@@ -1773,6 +1774,11 @@ class EpgViewModel @Inject constructor(windowStart: Long,windowEnd: Long): Map<String, List<Program>> {+ if (provider.guideSourcePolicy == GuideSourcePolicy.EXTERNAL_ONLY ||+ provider.guideSourcePolicy == GuideSourcePolicy.DISABLED+ ) {+ return emptyMap()+ }if (provider.type != com.streamvault.domain.model.ProviderType.XTREAM_CODES &&provider.type != com.streamvault.domain.model.ProviderType.STALKER_PORTALdiff --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 ee765b28..a8399947 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@@ -92,6 +92,8 @@ import com.google.zxing.BarcodeFormatimport android.graphics.Bitmapimport com.streamvault.data.util.ProviderInputSanitizerimport com.streamvault.domain.model.ProviderEpgSyncMode+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ProviderXtreamLiveSyncModeimport com.streamvault.domain.model.StalkerAuthModeimport com.streamvault.domain.usecase.JellyfinProviderSetupCommand@@ -493,6 +495,8 @@ fun ProviderSetupScreen(onToggleM3uVodClassification = { viewModel.updateM3uVodClassificationEnabled(!uiState.m3uVodClassificationEnabled) },onSelectEpgSyncMode = viewModel::updateEpgSyncMode,onSelectXtreamLiveSyncMode = viewModel::updateXtreamLiveSyncMode,+ onSelectGuideSourcePolicy = viewModel::updateGuideSourcePolicy,+ onSelectChannelLogoSourcePolicy = viewModel::updateChannelLogoSourcePolicy,modifier = Modifier.weight(1f).fillMaxHeight())}@@ -552,6 +556,8 @@ fun ProviderSetupScreen(onToggleM3uVodClassification = { viewModel.updateM3uVodClassificationEnabled(!uiState.m3uVodClassificationEnabled) },onSelectEpgSyncMode = viewModel::updateEpgSyncMode,onSelectXtreamLiveSyncMode = viewModel::updateXtreamLiveSyncMode,+ onSelectGuideSourcePolicy = viewModel::updateGuideSourcePolicy,+ onSelectChannelLogoSourcePolicy = viewModel::updateChannelLogoSourcePolicy,modifier = Modifier.weight(1f).fillMaxWidth())}@@ -894,6 +900,8 @@ private fun ProviderFormContent(onToggleM3uVodClassification: () -> Unit,onSelectEpgSyncMode: (ProviderEpgSyncMode) -> Unit,onSelectXtreamLiveSyncMode: (ProviderXtreamLiveSyncMode) -> Unit,+ onSelectGuideSourcePolicy: (GuideSourcePolicy) -> Unit,+ onSelectChannelLogoSourcePolicy: (ChannelLogoSourcePolicy) -> Unit,modifier: Modifier = Modifier) {val scrollState = rememberScrollState()@@ -973,6 +981,8 @@ private fun ProviderFormContent(onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode,onSelectXtreamLiveSyncMode = onSelectXtreamLiveSyncMode,+ onSelectGuideSourcePolicy = onSelectGuideSourcePolicy,+ onSelectChannelLogoSourcePolicy = onSelectChannelLogoSourcePolicy,username = username,onUsernameChange = onUsernameChange,password = password,@@ -1062,6 +1072,8 @@ private fun ProviderFormContent(onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode,onSelectXtreamLiveSyncMode = onSelectXtreamLiveSyncMode,+ onSelectGuideSourcePolicy = onSelectGuideSourcePolicy,+ onSelectChannelLogoSourcePolicy = onSelectChannelLogoSourcePolicy,username = username,onUsernameChange = onUsernameChange,password = password,@@ -1132,6 +1144,8 @@ private fun ProviderFormContent(onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode,onSelectXtreamLiveSyncMode = onSelectXtreamLiveSyncMode,+ onSelectGuideSourcePolicy = onSelectGuideSourcePolicy,+ onSelectChannelLogoSourcePolicy = onSelectChannelLogoSourcePolicy,username = username,onUsernameChange = onUsernameChange,password = password,@@ -1187,6 +1201,8 @@ private fun ProviderFormContent(onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode,onSelectXtreamLiveSyncMode = onSelectXtreamLiveSyncMode,+ onSelectGuideSourcePolicy = onSelectGuideSourcePolicy,+ onSelectChannelLogoSourcePolicy = onSelectChannelLogoSourcePolicy,username = username,onUsernameChange = onUsernameChange,password = password,@@ -1263,6 +1279,8 @@ private fun AdvancedProviderOptionsSection(onToggleM3uVodClassification: () -> Unit,onSelectEpgSyncMode: (ProviderEpgSyncMode) -> Unit,onSelectXtreamLiveSyncMode: (ProviderXtreamLiveSyncMode) -> Unit,+ onSelectGuideSourcePolicy: (GuideSourcePolicy) -> Unit,+ onSelectChannelLogoSourcePolicy: (ChannelLogoSourcePolicy) -> Unit,username: String,onUsernameChange: (String) -> Unit,password: String,@@ -1314,9 +1332,11 @@ private fun AdvancedProviderOptionsSection(SourceType.JELLYFIN -> ProviderEpgSyncMode.UPFRONT}- LaunchedEffect(uiState.isEditing, uiState.epgSyncMode, uiState.xtreamLiveSyncMode, sourceType) {+ LaunchedEffect(uiState.isEditing, uiState.epgSyncMode, uiState.xtreamLiveSyncMode, uiState.guideSourcePolicy, uiState.channelLogoSourcePolicy, sourceType) {val hasNonDefaultSelection = ((sourceType == SourceType.XTREAM || sourceType == SourceType.STALKER) && uiState.epgSyncMode != defaultEpgSyncMode) ||(sourceType == SourceType.XTREAM && uiState.xtreamLiveSyncMode != ProviderXtreamLiveSyncMode.AUTO) ||+ (supportsGuideAndLogoPolicy(sourceType) && uiState.guideSourcePolicy != GuideSourcePolicy.AUTO) ||+ (supportsGuideAndLogoPolicy(sourceType) && uiState.channelLogoSourcePolicy != ChannelLogoSourcePolicy.SUPPLIER_PREFERRED) ||((sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) && !uiState.m3uVodClassificationEnabled) ||((sourceType == SourceType.XTREAM || sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) &&httpUserAgent.isNotBlank()) ||@@ -1484,7 +1504,7 @@ private fun AdvancedProviderOptionsSection()}- if (sourceType == SourceType.XTREAM || sourceType == SourceType.STALKER) {+ if (supportsGuideAndLogoPolicy(sourceType)) {if (sourceType == SourceType.XTREAM) {Column(modifier = Modifier@@ -1514,6 +1534,60 @@ private fun AdvancedProviderOptionsSection(}}+ 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 = "Guide source",+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = "Choose whether this provider uses its supplier guide, your assigned external XMLTV sources, or no guide at all.",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ GuideSourcePolicy.entries.forEach { policy ->+ GuideSourcePolicyOptionRow(+ policy = policy,+ selected = uiState.guideSourcePolicy == policy,+ onSelect = { onSelectGuideSourcePolicy(policy) }+ )+ }+ }++ 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 = "Channel logos",+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = "Pick whether channel logos come from the supplier, the matched EPG channel icon, or a strict single source.",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ ChannelLogoSourcePolicy.entries.forEach { policy ->+ ChannelLogoSourcePolicyOptionRow(+ policy = policy,+ selected = uiState.channelLogoSourcePolicy == policy,+ onSelect = { onSelectChannelLogoSourcePolicy(policy) }+ )+ }+ }+Column(modifier = Modifier.fillMaxWidth()@@ -2137,6 +2211,98 @@ private fun EpgSyncModeOptionRow(}}+private fun supportsGuideAndLogoPolicy(sourceType: SourceType): Boolean = when (sourceType) {+ SourceType.XTREAM,+ SourceType.STALKER,+ SourceType.M3U_URL,+ SourceType.M3U_FILE -> true+ SourceType.JELLYFIN -> false+}++@Composable+private fun GuideSourcePolicyOptionRow(+ policy: GuideSourcePolicy,+ selected: Boolean,+ onSelect: () -> Unit+) {+ val title = when (policy) {+ GuideSourcePolicy.AUTO -> "Auto"+ GuideSourcePolicy.EXTERNAL_ONLY -> "Use external EPG only"+ GuideSourcePolicy.PROVIDER_ONLY -> "Use supplier EPG only"+ GuideSourcePolicy.DISABLED -> "Disable guide data"+ }+ val description = when (policy) {+ GuideSourcePolicy.AUTO -> "Keep the current mixed behavior: external XMLTV can override supplier guide data, and unmatched channels may still use supplier fallback."+ GuideSourcePolicy.EXTERNAL_ONLY -> "Use only assigned external XMLTV sources. Unmatched channels stay without guide data."+ GuideSourcePolicy.PROVIDER_ONLY -> "Ignore assigned external XMLTV sources for this provider and use only the supplier guide paths."+ GuideSourcePolicy.DISABLED -> "Do not import or resolve guide data for this provider."+ }+ PolicyOptionRow(title = title, description = description, selected = selected, onSelect = onSelect)+}++@Composable+private fun ChannelLogoSourcePolicyOptionRow(+ policy: ChannelLogoSourcePolicy,+ selected: Boolean,+ onSelect: () -> Unit+) {+ val title = when (policy) {+ ChannelLogoSourcePolicy.SUPPLIER_PREFERRED -> "Supplier logos first"+ ChannelLogoSourcePolicy.EPG_PREFERRED -> "Prefer EPG logos"+ ChannelLogoSourcePolicy.SUPPLIER_ONLY -> "Supplier logos only"+ ChannelLogoSourcePolicy.EPG_ONLY -> "EPG logos only"+ }+ val description = when (policy) {+ ChannelLogoSourcePolicy.SUPPLIER_PREFERRED -> "Use the supplier logo when it exists, then fall back to the matched EPG icon."+ ChannelLogoSourcePolicy.EPG_PREFERRED -> "Use the matched EPG icon first, then fall back to the supplier logo."+ ChannelLogoSourcePolicy.SUPPLIER_ONLY -> "Always use supplier logos for this provider."+ ChannelLogoSourcePolicy.EPG_ONLY -> "Always use matched EPG icons for this provider."+ }+ PolicyOptionRow(title = title, description = description, selected = selected, onSelect = onSelect)+}++@Composable+private fun PolicyOptionRow(+ title: String,+ description: String,+ selected: Boolean,+ onSelect: () -> Unit+) {+ 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 = title, style = MaterialTheme.typography.bodyMedium, color = TextPrimary)+ Text(text = description, 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 cde7dcdb..7314255e 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@@ -18,6 +18,8 @@ import com.streamvault.domain.model.Result as DomainResultimport com.streamvault.domain.manager.BackupImportPlanimport com.streamvault.domain.manager.BackupPreviewimport com.streamvault.domain.model.ActiveLiveSource+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderXtreamLiveSyncModeimport com.streamvault.domain.model.ProviderType@@ -228,6 +230,8 @@ class ProviderSetupViewModel @Inject constructor(stalkerAdvancedOptionsJson = provider.stalkerAdvancedOptionsJson,epgSyncMode = provider.epgSyncMode,xtreamLiveSyncMode = provider.xtreamLiveSyncMode,+ guideSourcePolicy = provider.guideSourcePolicy,+ channelLogoSourcePolicy = provider.channelLogoSourcePolicy,hasCustomizedEpgSyncMode = true,m3uVodClassificationEnabled = provider.m3uVodClassificationEnabled,selectedTab = when (provider.type) {@@ -259,6 +263,14 @@ class ProviderSetupViewModel @Inject constructor(_uiState.update { it.copy(xtreamLiveSyncMode = mode) }}+ fun updateGuideSourcePolicy(policy: GuideSourcePolicy) {+ _uiState.update { it.copy(guideSourcePolicy = policy) }+ }++ fun updateChannelLogoSourcePolicy(policy: ChannelLogoSourcePolicy) {+ _uiState.update { it.copy(channelLogoSourcePolicy = policy) }+ }+fun applySourceDefaults(sourceType: SetupSourceType) {_uiState.update { current ->if (current.isEditing || current.hasCustomizedEpgSyncMode) {@@ -322,6 +334,8 @@ class ProviderSetupViewModel @Inject constructor(signature = signature,stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson,epgSyncMode = _uiState.value.epgSyncMode,+ guideSourcePolicy = _uiState.value.guideSourcePolicy,+ channelLogoSourcePolicy = _uiState.value.channelLogoSourcePolicy,existingProviderId = existingId),onProgress = { msg -> _uiState.update { it.copy(syncProgress = msg) } }@@ -405,6 +419,8 @@ class ProviderSetupViewModel @Inject constructor(xtreamFastSyncEnabled = false,epgSyncMode = _uiState.value.epgSyncMode,xtreamLiveSyncMode = _uiState.value.xtreamLiveSyncMode,+ guideSourcePolicy = _uiState.value.guideSourcePolicy,+ channelLogoSourcePolicy = _uiState.value.channelLogoSourcePolicy,existingProviderId = existingId),onProgress = { msg -> _uiState.update { it.copy(syncProgress = msg) } }@@ -485,6 +501,8 @@ class ProviderSetupViewModel @Inject constructor(httpHeaders = httpHeaders,epgSyncMode = _uiState.value.epgSyncMode,m3uVodClassificationEnabled = _uiState.value.m3uVodClassificationEnabled,+ guideSourcePolicy = _uiState.value.guideSourcePolicy,+ channelLogoSourcePolicy = _uiState.value.channelLogoSourcePolicy,existingProviderId = existingId),onProgress = { msg -> _uiState.update { it.copy(syncProgress = msg) } }@@ -1079,6 +1097,8 @@ data class ProviderSetupState(val driveSignedIn: Boolean = false,val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,val xtreamLiveSyncMode: ProviderXtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO,+ val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,val hasCustomizedEpgSyncMode: Boolean = false,val m3uVodClassificationEnabled: Boolean = false)diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.ktindex 421e65b4..75f4637c 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt@@ -37,6 +37,9 @@ import com.streamvault.app.ui.design.FocusSpecimport com.streamvault.app.ui.interaction.TvClickableSurfaceimport com.streamvault.app.ui.theme.OnSurfaceDimimport com.streamvault.app.ui.theme.Primary+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicy+import com.streamvault.domain.model.ProviderTypeinternal fun LazyListScope.epgSourcesSection(uiState: SettingsUiState,@@ -124,6 +127,15 @@ internal fun LazyListScope.epgSourcesSection(onRemove = { epgSourceId -> viewModel.unassignEpgSourceFromProvider(provider.id, epgSourceId) },onAssign = { epgSourceId -> viewModel.assignEpgSourceToProvider(provider.id, epgSourceId) })+ if (supportsGuideAndLogoPolicy(provider.type)) {+ ProviderGuideAndLogoPolicyCard(+ providerName = provider.name,+ guideSourcePolicy = provider.guideSourcePolicy,+ channelLogoSourcePolicy = provider.channelLogoSourcePolicy,+ onGuideSourceSelected = { policy -> viewModel.setGuideSourcePolicy(provider.id, policy) },+ onLogoSourceSelected = { policy -> viewModel.setChannelLogoSourcePolicy(provider.id, policy) }+ )+ }}}@@ -154,6 +166,106 @@ internal fun LazyListScope.epgSourcesSection(}}+@Composable+private fun ProviderGuideAndLogoPolicyCard(+ providerName: String,+ guideSourcePolicy: GuideSourcePolicy,+ channelLogoSourcePolicy: ChannelLogoSourcePolicy,+ onGuideSourceSelected: (GuideSourcePolicy) -> Unit,+ onLogoSourceSelected: (ChannelLogoSourcePolicy) -> Unit+) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(bottom = 16.dp)+ .clip(RoundedCornerShape(18.dp))+ .background(Color(0xFF152333))+ .padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Text(+ text = "$providerName Guide Controls",+ style = MaterialTheme.typography.titleSmall,+ color = Color.White,+ fontWeight = FontWeight.SemiBold+ )+ Text(+ text = "Choose whether guide data comes from external XMLTV, supplier data, or stays disabled, then decide which logo source wins.",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+ GuideSourcePolicy.entries.forEach { policy ->+ PolicyChip(+ text = guideSourceLabel(policy),+ selected = guideSourcePolicy == policy,+ onClick = { onGuideSourceSelected(policy) }+ )+ }+ }+ FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+ ChannelLogoSourcePolicy.entries.forEach { policy ->+ PolicyChip(+ text = logoSourceLabel(policy),+ selected = channelLogoSourcePolicy == policy,+ onClick = { onLogoSourceSelected(policy) }+ )+ }+ }+ }+}++@Composable+private fun PolicyChip(+ text: String,+ selected: Boolean,+ onClick: () -> Unit+) {+ TvClickableSurface(+ onClick = onClick,+ modifier = Modifier,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (selected) Primary.copy(alpha = 0.22f) else Color(0xFF0F1B29),+ focusedContainerColor = if (selected) Primary.copy(alpha = 0.32f) else Color(0xFF1A2A3B)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(BorderStroke(1.dp, if (selected) Primary else Color(0xFF2D4358))),+ focusedBorder = Border(BorderStroke(2.dp, Primary))+ ),+ glow = ClickableSurfaceDefaults.glow(),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1.02f)+ ) {+ Text(+ text = text,+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),+ style = MaterialTheme.typography.labelMedium,+ color = Color.White+ )+ }+}++private fun guideSourceLabel(policy: GuideSourcePolicy): String = when (policy) {+ GuideSourcePolicy.AUTO -> "Auto"+ GuideSourcePolicy.EXTERNAL_ONLY -> "Use external EPG only"+ GuideSourcePolicy.PROVIDER_ONLY -> "Use supplier EPG only"+ GuideSourcePolicy.DISABLED -> "Disable guide data"+}++private fun logoSourceLabel(policy: ChannelLogoSourcePolicy): String = when (policy) {+ ChannelLogoSourcePolicy.SUPPLIER_PREFERRED -> "Supplier logos first"+ ChannelLogoSourcePolicy.EPG_PREFERRED -> "Prefer EPG logos"+ ChannelLogoSourcePolicy.SUPPLIER_ONLY -> "Supplier logos only"+ ChannelLogoSourcePolicy.EPG_ONLY -> "EPG logos only"+}++private fun supportsGuideAndLogoPolicy(providerType: ProviderType): Boolean = when (providerType) {+ ProviderType.XTREAM_CODES,+ ProviderType.STALKER_PORTAL,+ ProviderType.M3U -> true+ ProviderType.JELLYFIN -> false+}+@Composableprivate fun EpgTimeShiftCard(providerName: String,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsProviderActions.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsProviderActions.ktindex 311dbd3b..7167d4b8 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsProviderActions.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsProviderActions.kt@@ -4,6 +4,8 @@ import com.streamvault.app.tv.LauncherRecommendationsManagerimport com.streamvault.app.tv.WatchNextManagerimport com.streamvault.app.tvinput.TvInputChannelSyncManagerimport com.streamvault.domain.model.ActiveLiveSource+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.Result@@ -241,6 +243,26 @@ internal class SettingsProviderActions(}}+ fun setGuideSourcePolicy(scope: CoroutineScope, providerId: Long, policy: GuideSourcePolicy) {+ scope.launch {+ val provider = providerRepository.getProvider(providerId) ?: return@launch+ when (val result = providerRepository.updateProvider(provider.copy(guideSourcePolicy = policy))) {+ is Result.Error -> uiState.update { it.copy(userMessage = "Could not save guide source: ${result.message}") }+ else -> uiState.update { it.copy(userMessage = "Guide source updated for ${provider.name}") }+ }+ }+ }++ fun setChannelLogoSourcePolicy(scope: CoroutineScope, providerId: Long, policy: ChannelLogoSourcePolicy) {+ scope.launch {+ val provider = providerRepository.getProvider(providerId) ?: return@launch+ when (val result = providerRepository.updateProvider(provider.copy(channelLogoSourcePolicy = policy))) {+ is Result.Error -> uiState.update { it.copy(userMessage = "Could not save logo source: ${result.message}") }+ else -> uiState.update { it.copy(userMessage = "Channel logo source updated for ${provider.name}") }+ }+ }+ }+fun refreshProvider(scope: CoroutineScope,providerId: Long,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 ee2403e8..1a7dd729 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@@ -38,6 +38,7 @@ import com.streamvault.domain.model.AppHomeDashboardShelfimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTimeFormatimport com.streamvault.domain.model.AppTopLevelDestination+import com.streamvault.domain.model.ChannelLogoSourcePolicyimport com.streamvault.domain.model.CategorySortModeimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.ContentType@@ -61,6 +62,7 @@ import com.streamvault.domain.model.RemoteColorButtonimport com.streamvault.domain.model.RemoteShortcutProfileimport com.streamvault.domain.model.RemoteShortcutSelectionimport com.streamvault.domain.model.EpgResolutionSummary+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.Resultimport com.streamvault.domain.model.TimeshiftBackendPreferenceimport com.streamvault.domain.model.VirtualCategoryIds@@ -421,6 +423,14 @@ class SettingsViewModel @Inject constructor(providerActions.setM3uVodClassificationEnabled(viewModelScope, providerId, enabled)}+ fun setGuideSourcePolicy(providerId: Long, policy: GuideSourcePolicy) {+ providerActions.setGuideSourcePolicy(viewModelScope, providerId, policy)+ }++ fun setChannelLogoSourcePolicy(providerId: Long, policy: ChannelLogoSourcePolicy) {+ providerActions.setChannelLogoSourcePolicy(viewModelScope, providerId, policy)+ }+fun refreshProviderClassification(providerId: Long) {refreshProvider(providerId)}diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/62.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/62.jsonnew file mode 100644index 00000000..f2295184--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/62.json@@ -0,0 +1,5362 @@+{+ "formatVersion": 1,+ "database": {+ "version": 62,+ "identityHash": "d264bd271c35afee323d4f3a16f64b0e",+ "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, `http_user_agent` TEXT NOT NULL, `http_headers` TEXT NOT NULL, `stalker_mac_address` TEXT NOT NULL, `stalker_device_profile` TEXT NOT NULL, `stalker_device_timezone` TEXT NOT NULL, `stalker_device_locale` TEXT NOT NULL, `stalker_serial_number` TEXT NOT NULL, `stalker_device_id` TEXT NOT NULL, `stalker_device_id2` TEXT NOT NULL, `stalker_signature` TEXT NOT NULL, `stalker_advanced_options_json` TEXT NOT NULL, `stalker_auth_mode` TEXT NOT NULL, `stalker_portal_profile` TEXT NOT NULL, `stalker_portal_fingerprint` TEXT NOT NULL, `stalker_mag_preset` TEXT NOT NULL, `stalker_last_bootstrap_recipe` TEXT NOT NULL, `stalker_endpoint_preference` TEXT NOT NULL, `stalker_cookie_mode` TEXT NOT NULL, `stalker_playback_backend_hint` TEXT NOT NULL, `stalker_last_playback_mode` TEXT, `stalker_credentials_required` INTEGER NOT NULL, `stalker_mac_required` INTEGER NOT NULL, `stalker_uses_temp_links` INTEGER NOT NULL, `stalker_module_restricted` INTEGER NOT NULL, `stalker_strict_fingerprint_required` INTEGER NOT NULL, `stalker_recipe_fallback_used` INTEGER NOT NULL, `stalker_recipe_rediscovery_attempts` INTEGER 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, `guide_source_policy` TEXT NOT NULL, `channel_logo_source_policy` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `xtream_live_sync_mode` TEXT NOT NULL, `m3u_vod_classification_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": "httpUserAgent",+ "columnName": "http_user_agent",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "httpHeaders",+ "columnName": "http_headers",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMacAddress",+ "columnName": "stalker_mac_address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceProfile",+ "columnName": "stalker_device_profile",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceTimezone",+ "columnName": "stalker_device_timezone",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceLocale",+ "columnName": "stalker_device_locale",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerSerialNumber",+ "columnName": "stalker_serial_number",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceId",+ "columnName": "stalker_device_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceId2",+ "columnName": "stalker_device_id2",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerSignature",+ "columnName": "stalker_signature",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerAdvancedOptionsJson",+ "columnName": "stalker_advanced_options_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerAuthMode",+ "columnName": "stalker_auth_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPortalProfile",+ "columnName": "stalker_portal_profile",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPortalFingerprint",+ "columnName": "stalker_portal_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMagPreset",+ "columnName": "stalker_mag_preset",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerLastBootstrapRecipe",+ "columnName": "stalker_last_bootstrap_recipe",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerEndpointPreference",+ "columnName": "stalker_endpoint_preference",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerCookieMode",+ "columnName": "stalker_cookie_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPlaybackBackendHint",+ "columnName": "stalker_playback_backend_hint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerLastPlaybackMode",+ "columnName": "stalker_last_playback_mode",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "stalkerCredentialsRequired",+ "columnName": "stalker_credentials_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMacRequired",+ "columnName": "stalker_mac_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerUsesTemporaryLinks",+ "columnName": "stalker_uses_temp_links",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerModuleRestricted",+ "columnName": "stalker_module_restricted",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerStrictFingerprintRequired",+ "columnName": "stalker_strict_fingerprint_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerRecipeFallbackUsed",+ "columnName": "stalker_recipe_fallback_used",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerRecipeRediscoveryAttempts",+ "columnName": "stalker_recipe_rediscovery_attempts",+ "affinity": "INTEGER",+ "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": "guideSourcePolicy",+ "columnName": "guide_source_policy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelLogoSourcePolicy",+ "columnName": "channel_logo_source_policy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "xtreamFastSyncEnabled",+ "columnName": "xtream_fast_sync_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xtreamLiveSyncMode",+ "columnName": "xtream_live_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uVodClassificationEnabled",+ "columnName": "m3u_vod_classification_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_stalker_mac_address",+ "unique": true,+ "columnNames": [+ "server_url",+ "username",+ "stalker_mac_address"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username_stalker_mac_address` ON `${TABLE_NAME}` (`server_url`, `username`, `stalker_mac_address`)"+ }+ ]+ },+ {+ "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, `audio_video_offset_ms` INTEGER, `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": "audioVideoOffsetMs",+ "columnName": "audio_video_offset_ms",+ "affinity": "INTEGER"+ },+ {+ "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, `watch_count` 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, `added_at` INTEGER NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_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": "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": "watchCount",+ "columnName": "watch_count",+ "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+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "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`)"+ },+ {+ "name": "index_movies_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_added_at_release_date_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "added_at",+ "release_date",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_added_at_release_date_name_id` ON `${TABLE_NAME}` (`provider_id`, `added_at`, `release_date`, `name`, `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, `provider_series_id` TEXT, `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, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_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": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "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+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "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`)"+ },+ {+ "name": "index_series_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_last_modified_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "last_modified",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_last_modified_name_id` ON `${TABLE_NAME}` (`provider_id`, `last_modified`, `name`, `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, `added_at` INTEGER 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+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "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, `provider_series_id` TEXT, `provider_series_key` TEXT 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`, `provider_series_key`), 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": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerSeriesKey",+ "columnName": "provider_series_key",+ "affinity": "TEXT",+ "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",+ "provider_series_key"+ ]+ },+ "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_end_time_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "end_time",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_end_time_channel_id` ON `${TABLE_NAME}` (`provider_id`, `end_time`, `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, `provider_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `group_key` INTEGER NOT NULL, `added_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , 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": "providerId",+ "columnName": "provider_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": "groupKey",+ "columnName": "group_key",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_favorites_provider_id_content_id_content_type_group_key",+ "unique": true,+ "columnNames": [+ "provider_id",+ "content_id",+ "content_type",+ "group_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_provider_id_content_id_content_type_group_key` ON `${TABLE_NAME}` (`provider_id`, `content_id`, `content_type`, `group_key`)"+ },+ {+ "name": "index_favorites_provider_id_content_type_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_provider_id_content_type_group_id` ON `${TABLE_NAME}` (`provider_id`, `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": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "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, `provider_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` 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": "providerId",+ "columnName": "provider_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_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "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`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "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`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `content_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_last_watched_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_last_watched_at` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `last_watched_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "tmdb_identity",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tmdb_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `canonical_provider_id` INTEGER NOT NULL, `first_seen_at` INTEGER NOT NULL, PRIMARY KEY(`tmdb_id`, `content_type`), FOREIGN KEY(`canonical_provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "canonicalProviderId",+ "columnName": "canonical_provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "firstSeenAt",+ "columnName": "first_seen_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "tmdb_id",+ "content_type"+ ]+ },+ "indices": [+ {+ "name": "index_tmdb_identity_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_content_type` ON `${TABLE_NAME}` (`content_type`)"+ },+ {+ "name": "index_tmdb_identity_canonical_provider_id",+ "unique": false,+ "columnNames": [+ "canonical_provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_canonical_provider_id` ON `${TABLE_NAME}` (`canonical_provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "canonical_provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "search_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `content_scope` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `used_at` INTEGER NOT NULL, `use_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "query",+ "columnName": "query",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentScope",+ "columnName": "content_scope",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "usedAt",+ "columnName": "used_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "useCount",+ "columnName": "use_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_search_history_content_scope_provider_id_used_at",+ "unique": false,+ "columnNames": [+ "content_scope",+ "provider_id",+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_content_scope_provider_id_used_at` ON `${TABLE_NAME}` (`content_scope`, `provider_id`, `used_at`)"+ },+ {+ "name": "index_search_history_used_at",+ "unique": false,+ "columnNames": [+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_used_at` ON `${TABLE_NAME}` (`used_at`)"+ },+ {+ "name": "index_search_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_search_history_query_content_scope_provider_id",+ "unique": true,+ "columnNames": [+ "query",+ "content_scope",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_search_history_query_content_scope_provider_id` ON `${TABLE_NAME}` (`query`, `content_scope`, `provider_id`)"+ }+ ]+ },+ {+ "tableName": "sync_metadata",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_live_success` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_series_success` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_epg_success` 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": "lastLiveSuccess",+ "columnName": "last_live_success",+ "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": "lastSeriesSuccess",+ "columnName": "last_series_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSync",+ "columnName": "last_epg_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSuccess",+ "columnName": "last_epg_success",+ "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, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` 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"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "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, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` 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"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "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, `etag` TEXT, `last_modified_header` TEXT)",+ "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+ },+ {+ "fieldPath": "etag",+ "columnName": "etag",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModifiedHeader",+ "columnName": "last_modified_header",+ "affinity": "TEXT"+ }+ ],+ "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, `matched_at` INTEGER NOT NULL, `failed_attempts` INTEGER NOT NULL, `source` TEXT, `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": "matchedAt",+ "columnName": "matched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedAttempts",+ "columnName": "failed_attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "source",+ "columnName": "source",+ "affinity": "TEXT"+ },+ {+ "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"+ ]+ }+ ]+ },+ {+ "tableName": "combined_m3u_profiles",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `enabled` 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": "enabled",+ "columnName": "enabled",+ "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"+ ]+ }+ },+ {+ "tableName": "combined_m3u_profile_members",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `profile_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`profile_id`) REFERENCES `combined_m3u_profiles`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "profileId",+ "columnName": "profile_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_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_combined_m3u_profile_members_profile_id",+ "unique": false,+ "columnNames": [+ "profile_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id` ON `${TABLE_NAME}` (`profile_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_profile_id_provider_id",+ "unique": true,+ "columnNames": [+ "profile_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id_provider_id` ON `${TABLE_NAME}` (`profile_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "combined_m3u_profiles",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "profile_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_schedules",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `requested_start_ms` INTEGER NOT NULL, `requested_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `enabled` INTEGER NOT NULL, `is_manual` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `created_at` 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": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "requestedStartMs",+ "columnName": "requested_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "requestedEndMs",+ "columnName": "requested_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isManual",+ "columnName": "is_manual",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "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_recording_schedules_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_schedules_enabled_requested_start_ms",+ "unique": false,+ "columnNames": [+ "enabled",+ "requested_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_enabled_requested_start_ms` ON `${TABLE_NAME}` (`enabled`, `requested_start_ms`)"+ },+ {+ "name": "index_recording_schedules_recurring_rule_id",+ "unique": false,+ "columnNames": [+ "recurring_rule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_recurring_rule_id` ON `${TABLE_NAME}` (`recurring_rule_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_runs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `schedule_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `scheduled_start_ms` INTEGER NOT NULL, `scheduled_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `status` TEXT NOT NULL, `source_type` TEXT NOT NULL, `resolved_url` TEXT, `headers_json` TEXT NOT NULL, `user_agent` TEXT, `expiration_time` INTEGER, `provider_label` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `bytes_written` INTEGER NOT NULL, `average_throughput_bps` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `last_progress_at_ms` INTEGER, `failure_category` TEXT NOT NULL, `failure_reason` TEXT, `terminal_at_ms` INTEGER, `started_at_ms` INTEGER, `ended_at_ms` INTEGER, `schedule_enabled` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `alarm_start_at_ms` INTEGER, `alarm_stop_at_ms` INTEGER, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`schedule_id`) REFERENCES `recording_schedules`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "scheduleId",+ "columnName": "schedule_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "scheduledStartMs",+ "columnName": "scheduled_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "scheduledEndMs",+ "columnName": "scheduled_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolvedUrl",+ "columnName": "resolved_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "headersJson",+ "columnName": "headers_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "userAgent",+ "columnName": "user_agent",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "expirationTime",+ "columnName": "expiration_time",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "providerLabel",+ "columnName": "provider_label",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputUri",+ "columnName": "output_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDisplayPath",+ "columnName": "output_display_path",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bytesWritten",+ "columnName": "bytes_written",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "averageThroughputBytesPerSecond",+ "columnName": "average_throughput_bps",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryCount",+ "columnName": "retry_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastProgressAtMs",+ "columnName": "last_progress_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "failureCategory",+ "columnName": "failure_category",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureReason",+ "columnName": "failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "terminalAtMs",+ "columnName": "terminal_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "startedAtMs",+ "columnName": "started_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "endedAtMs",+ "columnName": "ended_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "scheduleEnabled",+ "columnName": "schedule_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "alarmStartAtMs",+ "columnName": "alarm_start_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "alarmStopAtMs",+ "columnName": "alarm_stop_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_runs_schedule_id",+ "unique": false,+ "columnNames": [+ "schedule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_schedule_id` ON `${TABLE_NAME}` (`schedule_id`)"+ },+ {+ "name": "index_recording_runs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_runs_status_scheduled_start_ms",+ "unique": false,+ "columnNames": [+ "status",+ "scheduled_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_status_scheduled_start_ms` ON `${TABLE_NAME}` (`status`, `scheduled_start_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_start_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_start_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_start_at_ms` ON `${TABLE_NAME}` (`alarm_start_at_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_stop_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_stop_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_stop_at_ms` ON `${TABLE_NAME}` (`alarm_stop_at_ms`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "recording_schedules",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "schedule_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "program_reminders",+ "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, `channel_name` TEXT NOT NULL, `program_title` TEXT NOT NULL, `program_start_time` INTEGER NOT NULL, `remind_at` INTEGER NOT NULL, `lead_time_minutes` INTEGER NOT NULL, `is_dismissed` INTEGER NOT NULL, `notified_at` INTEGER, `created_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": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programStartTime",+ "columnName": "program_start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remindAt",+ "columnName": "remind_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "leadTimeMinutes",+ "columnName": "lead_time_minutes",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isDismissed",+ "columnName": "is_dismissed",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "notifiedAt",+ "columnName": "notified_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_program_reminders_provider_id_remind_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_remind_at` ON `${TABLE_NAME}` (`provider_id`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_is_dismissed_notified_at_remind_at",+ "unique": false,+ "columnNames": [+ "is_dismissed",+ "notified_at",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_is_dismissed_notified_at_remind_at` ON `${TABLE_NAME}` (`is_dismissed`, `notified_at`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_start_time`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_title_program_start_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_title",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_title_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_title`, `program_start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_storage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tree_uri` TEXT, `display_name` TEXT, `output_directory` TEXT, `available_bytes` INTEGER, `is_writable` INTEGER NOT NULL, `file_name_pattern` TEXT NOT NULL, `retention_days` INTEGER, `max_simultaneous_recordings` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "treeUri",+ "columnName": "tree_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDirectory",+ "columnName": "output_directory",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "availableBytes",+ "columnName": "available_bytes",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "isWritable",+ "columnName": "is_writable",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "fileNamePattern",+ "columnName": "file_name_pattern",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "retentionDays",+ "columnName": "retention_days",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "maxSimultaneousRecordings",+ "columnName": "max_simultaneous_recordings",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "playback_compatibility_records",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `device_fingerprint` TEXT NOT NULL, `device_model` TEXT NOT NULL, `android_sdk` INTEGER NOT NULL, `stream_type` TEXT NOT NULL, `video_mime_type` TEXT NOT NULL, `resolution_bucket` TEXT NOT NULL, `decoder_name` TEXT NOT NULL, `surface_type` TEXT NOT NULL, `failure_type` TEXT NOT NULL, `last_failed_at` INTEGER NOT NULL, `last_succeeded_at` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `success_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deviceFingerprint",+ "columnName": "device_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceModel",+ "columnName": "device_model",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "androidSdk",+ "columnName": "android_sdk",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamType",+ "columnName": "stream_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "videoMimeType",+ "columnName": "video_mime_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolutionBucket",+ "columnName": "resolution_bucket",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "decoderName",+ "columnName": "decoder_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "surfaceType",+ "columnName": "surface_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureType",+ "columnName": "failure_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastFailedAt",+ "columnName": "last_failed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSucceededAt",+ "columnName": "last_succeeded_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "successCount",+ "columnName": "success_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type",+ "unique": true,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket",+ "decoder_name",+ "surface_type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`, `decoder_name`, `surface_type`)"+ },+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket",+ "unique": false,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`)"+ },+ {+ "name": "index_playback_compatibility_records_last_failed_at",+ "unique": false,+ "columnNames": [+ "last_failed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_failed_at` ON `${TABLE_NAME}` (`last_failed_at`)"+ },+ {+ "name": "index_playback_compatibility_records_last_succeeded_at",+ "unique": false,+ "columnNames": [+ "last_succeeded_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_succeeded_at` ON `${TABLE_NAME}` (`last_succeeded_at`)"+ }+ ]+ },+ {+ "tableName": "xtream_content_index",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `remote_id` TEXT NOT NULL, `local_content_id` INTEGER, `name` TEXT NOT NULL, `category_id` INTEGER, `category_name` TEXT, `image_url` TEXT, `container_extension` TEXT, `rating` REAL NOT NULL, `added_at` INTEGER NOT NULL, `remote_updated_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `indexed_at` INTEGER NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `stale_state` TEXT NOT NULL, `error_state` TEXT, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `remote_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": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "remoteId",+ "columnName": "remote_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "localContentId",+ "columnName": "local_content_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteUpdatedAt",+ "columnName": "remote_updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedAt",+ "columnName": "indexed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "staleState",+ "columnName": "stale_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorState",+ "columnName": "error_state",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "remote_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_content_index_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_category_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `category_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_name",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_name` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `name`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_local_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "local_content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_local_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `local_content_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_indexed_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "indexed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_indexed_at` ON `${TABLE_NAME}` (`provider_id`, `indexed_at`)"+ },+ {+ "name": "index_xtream_content_index_stale_state",+ "unique": false,+ "columnNames": [+ "stale_state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_stale_state` ON `${TABLE_NAME}` (`stale_state`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_index_jobs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `section` TEXT NOT NULL, `state` TEXT NOT NULL, `total_categories` INTEGER NOT NULL, `completed_categories` INTEGER NOT NULL, `next_category_index` INTEGER NOT NULL, `failed_categories` INTEGER NOT NULL, `indexed_rows` INTEGER NOT NULL, `skipped_malformed_rows` INTEGER NOT NULL, `deleted_pruned_rows` INTEGER NOT NULL, `priority_category_id` INTEGER, `priority_requested_at` INTEGER NOT NULL, `last_error` TEXT, `last_attempt_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `section`), 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": "section",+ "columnName": "section",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "totalCategories",+ "columnName": "total_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedCategories",+ "columnName": "completed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedCategories",+ "columnName": "failed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedRows",+ "columnName": "indexed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "skippedMalformedRows",+ "columnName": "skipped_malformed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deletedPrunedRows",+ "columnName": "deleted_pruned_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priorityCategoryId",+ "columnName": "priority_category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "priorityRequestedAt",+ "columnName": "priority_requested_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastAttemptAt",+ "columnName": "last_attempt_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "section"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_index_jobs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_index_jobs_section",+ "unique": false,+ "columnNames": [+ "section"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_section` ON `${TABLE_NAME}` (`section`)"+ },+ {+ "name": "index_xtream_index_jobs_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_xtream_index_jobs_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_live_onboarding_state",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `provider_type` TEXT NOT NULL, `content_type` TEXT NOT NULL, `phase` TEXT NOT NULL, `staged_session_id` INTEGER, `import_strategy` TEXT, `next_category_index` INTEGER NOT NULL, `accepted_row_count` INTEGER NOT NULL, `staged_flush_count` INTEGER NOT NULL, `sync_profile_tier` TEXT, `sync_profile_batch_size` INTEGER NOT NULL, `sync_profile_strategy` TEXT, `sync_profile_low_memory` INTEGER NOT NULL, `sync_profile_memory_class_mb` INTEGER NOT NULL, `sync_profile_available_mem_mb` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, 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": "providerType",+ "columnName": "provider_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phase",+ "columnName": "phase",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stagedSessionId",+ "columnName": "staged_session_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "importStrategy",+ "columnName": "import_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "acceptedRowCount",+ "columnName": "accepted_row_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stagedFlushCount",+ "columnName": "staged_flush_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileTier",+ "columnName": "sync_profile_tier",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileBatchSize",+ "columnName": "sync_profile_batch_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileStrategy",+ "columnName": "sync_profile_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileLowMemory",+ "columnName": "sync_profile_low_memory",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileMemoryClassMb",+ "columnName": "sync_profile_memory_class_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileAvailableMemMb",+ "columnName": "sync_profile_available_mem_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_live_onboarding_state_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_phase",+ "unique": false,+ "columnNames": [+ "phase"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_phase` ON `${TABLE_NAME}` (`phase`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_staged_session_id",+ "unique": false,+ "columnNames": [+ "staged_session_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_staged_session_id` ON `${TABLE_NAME}` (`staged_session_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "downloads",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `content_id` INTEGER NOT NULL, `content_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `source_stream_url` TEXT, `source_stream_id` INTEGER, `container_extension` TEXT, `poster_url` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `status` TEXT NOT NULL, `bytes_written` INTEGER NOT NULL, `total_bytes` INTEGER, `supports_resume` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `completed_at` INTEGER, `failure_reason` TEXT, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentName",+ "columnName": "content_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sourceStreamUrl",+ "columnName": "source_stream_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "sourceStreamId",+ "columnName": "source_stream_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputUri",+ "columnName": "output_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDisplayPath",+ "columnName": "output_display_path",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "bytesWritten",+ "columnName": "bytes_written",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalBytes",+ "columnName": "total_bytes",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "supportsResume",+ "columnName": "supports_resume",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryCount",+ "columnName": "retry_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "failureReason",+ "columnName": "failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_downloads_status",+ "unique": false,+ "columnNames": [+ "status"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_status` ON `${TABLE_NAME}` (`status`)"+ },+ {+ "name": "index_downloads_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_downloads_content_type_content_id",+ "unique": false,+ "columnNames": [+ "content_type",+ "content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_content_type_content_id` ON `${TABLE_NAME}` (`content_type`, `content_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, 'd264bd271c35afee323d4f3a16f64b0e')"+ ]+ }+}\ No newline at end of filediff --git a/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.kt b/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.ktindex 3ef01c51..de6263dd 100644--- a/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.kt+++ b/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.kt@@ -6,6 +6,7 @@ import com.streamvault.data.local.dao.ChannelEpgMappingDaoimport com.streamvault.data.local.dao.EpgChannelDaoimport com.streamvault.data.local.dao.EpgProgrammeDaoimport com.streamvault.data.local.dao.ProgramDao+import com.streamvault.data.local.dao.ProviderDaoimport com.streamvault.data.local.dao.ProviderEpgSourceDaoimport com.streamvault.data.local.entity.ChannelEpgMappingEntityimport com.streamvault.data.mapper.toDomain@@ -13,6 +14,7 @@ import com.streamvault.data.mapper.toDomainProgramimport com.streamvault.domain.model.EpgMatchTypeimport com.streamvault.domain.model.EpgResolutionSummaryimport com.streamvault.domain.model.EpgSourceType+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.Programimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.withContext@@ -38,7 +40,8 @@ class EpgResolutionEngine @Inject constructor(private val providerEpgSourceDao: ProviderEpgSourceDao,private val epgChannelDao: EpgChannelDao,private val epgProgrammeDao: EpgProgrammeDao,- private val programDao: ProgramDao+ private val programDao: ProgramDao,+ private val providerDao: ProviderDao) {companion object {private const val TAG = "EpgResolutionEngine"@@ -61,12 +64,20 @@ class EpgResolutionEngine @Inject constructor(): EpgResolutionSummary = withContext(Dispatchers.Default) {val channels = channelDao.getByProviderSync(providerId).filterNot { channel -> channel.categoryId != null && channel.categoryId in hiddenLiveCategoryIds }+ val guideSourcePolicy = providerDao.getById(providerId)?.guideSourcePolicy ?: GuideSourcePolicy.AUTOif (channels.isEmpty()) {channelEpgMappingDao.deleteByProvider(providerId)return@withContext EpgResolutionSummary()}- val enabledAssignments = providerEpgSourceDao.getEnabledForProviderSync(providerId)+ val allowExternalMappings = allowsExternalMappings(guideSourcePolicy)+ val allowProviderNativeMappings = allowsProviderNativeMappings(guideSourcePolicy)++ val enabledAssignments = if (allowExternalMappings) {+ providerEpgSourceDao.getEnabledForProviderSync(providerId)+ } else {+ emptyList()+ }val sourceIds = enabledAssignments.map { it.epgSourceId }// Load all EPG channels from assigned sources in one query@@ -120,7 +131,7 @@ class EpgResolutionEngine @Inject constructor(val existing = existingMappingsByChannel[channel.id]// 1. Check for manual overrideval manual = manualOverrides[channel.id]- if (manual != null) {+ if (manual != null && isMappingAllowed(manual, guideSourcePolicy)) {manualMatches++return@map manual.copy(matchedAt = manual.matchedAt.takeIf { it > 0L } ?: now,@@ -181,7 +192,7 @@ class EpgResolutionEngine @Inject constructor(}// 4. Fall back to provider-native EPG- if (channelEpgId != null && channelEpgId in providerNativeChannelIds) {+ if (allowProviderNativeMappings && channelEpgId != null && channelEpgId in providerNativeChannelIds) {providerNativeMatches++return@map ChannelEpgMappingEntity(providerChannelId = channel.id,@@ -221,7 +232,6 @@ class EpgResolutionEngine @Inject constructor(}channelEpgMappingDao.replaceForProvider(providerId, mappings)- channelDao.backfillEpgIcons(providerId)val summary = EpgResolutionSummary(totalChannels = channels.size,@@ -256,6 +266,8 @@ class EpgResolutionEngine @Inject constructor(endTime: Long): Map<String, List<Program>> = withContext(Dispatchers.IO) {if (channelIds.isEmpty()) return@withContext emptyMap()+ val guideSourcePolicy = providerDao.getById(providerId)?.guideSourcePolicy ?: GuideSourcePolicy.AUTO+ if (guideSourcePolicy == GuideSourcePolicy.DISABLED) return@withContext emptyMap()val mappings = if (channelIds.size <= 500) {channelEpgMappingDao.getForChannels(providerId, channelIds)@@ -263,7 +275,7 @@ class EpgResolutionEngine @Inject constructor(channelIds.chunked(500).flatMap { chunk ->channelEpgMappingDao.getForChannels(providerId, chunk)}- }+ }.filter { mapping -> isMappingAllowed(mapping, guideSourcePolicy) }if (mappings.isEmpty()) return@withContext emptyMap()@@ -312,7 +324,11 @@ class EpgResolutionEngine @Inject constructor(// For PROVIDER type, we don't need to query — the existing ProgramDao path// in EpgRepositoryImpl handles that. But we can include them here for completeness// of the resolved query path.- val providerMappings = mappings.filter { it.sourceType == EpgSourceType.PROVIDER.name && it.xmltvChannelId != null }+ val providerMappings = if (allowsProviderNativeMappings(guideSourcePolicy)) {+ mappings.filter { it.sourceType == EpgSourceType.PROVIDER.name && it.xmltvChannelId != null }+ } else {+ emptyList()+ }if (providerMappings.isNotEmpty()) {val providerXmltvIds = providerMappings.mapNotNull { it.xmltvChannelId }.distinct()val providerPrograms = if (providerXmltvIds.size <= 500) {@@ -344,6 +360,19 @@ class EpgResolutionEngine @Inject constructor(result}+ private fun allowsExternalMappings(policy: GuideSourcePolicy): Boolean =+ policy == GuideSourcePolicy.AUTO || policy == GuideSourcePolicy.EXTERNAL_ONLY++ private fun allowsProviderNativeMappings(policy: GuideSourcePolicy): Boolean =+ policy == GuideSourcePolicy.AUTO || policy == GuideSourcePolicy.PROVIDER_ONLY++ private fun isMappingAllowed(mapping: ChannelEpgMappingEntity, policy: GuideSourcePolicy): Boolean = when (mapping.sourceType) {+ EpgSourceType.EXTERNAL.name -> allowsExternalMappings(policy)+ EpgSourceType.PROVIDER.name -> allowsProviderNativeMappings(policy)+ EpgSourceType.NONE.name -> policy != GuideSourcePolicy.DISABLED+ else -> false+ }+/*** Returns resolution statistics from the persisted mappings.*/diff --git a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.ktindex 8b94cc4e..c7d5697a 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,8 @@ package com.streamvault.data.localimport androidx.room.TypeConverterimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderType@@ -41,6 +43,20 @@ class RoomEnumConverters {fun toProviderEpgSyncMode(value: String?): ProviderEpgSyncMode? =enumValueOrDefault(value, ProviderEpgSyncMode.SKIP, providerEpgSyncModeAliases())+ @TypeConverter+ fun fromGuideSourcePolicy(value: GuideSourcePolicy?): String? = value?.name++ @TypeConverter+ fun toGuideSourcePolicy(value: String?): GuideSourcePolicy? =+ enumValueOrDefault(value, GuideSourcePolicy.AUTO, guideSourcePolicyAliases())++ @TypeConverter+ fun fromChannelLogoSourcePolicy(value: ChannelLogoSourcePolicy?): String? = value?.name++ @TypeConverter+ fun toChannelLogoSourcePolicy(value: String?): ChannelLogoSourcePolicy? =+ enumValueOrDefault(value, ChannelLogoSourcePolicy.SUPPLIER_PREFERRED, channelLogoSourcePolicyAliases())+@TypeConverterfun fromProviderXtreamLiveSyncMode(value: ProviderXtreamLiveSyncMode?): String? = value?.name@@ -151,6 +167,19 @@ class RoomEnumConverters {"STREAM" to ProviderXtreamLiveSyncMode.STREAM_ALL)+ private fun guideSourcePolicyAliases(): Map<String, GuideSourcePolicy> = mapOf(+ "EXTERNAL" to GuideSourcePolicy.EXTERNAL_ONLY,+ "PROVIDER" to GuideSourcePolicy.PROVIDER_ONLY,+ "OFF" to GuideSourcePolicy.DISABLED,+ "NONE" to GuideSourcePolicy.DISABLED+ )++ private fun channelLogoSourcePolicyAliases(): Map<String, ChannelLogoSourcePolicy> = mapOf(+ "SUPPLIER" to ChannelLogoSourcePolicy.SUPPLIER_ONLY,+ "EPG" to ChannelLogoSourcePolicy.EPG_ONLY,+ "EXTERNAL" to ChannelLogoSourcePolicy.EPG_ONLY+ )+private fun contentTypeAliases(): Map<String, ContentType> = mapOf("EPISODE" to ContentType.SERIES_EPISODE,"SHOW" to ContentType.SERIES,diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.ktindex fdbbaa9a..9dacbd6f 100644--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt@@ -50,7 +50,7 @@ import com.streamvault.data.local.entity.*XtreamLiveOnboardingStateEntity::class,DownloadEntity::class],- version = 61,+ version = 62,exportSchema = true // ← was false; schema JSON now tracked in version control)@TypeConverters(RoomEnumConverters::class)@@ -2684,6 +2684,24 @@ abstract class StreamVaultDatabase : RoomDatabase() {}}+ val MIGRATION_61_62 = object : Migration(61, 62) {+ override fun migrate(database: SupportSQLiteDatabase) {+ addColumnIfMissing(+ database,+ tableName = "providers",+ columnName = "guide_source_policy",+ columnDefinition = "TEXT NOT NULL DEFAULT 'AUTO'"+ )+ addColumnIfMissing(+ database,+ tableName = "providers",+ columnName = "channel_logo_source_policy",+ columnDefinition = "TEXT NOT NULL DEFAULT 'SUPPLIER_PREFERRED'"+ )+ validateForeignKeys(database, "providers")+ }+ }+val MIGRATION_52_53 = object : Migration(52, 53) {override fun migrate(database: SupportSQLiteDatabase) {addStalkerHardeningColumns(database, "movie_category_hydration")diff --git a/data/src/main/java/com/streamvault/data/local/dao/Daos.kt b/data/src/main/java/com/streamvault/data/local/dao/Daos.ktindex 41485170..fdf96d7b 100644--- a/data/src/main/java/com/streamvault/data/local/dao/Daos.kt+++ b/data/src/main/java/com/streamvault/data/local/dao/Daos.kt@@ -95,36 +95,48 @@ abstract class ProviderDao {abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId+ ORDER BY c.number ASC""")abstract fun getByProvider(providerId: Long): Flow<List<ChannelBrowseEntity>>@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND error_count = 0- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.error_count = 0+ ORDER BY c.number ASC""")abstract fun getByProviderWithoutErrors(providerId: Long): Flow<List<ChannelBrowseEntity>>@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND error_count = 0- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.error_count = 0+ ORDER BY c.number ASCLIMIT :limit""")@@ -132,12 +144,16 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId+ ORDER BY c.number ASCLIMIT :limit""")@@ -145,12 +161,16 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND category_id = :categoryId- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.category_id = :categoryId+ ORDER BY c.number ASCLIMIT :limit""")@@ -161,36 +181,48 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND category_id = :categoryId- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.category_id = :categoryId+ ORDER BY c.number ASC""")abstract fun getByCategory(providerId: Long, categoryId: Long): Flow<List<ChannelBrowseEntity>>@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND category_id = :categoryId AND error_count = 0- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.category_id = :categoryId AND c.error_count = 0+ ORDER BY c.number ASC""")abstract fun getByCategoryWithoutErrors(providerId: Long, categoryId: Long): Flow<List<ChannelBrowseEntity>>@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND category_id = :categoryId AND error_count = 0- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.category_id = :categoryId AND c.error_count = 0+ ORDER BY c.number ASCLIMIT :limit""")@@ -202,12 +234,16 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId+ ORDER BY c.number ASCLIMIT :limit OFFSET :offset""")@@ -215,12 +251,16 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND error_count = 0- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.error_count = 0+ ORDER BY c.number ASCLIMIT :limit OFFSET :offset""")@@ -228,12 +268,16 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND category_id = :categoryId- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.category_id = :categoryId+ ORDER BY c.number ASCLIMIT :limit OFFSET :offset""")@@ -241,12 +285,16 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND category_id = :categoryId AND error_count = 0- ORDER BY number ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.category_id = :categoryId AND c.error_count = 0+ ORDER BY c.number ASCLIMIT :limit OFFSET :offset""")@@ -259,9 +307,13 @@ abstract class ChannelDao {"""SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,- c.provider_id, c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_countFROM channels c+ JOIN providers p ON p.id = c.provider_idJOIN channels_fts ON c.id = channels_fts.rowid+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_idWHERE c.provider_id = :providerIdAND channels_fts MATCH :queryORDER BY c.name ASC@@ -274,8 +326,12 @@ abstract class ChannelDao {"""SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,- c.provider_id, c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_countFROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_idWHERE c.provider_id = :providerIdAND (LOWER(c.name) LIKE LOWER(:queryLike) ESCAPE '\'@@ -292,9 +348,13 @@ abstract class ChannelDao {"""SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,- c.provider_id, c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_countFROM channels c+ JOIN providers p ON p.id = c.provider_idJOIN channels_fts ON c.id = channels_fts.rowid+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_idWHERE c.provider_id = :providerIdAND c.category_id = :categoryIdAND channels_fts MATCH :query@@ -308,8 +368,12 @@ abstract class ChannelDao {"""SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,- c.provider_id, c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_countFROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_idWHERE c.provider_id = :providerIdAND c.category_id = :categoryIdAND (@@ -326,6 +390,22 @@ abstract class ChannelDao {@Query("SELECT * FROM channels WHERE id = :id")abstract suspend fun getById(id: Long): ChannelEntity?+ @Query(+ """+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.id = :id+ LIMIT 1+ """+ )+ abstract suspend fun getBrowseById(id: Long): ChannelBrowseEntity?+@Query("""SELECT id, stream_id, epg_channel_id@@ -375,35 +455,47 @@ abstract class ChannelDao {@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE id IN (:ids)+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.id IN (:ids)""")abstract fun getByIds(ids: List<Long>): Flow<List<ChannelBrowseEntity>>@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE logical_group_id IN (:logicalGroupIds)- ORDER BY provider_id ASC, number ASC, name ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.logical_group_id IN (:logicalGroupIds)+ ORDER BY c.provider_id ASC, c.number ASC, c.name ASC""")abstract fun getByLogicalGroupIds(logicalGroupIds: List<String>): Flow<List<ChannelBrowseEntity>>@Query("""- SELECT id, stream_id, name, logo_url, group_title, category_id, category_name, stream_url,- epg_channel_id, number, catch_up_supported, catch_up_days, catchUpSource,- provider_id, is_adult, is_user_protected, logical_group_id, error_count- FROM channels- WHERE provider_id = :providerId AND logical_group_id = :logicalGroupId- ORDER BY number ASC, name ASC+ SELECT c.id, c.stream_id, c.name, c.logo_url, c.group_title, c.category_id, c.category_name, c.stream_url,+ c.epg_channel_id, c.number, c.catch_up_supported, c.catch_up_days, c.catchUpSource,+ c.provider_id, p.guide_source_policy, p.channel_logo_source_policy, ec.icon_url AS epg_icon_url,+ c.is_adult, c.is_user_protected, c.logical_group_id, c.error_count+ FROM channels c+ JOIN providers p ON p.id = c.provider_id+ LEFT JOIN channel_epg_mappings cem ON cem.provider_channel_id = c.id AND cem.provider_id = c.provider_id+ LEFT JOIN epg_channels ec ON ec.epg_source_id = cem.epg_source_id AND ec.xmltv_channel_id = cem.xmltv_channel_id+ WHERE c.provider_id = :providerId AND c.logical_group_id = :logicalGroupId+ ORDER BY c.number ASC, c.name ASC""")abstract suspend fun getByLogicalGroupId(providerId: Long, logicalGroupId: String): List<ChannelBrowseEntity>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 f1ed7acc..d5ba355d 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@@ -12,6 +12,8 @@ import com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.StalkerAuthModeimport com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.StalkerCookieModeimport com.streamvault.domain.model.StalkerEndpointPreferenceimport com.streamvault.domain.model.StalkerMagPreset@@ -67,6 +69,8 @@ data class ProviderEntity(@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 = "guide_source_policy") val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ @ColumnInfo(name = "channel_logo_source_policy") val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,@ColumnInfo(name = "xtream_fast_sync_enabled") val xtreamFastSyncEnabled: Boolean = false,@ColumnInfo(name = "xtream_live_sync_mode") val xtreamLiveSyncMode: ProviderXtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO,@ColumnInfo(name = "m3u_vod_classification_enabled") val m3uVodClassificationEnabled: Boolean = false,@@ -130,6 +134,9 @@ data class ChannelBrowseEntity(@ColumnInfo(name = "catch_up_days") val catchUpDays: Int = 0,val catchUpSource: String? = null,@ColumnInfo(name = "provider_id") val providerId: Long = 0,+ @ColumnInfo(name = "guide_source_policy") val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ @ColumnInfo(name = "channel_logo_source_policy") val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,+ @ColumnInfo(name = "epg_icon_url") val epgIconUrl: String? = null,@ColumnInfo(name = "is_adult") val isAdult: Boolean = false,@ColumnInfo(name = "is_user_protected") val isUserProtected: Boolean = false,@ColumnInfo(name = "logical_group_id") val logicalGroupId: String = "",diff --git a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.ktindex 0e3ba3d4..fac5c50f 100644--- a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt+++ b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt@@ -1126,7 +1126,7 @@ private fun Iterable<ProviderEntity>.findMatchingProvider(}private const val SHA256_PREFIX = "sha256:"-private const val CURRENT_BACKUP_VERSION = 7+private const val CURRENT_BACKUP_VERSION = 8private const val FILE_URI_SCHEME = "file"private val MAP_STRING_STRING_TYPE: Type = object : TypeToken<Map<String, String>>() {}.typeprivate val PROVIDER_LIST_TYPE: Type = object : TypeToken<List<com.streamvault.domain.model.Provider>>() {}.typediff --git a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.ktindex c0e4c166..6a56ddf5 100644--- a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt+++ b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt@@ -57,6 +57,8 @@ fun ProviderEntity.toDomain() = Provider(apiVersion = apiVersion,allowedOutputFormats = decodeAllowedOutputFormats(allowedOutputFormatsJson),epgSyncMode = epgSyncMode,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,xtreamFastSyncEnabled = xtreamFastSyncEnabled,xtreamLiveSyncMode = xtreamLiveSyncMode,m3uVodClassificationEnabled = m3uVodClassificationEnabled,@@ -107,6 +109,8 @@ fun Provider.toEntity() = ProviderEntity(apiVersion = apiVersion,allowedOutputFormatsJson = encodeAllowedOutputFormats(allowedOutputFormats),epgSyncMode = epgSyncMode,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,xtreamFastSyncEnabled = xtreamFastSyncEnabled,xtreamLiveSyncMode = xtreamLiveSyncMode,m3uVodClassificationEnabled = m3uVodClassificationEnabled,diff --git a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.ktindex 264f98bc..f13d0e6d 100644--- a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt@@ -7,7 +7,6 @@ import com.streamvault.data.local.dao.ChannelDaoimport com.streamvault.data.local.dao.FavoriteDaoimport com.streamvault.data.local.entity.CategoryEntityimport com.streamvault.data.local.entity.ChannelBrowseEntity-import com.streamvault.data.local.entity.ChannelEntityimport com.streamvault.data.local.entity.CategoryCountimport com.streamvault.data.mapper.toDomainimport com.streamvault.data.preferences.PreferencesRepository@@ -15,6 +14,7 @@ import com.streamvault.data.remote.xtream.XtreamStreamUrlResolverimport com.streamvault.data.util.rankSearchResultsimport com.streamvault.data.util.toFtsPrefixQueryimport com.streamvault.domain.model.Category+import com.streamvault.domain.model.ChannelLogoSourcePolicyimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.ChannelQualityOption@@ -232,14 +232,14 @@ class ChannelRepositoryImpl @Inject constructor(// look up a specific channel by id (e.g. HiddenChannelsDialog resolves the// hidden set back to Channel objects), they must not be gated by visibility.override suspend fun getChannel(channelId: Long): Channel? {- val entity = channelDao.getById(channelId) ?: return null+ val entity = channelDao.getBrowseById(channelId) ?: return nullval settings = currentPresentationSettings()val observation = settings.observedQualities[channelId]if (settings.groupingMode == LiveChannelGroupingMode.RAW_VARIANTS || entity.logicalGroupId.isBlank()) {return entity.toPresentedRawChannel(observation)}val groupedEntities = channelDao.getByLogicalGroupId(entity.providerId, entity.logicalGroupId)- .ifEmpty { listOf(entity.toBrowseEntity()) }+ .ifEmpty { listOf(entity) }return buildGroupedChannels(groupedEntities, settings).firstOrNull()}@@ -511,7 +511,7 @@ class ChannelRepositoryImpl @Inject constructor(id = selectedVariant.rawChannelId,name = displayName,canonicalName = canonicalName,- logoUrl = representative.logoUrl,+ logoUrl = representative.resolveLogoUrl(),groupTitle = representative.groupTitle,categoryId = representative.categoryId,categoryName = representative.categoryName,@@ -809,7 +809,7 @@ class ChannelRepositoryImpl @Inject constructor(id = id,name = name,canonicalName = variant.canonicalName,- logoUrl = logoUrl,+ logoUrl = resolveLogoUrl(),groupTitle = groupTitle,categoryId = categoryId,categoryName = categoryName,@@ -833,39 +833,14 @@ class ChannelRepositoryImpl @Inject constructor()}- private fun ChannelEntity.toPresentedRawChannel(- observedQuality: LiveChannelObservedQuality?- ): Channel {- val domain = toDomain()- val variant = toBrowseEntity().toVariant(observedQuality)- return domain.copy(- canonicalName = variant.canonicalName,- logicalGroupId = logicalGroupId.takeIf(String::isNotBlank) ?: variant.logicalGroupId,- selectedVariantId = id,- variants = listOf(variant),- alternativeStreams = domain.alternativeStreams.distinct()- )+ private fun ChannelBrowseEntity.resolveLogoUrl(): String? {+ val supplierLogo = logoUrl?.takeIf { it.isNotBlank() }+ val epgLogo = epgIconUrl?.takeIf { it.isNotBlank() }+ return when (channelLogoSourcePolicy) {+ ChannelLogoSourcePolicy.SUPPLIER_PREFERRED -> supplierLogo ?: epgLogo+ ChannelLogoSourcePolicy.EPG_PREFERRED -> epgLogo ?: supplierLogo+ ChannelLogoSourcePolicy.SUPPLIER_ONLY -> supplierLogo+ ChannelLogoSourcePolicy.EPG_ONLY -> epgLogo+ }}-- private fun ChannelEntity.toBrowseEntity(): ChannelBrowseEntity =- ChannelBrowseEntity(- id = id,- streamId = streamId,- name = name,- logoUrl = logoUrl,- groupTitle = groupTitle,- categoryId = categoryId,- categoryName = categoryName,- streamUrl = streamUrl,- epgChannelId = epgChannelId,- number = number,- catchUpSupported = catchUpSupported,- catchUpDays = catchUpDays,- catchUpSource = catchUpSource,- providerId = providerId,- isAdult = isAdult,- isUserProtected = isUserProtected,- logicalGroupId = logicalGroupId,- errorCount = errorCount- )}diff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex dbaba7cd..ad0854f5 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -177,6 +177,8 @@ class ProviderRepositoryImpl @Inject constructor(xtreamFastSyncEnabled: Boolean,epgSyncMode: ProviderEpgSyncMode,xtreamLiveSyncMode: com.streamvault.domain.model.ProviderXtreamLiveSyncMode,+ guideSourcePolicy: GuideSourcePolicy,+ channelLogoSourcePolicy: ChannelLogoSourcePolicy,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> {@@ -232,6 +234,8 @@ class ProviderRepositoryImpl @Inject constructor(httpHeaders = httpHeaders,epgSyncMode = epgSyncMode,xtreamLiveSyncMode = xtreamLiveSyncMode,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,xtreamFastSyncEnabled = false,isActive = false,status = ProviderStatus.PARTIAL,@@ -247,6 +251,8 @@ class ProviderRepositoryImpl @Inject constructor(httpHeaders = httpHeaders,epgSyncMode = epgSyncMode,xtreamLiveSyncMode = xtreamLiveSyncMode,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,xtreamFastSyncEnabled = false,isActive = false,status = ProviderStatus.PARTIAL@@ -278,6 +284,8 @@ class ProviderRepositoryImpl @Inject constructor(httpHeaders: String,epgSyncMode: ProviderEpgSyncMode,m3uVodClassificationEnabled: Boolean,+ guideSourcePolicy: GuideSourcePolicy,+ channelLogoSourcePolicy: ChannelLogoSourcePolicy,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> = try {@@ -316,6 +324,8 @@ class ProviderRepositoryImpl @Inject constructor(httpHeaders = httpHeaders,epgSyncMode = epgSyncMode,m3uVodClassificationEnabled = m3uVodClassificationEnabled,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,isActive = false,status = ProviderStatus.PARTIAL,lastSyncedAt = 0@@ -332,6 +342,8 @@ class ProviderRepositoryImpl @Inject constructor(httpHeaders = httpHeaders,epgSyncMode = epgSyncMode,m3uVodClassificationEnabled = m3uVodClassificationEnabled,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,isActive = false,status = ProviderStatus.PARTIAL)@@ -481,6 +493,8 @@ class ProviderRepositoryImpl @Inject constructor(signature: String,stalkerAdvancedOptionsJson: String,epgSyncMode: ProviderEpgSyncMode,+ guideSourcePolicy: GuideSourcePolicy,+ channelLogoSourcePolicy: ChannelLogoSourcePolicy,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> {@@ -572,6 +586,8 @@ class ProviderRepositoryImpl @Inject constructor(stalkerAdvancedOptionsJson = normalizedAdvancedOptionsJson,epgUrl = existingProvider.epgUrl,epgSyncMode = epgSyncMode,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,xtreamFastSyncEnabled = false,m3uVodClassificationEnabled = false,isActive = false,@@ -599,6 +615,8 @@ class ProviderRepositoryImpl @Inject constructor(stalkerSignature = normalizedSignature,stalkerAdvancedOptionsJson = normalizedAdvancedOptionsJson,epgSyncMode = epgSyncMode,+ guideSourcePolicy = guideSourcePolicy,+ channelLogoSourcePolicy = channelLogoSourcePolicy,xtreamFastSyncEnabled = false,m3uVodClassificationEnabled = false,isActive = false,@@ -741,6 +759,9 @@ class ProviderRepositoryImpl @Inject constructor(): Result<List<Program>> {val providerEntity = providerDao.getById(providerId)?: return Result.error("Provider $providerId not found")+ if (!allowsOnDemandGuide(providerEntity.toPublicDomain())) {+ return Result.error("On-demand guide lookup is disabled for this provider.")+ }return when (providerEntity.type) {ProviderType.XTREAM_CODES -> when (val providerContextResult = createXtreamLiveProgramProviderContext(providerId)) {is Result.Success -> {@@ -794,6 +815,11 @@ class ProviderRepositoryImpl @Inject constructor(val providerEntity = providerDao.getById(providerId)?: return normalizedRequests.associateWith { Result.error("Provider $providerId not found") }+ if (!allowsOnDemandGuide(providerEntity.toPublicDomain())) {+ return normalizedRequests.associateWith {+ Result.error("On-demand guide lookup is disabled for this provider.")+ }+ }return when (providerEntity.type) {ProviderType.XTREAM_CODES -> when (val providerContextResult = createXtreamLiveProgramProviderContext(providerId)) {@@ -1165,6 +1191,13 @@ class ProviderRepositoryImpl @Inject constructor()syncMetadataRepository.updateMetadata(metadata)}++ private fun allowsOnDemandGuide(provider: Provider): Boolean = when (provider.guideSourcePolicy) {+ GuideSourcePolicy.AUTO,+ GuideSourcePolicy.PROVIDER_ONLY -> true+ GuideSourcePolicy.EXTERNAL_ONLY,+ GuideSourcePolicy.DISABLED -> provider.type != ProviderType.XTREAM_CODES && provider.type != ProviderType.STALKER_PORTAL+ }}internal fun buildM3uCatchUpUrls(source: String, start: Long, end: Long): List<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 de47618e..b9ed9a4b 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt@@ -52,6 +52,7 @@ import com.streamvault.data.security.CredentialCryptoimport com.streamvault.data.util.AdultContentClassifierimport com.streamvault.data.util.UrlSecurityPolicyimport com.streamvault.domain.model.Channel+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.Movieimport com.streamvault.domain.model.ProviderEpgSyncMode@@ -4201,10 +4202,13 @@ class SyncManager @Inject constructor(val warnings = mutableListOf<String>()var hasRetryableFailure = falseval hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()+ val guidePolicy = provider.guideSourcePolicywhen (provider.type) {ProviderType.XTREAM_CODES -> {- if (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSuccess, ContentCachePolicy.EPG_TTL_MILLIS, now)) {+ if (shouldUseProviderGuide(guidePolicy) &&+ (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSuccess, ContentCachePolicy.EPG_TTL_MILLIS, now))+ ) {try {progress(provider.id, onProgress, "Downloading EPG...")val base = provider.serverUrl.trimEnd('/')@@ -4225,21 +4229,24 @@ class SyncManager @Inject constructor()syncMetadataRepository.updateMetadata(updatedMetadata)if (epgCount == 0) {- warnings.add("EPG imported zero programs; live guide will fall back to on-demand Xtream data.")+ warnings.add("EPG imported zero programs; live guide may require provider fallback.")}} catch (e: CancellationException) {throw e} catch (e: Exception) {Log.e(TAG, "EPG sync failed (non-fatal): ${sanitizeThrowableMessage(e)}")if (isRetryableEpgException(e)) hasRetryableFailure = true- warnings.add("EPG XMLTV sync failed; live guide will fall back to on-demand Xtream data.")+ warnings.add("EPG XMLTV sync failed.")}}}ProviderType.M3U -> {val currentEpgUrl = providerDao.getById(provider.id)?.epgUrl ?: provider.epgUrl- if (!currentEpgUrl.isNullOrBlank() && (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSuccess, ContentCachePolicy.EPG_TTL_MILLIS, now))) {+ if (shouldUseProviderGuide(guidePolicy) &&+ !currentEpgUrl.isNullOrBlank() &&+ (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSuccess, ContentCachePolicy.EPG_TTL_MILLIS, now))+ ) {val epgValidationError = UrlSecurityPolicy.validateOptionalEpgUrl(currentEpgUrl)if (epgValidationError != null) {warnings.add(epgValidationError)@@ -4267,7 +4274,9 @@ class SyncManager @Inject constructor(}ProviderType.STALKER_PORTAL -> {- if (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSuccess, ContentCachePolicy.EPG_TTL_MILLIS, now)) {+ if (shouldUseProviderGuide(guidePolicy) &&+ (force || ContentCachePolicy.shouldRefresh(updatedMetadata.lastEpgSuccess, ContentCachePolicy.EPG_TTL_MILLIS, now))+ ) {val stalkerEpgWarnings = syncStalkerPreferredEpg(provider = provider,now = now,@@ -4284,22 +4293,30 @@ class SyncManager @Inject constructor(ProviderType.JELLYFIN -> Unit}- try {- progress(provider.id, onProgress, "Refreshing external EPG sources...")- retryTransient {- requireResult(- epgSourceRepository.refreshAllForProvider(provider.id),- "External EPG source refresh failed"- )+ if (shouldUseExternalGuide(guidePolicy)) {+ try {+ progress(provider.id, onProgress, "Refreshing external EPG sources...")+ retryTransient {+ requireResult(+ epgSourceRepository.refreshAllForProvider(provider.id),+ "External EPG source refresh failed"+ )+ }+ progress(provider.id, onProgress, "Resolving EPG mappings...")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ } catch (e: CancellationException) {+ throw e+ } catch (e: Exception) {+ Log.e(TAG, "External EPG resolution failed (non-fatal): ${sanitizeThrowableMessage(e)}")+ if (isRetryableEpgException(e)) hasRetryableFailure = true+ warnings.add("External EPG source refresh/resolution failed.")}- progress(provider.id, onProgress, "Resolving EPG mappings...")+ } else if (guidePolicy == GuideSourcePolicy.DISABLED) {+ progress(provider.id, onProgress, "Guide data disabled for this provider.")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ } else {+ progress(provider.id, onProgress, "Resolving provider EPG mappings...")epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)- } catch (e: CancellationException) {- throw e- } catch (e: Exception) {- Log.e(TAG, "External EPG resolution failed (non-fatal): ${sanitizeThrowableMessage(e)}")- if (isRetryableEpgException(e)) hasRetryableFailure = true- warnings.add("External EPG source refresh/resolution failed.")}return EpgSyncResult(warnings = warnings, hasRetryableFailure = hasRetryableFailure)@@ -4311,21 +4328,35 @@ class SyncManager @Inject constructor() {progress(provider.id, onProgress, "Retrying EPG...")val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()+ val guidePolicy = provider.guideSourcePolicy+ if (guidePolicy == GuideSourcePolicy.DISABLED) {+ progress(provider.id, onProgress, "Guide data disabled for this provider.")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ return+ }if (provider.type == ProviderType.STALKER_PORTAL) {- syncStalkerPreferredEpg(- provider = provider,- now = System.currentTimeMillis(),- onProgress = onProgress- )- progress(provider.id, onProgress, "Refreshing external EPG sources...")- retryTransient {- requireResult(- epgSourceRepository.refreshAllForProvider(provider.id),- "External EPG source refresh failed"+ if (shouldUseProviderGuide(guidePolicy)) {+ syncStalkerPreferredEpg(+ provider = provider,+ now = System.currentTimeMillis(),+ onProgress = onProgress)}- progress(provider.id, onProgress, "Resolving EPG mappings...")- epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ if (shouldUseExternalGuide(guidePolicy)) {+ progress(provider.id, onProgress, "Refreshing external EPG sources...")+ retryTransient {+ requireResult(+ epgSourceRepository.refreshAllForProvider(provider.id),+ "External EPG source refresh failed"+ )+ }+ progress(provider.id, onProgress, "Resolving EPG mappings...")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ }+ if (!shouldUseExternalGuide(guidePolicy)) {+ progress(provider.id, onProgress, "Resolving provider EPG mappings...")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ }return}val epgUrl = when (provider.type) {@@ -4339,8 +4370,8 @@ class SyncManager @Inject constructor(ProviderType.STALKER_PORTAL -> providerDao.getById(provider.id)?.epgUrl ?: provider.epgUrlProviderType.JELLYFIN -> ""}- if (epgUrl.isBlank()) {- if (provider.type == ProviderType.STALKER_PORTAL) {+ if (!shouldUseProviderGuide(guidePolicy)) {+ if (shouldUseExternalGuide(guidePolicy)) {progress(provider.id, onProgress, "Refreshing external EPG sources...")retryTransient {requireResult(@@ -4350,8 +4381,10 @@ class SyncManager @Inject constructor(}progress(provider.id, onProgress, "Resolving EPG mappings...")epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)- return}+ return+ }+ if (epgUrl.isBlank()) {throw IllegalStateException("No EPG URL configured for this provider")}val validationError = when (provider.type) {@@ -4376,15 +4409,20 @@ class SyncManager @Inject constructor(syncMetadataRepository.updateMetadata(metadata)// Also refresh external sources and run resolution- progress(provider.id, onProgress, "Refreshing external EPG sources...")- retryTransient {- requireResult(- epgSourceRepository.refreshAllForProvider(provider.id),- "External EPG source refresh failed"- )+ if (shouldUseExternalGuide(guidePolicy)) {+ progress(provider.id, onProgress, "Refreshing external EPG sources...")+ retryTransient {+ requireResult(+ epgSourceRepository.refreshAllForProvider(provider.id),+ "External EPG source refresh failed"+ )+ }+ progress(provider.id, onProgress, "Resolving EPG mappings...")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)+ } else {+ progress(provider.id, onProgress, "Resolving provider EPG mappings...")+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)}- progress(provider.id, onProgress, "Resolving EPG mappings...")- epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)}private suspend fun syncStalkerPreferredEpg(@@ -5870,6 +5908,12 @@ class SyncManager @Inject constructor(private fun isStalkerEmptyResponse(message: String?): Boolean =!message.isNullOrBlank() && message.contains("empty response", ignoreCase = true)+ private fun shouldUseProviderGuide(policy: GuideSourcePolicy): Boolean =+ policy == GuideSourcePolicy.AUTO || policy == GuideSourcePolicy.PROVIDER_ONLY++ private fun shouldUseExternalGuide(policy: GuideSourcePolicy): Boolean =+ policy == GuideSourcePolicy.AUTO || policy == GuideSourcePolicy.EXTERNAL_ONLY+private fun StalkerProviderProfile.hasLikelyMissingCatalogAccess(): Boolean {val normalizedAccountId = accountId?.trim().orEmpty()val normalizedAccountName = accountName?.trim().orEmpty()diff --git a/data/src/test/java/com/streamvault/data/epg/EpgResolutionEngineTest.kt b/data/src/test/java/com/streamvault/data/epg/EpgResolutionEngineTest.ktindex 1c58c95c..bfb26c5f 100644--- a/data/src/test/java/com/streamvault/data/epg/EpgResolutionEngineTest.kt+++ b/data/src/test/java/com/streamvault/data/epg/EpgResolutionEngineTest.kt@@ -6,6 +6,7 @@ import com.streamvault.data.local.dao.ChannelEpgMappingDaoimport com.streamvault.data.local.dao.EpgChannelDaoimport com.streamvault.data.local.dao.EpgProgrammeDaoimport com.streamvault.data.local.dao.ProgramDao+import com.streamvault.data.local.dao.ProviderDaoimport com.streamvault.data.local.dao.ProviderEpgSourceDaoimport com.streamvault.data.local.entity.ChannelEntityimport com.streamvault.data.local.entity.ChannelEpgMappingEntity@@ -13,9 +14,12 @@ import com.streamvault.data.local.entity.ChannelGuideLookupEntityimport com.streamvault.data.local.entity.EpgChannelEntityimport com.streamvault.data.local.entity.EpgProgrammeEntityimport com.streamvault.data.local.entity.ProgramBrowseEntity+import com.streamvault.data.local.entity.ProviderEntityimport com.streamvault.data.local.entity.ProviderEpgSourceEntityimport com.streamvault.domain.model.EpgMatchTypeimport com.streamvault.domain.model.EpgSourceType+import com.streamvault.domain.model.GuideSourcePolicy+import com.streamvault.domain.model.ProviderTypeimport kotlinx.coroutines.test.runTestimport org.junit.Beforeimport org.junit.Test@@ -33,6 +37,7 @@ class EpgResolutionEngineTest {private val epgChannelDao: EpgChannelDao = mock()private val epgProgrammeDao: EpgProgrammeDao = mock()private val programDao: ProgramDao = mock()+ private val providerDao: ProviderDao = mock()private lateinit var engine: EpgResolutionEngine@@ -46,6 +51,7 @@ class EpgResolutionEngineTest {fun setup() {runTest {whenever(programDao.getChannelIdsWithPrograms(any(), any())).thenReturn(emptyList())+ whenever(providerDao.getById(any())).thenReturn(makeProvider())}engine = EpgResolutionEngine(channelDao = channelDao,@@ -53,7 +59,8 @@ class EpgResolutionEngineTest {providerEpgSourceDao = providerEpgSourceDao,epgChannelDao = epgChannelDao,epgProgrammeDao = epgProgrammeDao,- programDao = programDao+ programDao = programDao,+ providerDao = providerDao)}@@ -308,6 +315,41 @@ class EpgResolutionEngineTest {assertThat(mappings.getValue(2L).sourceType).isEqualTo(EpgSourceType.NONE.name)}+ @Test+ fun `resolveForProvider_providerOnly_replaces_stale_external_mapping_with_provider_mapping`() = runTest {+ whenever(providerDao.getById(PROVIDER_ID)).thenReturn(+ makeProvider(guideSourcePolicy = GuideSourcePolicy.PROVIDER_ONLY)+ )+ val channel = makeChannel(id = 1, name = "Local One", epgChannelId = "local.one")+ whenever(channelDao.getByProviderSync(PROVIDER_ID)).thenReturn(listOf(channel))+ whenever(providerEpgSourceDao.getEnabledForProviderSync(PROVIDER_ID)).thenReturn(emptyList())+ whenever(channelEpgMappingDao.getForProvider(PROVIDER_ID)).thenReturn(+ listOf(+ ChannelEpgMappingEntity(+ id = 1,+ providerChannelId = 1,+ providerId = PROVIDER_ID,+ sourceType = EpgSourceType.EXTERNAL.name,+ epgSourceId = SOURCE_1,+ xmltvChannelId = "external.one",+ matchType = EpgMatchType.MANUAL.name,+ confidence = 1.0f,+ isManualOverride = true,+ updatedAt = 1000L+ )+ )+ )+ whenever(programDao.getChannelIdsWithPrograms(PROVIDER_ID, listOf("local.one"))).thenReturn(listOf("local.one"))++ engine.resolveForProvider(PROVIDER_ID)++ val captor = argumentCaptor<List<ChannelEpgMappingEntity>>()+ verify(channelEpgMappingDao).replaceForProvider(any(), captor.capture())+ val mapping = captor.firstValue.single()+ assertThat(mapping.sourceType).isEqualTo(EpgSourceType.PROVIDER.name)+ assertThat(mapping.xmltvChannelId).isEqualTo("local.one")+ }+// ── getResolvedProgrammes ──────────────────────────────────────@Test@@ -383,6 +425,45 @@ class EpgResolutionEngineTest {assertThat(result).isEmpty()}+ @Test+ fun `getResolvedProgrammes_providerOnly_ignores_stale_external_mapping`() = runTest {+ val now = System.currentTimeMillis()+ whenever(providerDao.getById(PROVIDER_ID)).thenReturn(+ makeProvider(guideSourcePolicy = GuideSourcePolicy.PROVIDER_ONLY)+ )+ whenever(channelEpgMappingDao.getForChannels(PROVIDER_ID, listOf(1L))).thenReturn(+ listOf(+ ChannelEpgMappingEntity(+ id = 1,+ providerChannelId = 1,+ providerId = PROVIDER_ID,+ sourceType = EpgSourceType.EXTERNAL.name,+ epgSourceId = SOURCE_1,+ xmltvChannelId = "external.one",+ matchType = EpgMatchType.EXACT_ID.name,+ confidence = 1.0f,+ updatedAt = now+ )+ )+ )++ val result = engine.getResolvedProgrammes(PROVIDER_ID, listOf(1L), now - 3600_000, now + 3600_000)++ assertThat(result).isEmpty()+ }++ @Test+ fun `getResolvedProgrammes_disabled_ignores_all_mappings`() = runTest {+ val now = System.currentTimeMillis()+ whenever(providerDao.getById(PROVIDER_ID)).thenReturn(+ makeProvider(guideSourcePolicy = GuideSourcePolicy.DISABLED)+ )++ val result = engine.getResolvedProgrammes(PROVIDER_ID, listOf(1L), now - 3600_000, now + 3600_000)++ assertThat(result).isEmpty()+ }+// ── Helpers ────────────────────────────────────────────────────private fun makeChannel(@@ -407,4 +488,14 @@ class EpgResolutionEngineTest {streamId = streamId,epgChannelId = epgChannelId)++ private fun makeProvider(+ guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO+ ) = ProviderEntity(+ id = PROVIDER_ID,+ name = "Provider",+ type = ProviderType.XTREAM_CODES,+ serverUrl = "http://example.com",+ guideSourcePolicy = guideSourcePolicy+ )}diff --git a/data/src/test/java/com/streamvault/data/local/RoomEnumConvertersTest.kt b/data/src/test/java/com/streamvault/data/local/RoomEnumConvertersTest.ktindex 796188ac..015df021 100644--- a/data/src/test/java/com/streamvault/data/local/RoomEnumConvertersTest.kt+++ b/data/src/test/java/com/streamvault/data/local/RoomEnumConvertersTest.kt@@ -1,7 +1,9 @@package com.streamvault.data.localimport com.google.common.truth.Truth.assertThat+import com.streamvault.domain.model.ChannelLogoSourcePolicyimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderType@@ -15,6 +17,8 @@ class RoomEnumConvertersTest {assertThat(converters.toProviderType("legacy_xtream")).isEqualTo(ProviderType.M3U)assertThat(converters.toProviderStatus("legacy_status")).isEqualTo(ProviderStatus.UNKNOWN)assertThat(converters.toProviderEpgSyncMode("legacy_mode")).isEqualTo(ProviderEpgSyncMode.SKIP)+ assertThat(converters.toGuideSourcePolicy("legacy_guide_policy")).isEqualTo(GuideSourcePolicy.AUTO)+ assertThat(converters.toChannelLogoSourcePolicy("legacy_logo_policy")).isEqualTo(ChannelLogoSourcePolicy.SUPPLIER_PREFERRED)assertThat(converters.toContentType("legacy_content")).isEqualTo(ContentType.LIVE)}@@ -23,6 +27,8 @@ class RoomEnumConvertersTest {assertThat(converters.toProviderType("xtream")).isEqualTo(ProviderType.XTREAM_CODES)assertThat(converters.toProviderType("stb")).isEqualTo(ProviderType.STALKER_PORTAL)assertThat(converters.toProviderEpgSyncMode("disabled")).isEqualTo(ProviderEpgSyncMode.SKIP)+ assertThat(converters.toGuideSourcePolicy("external")).isEqualTo(GuideSourcePolicy.EXTERNAL_ONLY)+ assertThat(converters.toChannelLogoSourcePolicy("epg")).isEqualTo(ChannelLogoSourcePolicy.EPG_ONLY)assertThat(converters.toContentType("episode")).isEqualTo(ContentType.SERIES_EPISODE)}@@ -31,6 +37,8 @@ class RoomEnumConvertersTest {assertThat(converters.toProviderType(null)).isNull()assertThat(converters.toProviderStatus("active")).isEqualTo(ProviderStatus.ACTIVE)assertThat(converters.toProviderEpgSyncMode("background")).isEqualTo(ProviderEpgSyncMode.BACKGROUND)+ assertThat(converters.toGuideSourcePolicy("provider_only")).isEqualTo(GuideSourcePolicy.PROVIDER_ONLY)+ assertThat(converters.toChannelLogoSourcePolicy("supplier_preferred")).isEqualTo(ChannelLogoSourcePolicy.SUPPLIER_PREFERRED)assertThat(converters.toContentType("series_episode")).isEqualTo(ContentType.SERIES_EPISODE)}-}\ No newline at end of file+}diff --git a/data/src/test/java/com/streamvault/data/repository/ChannelRepositoryImplTest.kt b/data/src/test/java/com/streamvault/data/repository/ChannelRepositoryImplTest.ktindex 8f820342..0564656e 100644--- a/data/src/test/java/com/streamvault/data/repository/ChannelRepositoryImplTest.kt+++ b/data/src/test/java/com/streamvault/data/repository/ChannelRepositoryImplTest.kt@@ -11,6 +11,7 @@ import com.streamvault.data.local.entity.CategoryEntityimport com.streamvault.data.preferences.PreferencesRepositoryimport com.streamvault.data.remote.xtream.XtreamStreamUrlResolverimport com.streamvault.domain.manager.ParentalControlManager+import com.streamvault.domain.model.ChannelLogoSourcePolicyimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.GroupedChannelLabelMode@@ -326,6 +327,29 @@ class ChannelRepositoryImplTest {assertThat(result.map { it.number }).containsExactly(61, 62).inOrder()}+ @Test+ fun `getChannel applies epg only logo policy for raw channel lookup`() = runTest {+ whenever(channelDao.getBrowseById(99L)).thenReturn(+ ChannelBrowseEntity(+ id = 99L,+ streamId = 199L,+ name = "News One",+ logoUrl = "https://supplier.example/logo.png",+ streamUrl = "https://stream/news",+ number = 9,+ providerId = 7L,+ channelLogoSourcePolicy = ChannelLogoSourcePolicy.EPG_ONLY,+ epgIconUrl = "https://epg.example/icon.png"+ )+ )++ val repository = createRepository()++ val result = repository.getChannel(99L)++ assertThat(result?.logoUrl).isEqualTo("https://epg.example/icon.png")+ }+@Testfun `searchChannels returns empty list when sqlite throws for malformed fts query`() = runTest {whenever(channelDao.search(eq(7L), any(), any())).thenReturn(diff --git a/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt b/domain/src/main/java/com/streamvault/domain/manager/BackupManager.ktindex 4632eff0..bee3ddf4 100644--- a/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt+++ b/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt@@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.Flowimport com.streamvault.domain.model.Resultdata class BackupData(- val version: Int = 7,+ val version: Int = 8,val checksum: String? = null,val preferences: Map<String, String>? = null,val providers: List<Provider>? = null,diff --git a/domain/src/main/java/com/streamvault/domain/model/Provider.kt b/domain/src/main/java/com/streamvault/domain/model/Provider.ktindex 238ad11a..d66b959d 100644--- a/domain/src/main/java/com/streamvault/domain/model/Provider.kt+++ b/domain/src/main/java/com/streamvault/domain/model/Provider.kt@@ -42,6 +42,8 @@ data class Provider(val apiVersion: String? = null,val allowedOutputFormats: List<String> = emptyList(),val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,+ val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,val xtreamFastSyncEnabled: Boolean = true,val xtreamLiveSyncMode: ProviderXtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO,val m3uVodClassificationEnabled: Boolean = false,@@ -72,6 +74,20 @@ enum class ProviderEpgSyncMode {SKIP}+enum class GuideSourcePolicy {+ AUTO,+ EXTERNAL_ONLY,+ PROVIDER_ONLY,+ DISABLED+}++enum class ChannelLogoSourcePolicy {+ SUPPLIER_PREFERRED,+ EPG_PREFERRED,+ SUPPLIER_ONLY,+ EPG_ONLY+}+enum class ProviderXtreamLiveSyncMode {AUTO,CATEGORY_BY_CATEGORY,diff --git a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.ktindex 030fbf44..3ddfbd0f 100644--- a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt@@ -1,6 +1,8 @@package com.streamvault.domain.repositoryimport com.streamvault.domain.manager.ProviderCredentials+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.Programimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderEpgSyncMode@@ -42,8 +44,8 @@ interface ProviderRepository {): Booleansuspend fun setActiveProvider(id: Long): Result<Unit>- suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, httpUserAgent: String = "", httpHeaders: String = "", xtreamFastSyncEnabled: Boolean, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND, xtreamLiveSyncMode: ProviderXtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>- suspend fun validateM3u(url: String, name: String, httpUserAgent: String = "", httpHeaders: String = "", epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND, m3uVodClassificationEnabled: Boolean = false, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>+ suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, httpUserAgent: String = "", httpHeaders: String = "", xtreamFastSyncEnabled: Boolean, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND, xtreamLiveSyncMode: ProviderXtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO, guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO, channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>+ suspend fun validateM3u(url: String, name: String, httpUserAgent: String = "", httpHeaders: String = "", epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND, m3uVodClassificationEnabled: Boolean = false, guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO, channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>suspend fun loginStalker(portalUrl: String,macAddress: String,@@ -62,6 +64,8 @@ interface ProviderRepository {signature: String = "",stalkerAdvancedOptionsJson: String = "",epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,+ guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,onProgress: ((String) -> Unit)? = null,id: Long? = null): Result<Provider>diff --git a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.ktindex 6f0f5db1..fb909b0d 100644--- a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt+++ b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt@@ -1,6 +1,8 @@package com.streamvault.domain.usecaseimport com.streamvault.domain.manager.ProviderSetupInputValidator+import com.streamvault.domain.model.ChannelLogoSourcePolicy+import com.streamvault.domain.model.GuideSourcePolicyimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderXtreamLiveSyncMode@@ -23,6 +25,8 @@ data class XtreamProviderSetupCommand(val xtreamFastSyncEnabled: Boolean = false,val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,val xtreamLiveSyncMode: ProviderXtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO,+ val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,val existingProviderId: Long? = null)@@ -33,6 +37,8 @@ data class M3uProviderSetupCommand(val httpHeaders: String = "",val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,val m3uVodClassificationEnabled: Boolean = false,+ val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,val existingProviderId: Long? = null)@@ -54,6 +60,8 @@ data class StalkerProviderSetupCommand(val signature: String = "",val stalkerAdvancedOptionsJson: String = "",val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,+ val guideSourcePolicy: GuideSourcePolicy = GuideSourcePolicy.AUTO,+ val channelLogoSourcePolicy: ChannelLogoSourcePolicy = ChannelLogoSourcePolicy.SUPPLIER_PREFERRED,val existingProviderId: Long? = null)@@ -185,6 +193,8 @@ class ValidateAndAddProvider @Inject constructor(xtreamFastSyncEnabled = command.xtreamFastSyncEnabled,epgSyncMode = command.epgSyncMode,xtreamLiveSyncMode = command.xtreamLiveSyncMode,+ guideSourcePolicy = command.guideSourcePolicy,+ channelLogoSourcePolicy = command.channelLogoSourcePolicy,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()@@ -223,6 +233,8 @@ class ValidateAndAddProvider @Inject constructor(xtreamFastSyncEnabled = false,epgSyncMode = command.epgSyncMode,xtreamLiveSyncMode = ProviderXtreamLiveSyncMode.AUTO,+ guideSourcePolicy = command.guideSourcePolicy,+ channelLogoSourcePolicy = command.channelLogoSourcePolicy,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()@@ -236,6 +248,8 @@ class ValidateAndAddProvider @Inject constructor(httpHeaders = validatedInput.httpHeaders,epgSyncMode = command.epgSyncMode,m3uVodClassificationEnabled = command.m3uVodClassificationEnabled,+ guideSourcePolicy = command.guideSourcePolicy,+ channelLogoSourcePolicy = command.channelLogoSourcePolicy,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()@@ -291,6 +305,8 @@ class ValidateAndAddProvider @Inject constructor(signature = validated.data.signature,stalkerAdvancedOptionsJson = validated.data.stalkerAdvancedOptionsJson,epgSyncMode = command.epgSyncMode,+ guideSourcePolicy = command.guideSourcePolicy,+ channelLogoSourcePolicy = command.channelLogoSourcePolicy,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()