StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
feat(stalker): add custom header overrides and unsafe TLS options
David Nashashad7d26d32ef9
diff --git a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt b/app/src/main/java/com/streamvault/app/di/DatabaseModule.ktindex 3a71ea77..5d3744ad 100644--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt@@ -97,7 +97,8 @@ object DatabaseModule {StreamVaultDatabase.MIGRATION_56_57,StreamVaultDatabase.MIGRATION_57_58,StreamVaultDatabase.MIGRATION_58_59,- StreamVaultDatabase.MIGRATION_59_60+ StreamVaultDatabase.MIGRATION_59_60,+ StreamVaultDatabase.MIGRATION_60_61)// 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/di/NetworkModule.kt b/app/src/main/java/com/streamvault/app/di/NetworkModule.ktindex 379227a6..a5cafc7d 100644--- a/app/src/main/java/com/streamvault/app/di/NetworkModule.kt+++ b/app/src/main/java/com/streamvault/app/di/NetworkModule.kt@@ -30,7 +30,12 @@ import okhttp3.Cacheimport okhttp3.OkHttpClientimport okhttp3.logging.HttpLoggingInterceptorimport java.io.File+import java.security.SecureRandom+import java.security.cert.X509Certificateimport java.util.concurrent.TimeUnit.SECONDS+import javax.net.ssl.HostnameVerifier+import javax.net.ssl.SSLContext+import javax.net.ssl.X509TrustManagerimport javax.inject.Singleton@Module@@ -90,7 +95,7 @@ object NetworkModule {@Provides@Singletonfun provideStalkerApiService(okHttpClient: OkHttpClient, xtreamJson: Json): StalkerApiService =- OkHttpStalkerApiService(okHttpClient, xtreamJson)+ OkHttpStalkerApiService(okHttpClient.newBuilder().applyUnsafeTlsBypass().build(), xtreamJson)@Provides@Singleton@@ -101,6 +106,19 @@ object NetworkModule {coerceInputValues = true}+ private fun OkHttpClient.Builder.applyUnsafeTlsBypass(): OkHttpClient.Builder {+ val trustAllManager = object : X509TrustManager {+ override fun checkClientTrusted(chain: Array<out X509Certificate>?, authType: String?) = Unit+ override fun checkServerTrusted(chain: Array<out X509Certificate>?, authType: String?) = Unit+ override fun getAcceptedIssuers(): Array<X509Certificate> = emptyArray()+ }+ val sslContext = SSLContext.getInstance("TLS").apply {+ init(null, arrayOf(trustAllManager), SecureRandom())+ }+ return sslSocketFactory(sslContext.socketFactory, trustAllManager)+ .hostnameVerifier(HostnameVerifier { _, _ -> true })+ }+@Provides@Singletonfun provideXmltvParser(): XmltvParser = XmltvParser()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerContentResolutionSupport.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerContentResolutionSupport.ktindex 79bdb861..1b1d3d10 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerContentResolutionSupport.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerContentResolutionSupport.kt@@ -182,6 +182,9 @@ internal suspend fun resolvePlayerPlaybackStreamInfo(title = currentTitle,headers = resolved.headers,userAgent = resolved.userAgent,+ allowInvalidSsl = resolved.allowInvalidSsl,+ proxyHost = resolved.proxyHost,+ proxyPort = resolved.proxyPort,streamType = StreamType.fromContainerExtension(ext),containerExtension = ext,expirationTime = resolved.expirationTimediff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex eabfe913..8828dd61 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -63,6 +63,7 @@ import com.streamvault.player.timeshift.LiveTimeshiftBackendimport com.streamvault.player.timeshift.LiveTimeshiftStateimport com.streamvault.player.timeshift.LiveTimeshiftStatusimport com.streamvault.player.timeshift.TimeshiftConfig+import com.streamvault.player.playback.applyUnsafeTlsBypassimport dagger.hilt.android.lifecycle.HiltViewModelimport kotlinx.coroutines.ExperimentalCoroutinesApiimport kotlinx.coroutines.Job@@ -73,6 +74,8 @@ import kotlinx.coroutines.launchimport kotlinx.coroutines.withContextimport kotlinx.coroutines.Dispatchersimport javax.inject.Inject+import java.net.InetSocketAddress+import java.net.Proxyimport okhttp3.OkHttpClientimport okhttp3.Request@@ -1393,7 +1396,19 @@ class PlayerViewModel @Inject constructor(}}.build()- okHttpClient.newCall(request).execute().use { response ->+ val probeClient = if (streamInfo.allowInvalidSsl || streamInfo.proxyHost.isNotBlank()) {+ okHttpClient.newBuilder()+ .apply {+ if (streamInfo.allowInvalidSsl) {+ applyUnsafeTlsBypass()+ }+ streamInfo.httpProxy()?.let { proxy(it) }+ }+ .build()+ } else {+ okHttpClient+ }+ probeClient.newCall(request).execute().use { response ->resolvePlaybackProbeFailure(response.code)}}@@ -1419,6 +1434,12 @@ class PlayerViewModel @Inject constructor((xtreamStreamUrlResolver.isInternalStreamUrl(currentStreamUrl) || xtreamStreamUrlResolver.isInternalStreamUrl(url))}+ private fun StreamInfo.httpProxy(): Proxy? {+ val host = proxyHost.trim().takeIf { it.isNotBlank() } ?: return null+ val port = proxyPort ?: return null+ return Proxy(Proxy.Type.HTTP, InetSocketAddress(host, port))+ }+fun prepare(streamUrl: String,epgChannelId: String?,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.ktindex 7fbf82bb..87c31c32 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@@ -80,6 +80,10 @@ import com.streamvault.app.ui.interaction.TvClickableSurfaceimport com.streamvault.app.ui.components.shell.StatusPillimport com.streamvault.app.ui.screens.settings.BackupImportPreviewDialogimport com.streamvault.app.ui.theme.*+import com.streamvault.data.remote.stalker.StalkerAdvancedOptions+import com.streamvault.data.remote.stalker.StalkerAdvancedOptionsCodec+import com.streamvault.data.remote.stalker.StalkerParamOverride+import com.streamvault.data.remote.stalker.StalkerRequestRuleimport com.streamvault.data.util.ProviderInputSanitizerimport com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderXtreamLiveSyncMode@@ -96,6 +100,35 @@ import kotlin.coroutines.resumeprivate enum class SourceType { XTREAM, STALKER, M3U_URL, M3U_FILE }+private data class StalkerRequestRuleUiState(+ val action: String = "",+ val blockRequest: Boolean = false,+ val paramsText: String = ""+)++private fun StalkerRequestRuleUiState.toRule(): StalkerRequestRule =+ StalkerRequestRule(+ action = action.trim(),+ blockRequest = blockRequest,+ paramOverrides = paramsText+ .split('|', '\n')+ .mapNotNull { entry ->+ val trimmed = entry.trim()+ if (trimmed.isBlank()) return@mapNotNull null+ val separator = trimmed.indexOf('=').takeIf { it >= 0 } ?: trimmed.indexOf(':')+ val name = if (separator >= 0) trimmed.substring(0, separator).trim() else trimmed+ val value = if (separator >= 0) trimmed.substring(separator + 1).trim() else ""+ name.takeIf { it.isNotBlank() }?.let { StalkerParamOverride(it, value) }+ }+ )++private fun StalkerRequestRule.toUiState(): StalkerRequestRuleUiState =+ StalkerRequestRuleUiState(+ action = action,+ blockRequest = blockRequest,+ paramsText = paramOverrides.joinToString(" | ") { "${it.name}=${it.value}" }+ )+// ??? Screen ??????????????????????????????????????????????????????????????????@OptIn(ExperimentalLayoutApi::class)@@ -131,6 +164,14 @@ fun ProviderSetupScreen(var stalkerDeviceId by rememberSaveable { mutableStateOf("") }var stalkerDeviceId2 by rememberSaveable { mutableStateOf("") }var stalkerSignature by rememberSaveable { mutableStateOf("") }+ var stalkerHwVersion by rememberSaveable { mutableStateOf("") }+ var stalkerApiUserAgent by rememberSaveable { mutableStateOf("") }+ var stalkerPlayerUserAgent by rememberSaveable { mutableStateOf("") }+ var stalkerXUserAgentLink by rememberSaveable { mutableStateOf(StalkerAdvancedOptions.LINK_ETHERNET) }+ var stalkerProxyEnabled by rememberSaveable { mutableStateOf(false) }+ var stalkerProxyHost by rememberSaveable { mutableStateOf("") }+ var stalkerProxyPort by rememberSaveable { mutableStateOf("") }+ val stalkerRequestRules = remember { mutableStateListOf<StalkerRequestRuleUiState>() }var fileImportError by rememberSaveable { mutableStateOf<String?>(null) }var handledInitialImportUri by rememberSaveable { mutableStateOf<String?>(null) }var showDiscardDraftDialog by rememberSaveable { mutableStateOf(false) }@@ -250,9 +291,36 @@ fun ProviderSetupScreen(stalkerDeviceId = uiState.stalkerDeviceIdstalkerDeviceId2 = uiState.stalkerDeviceId2stalkerSignature = uiState.stalkerSignature+ val advanced = StalkerAdvancedOptionsCodec.decode(uiState.stalkerAdvancedOptionsJson)+ stalkerHwVersion = advanced.hwVersion+ stalkerApiUserAgent = advanced.apiUserAgent+ stalkerPlayerUserAgent = advanced.playerUserAgent+ stalkerXUserAgentLink = advanced.normalizedLink+ stalkerProxyEnabled = advanced.proxyEnabled+ stalkerProxyHost = advanced.proxyHost+ stalkerProxyPort = advanced.proxyPort?.toString().orEmpty()+ stalkerRequestRules.clear()+ stalkerRequestRules.addAll(advanced.requestRules.map { it.toUiState() })}}+ fun buildStalkerAdvancedOptionsJson(): String =+ StalkerAdvancedOptionsCodec.encode(+ StalkerAdvancedOptions(+ hwVersion = stalkerHwVersion.trim(),+ apiUserAgent = stalkerApiUserAgent.trim(),+ playerUserAgent = stalkerPlayerUserAgent.trim(),+ xUserAgentLink = stalkerXUserAgentLink,+ proxyEnabled = stalkerProxyEnabled,+ proxyHost = stalkerProxyHost.trim(),+ proxyPort = stalkerProxyPort.trim().toIntOrNull(),+ requestRules = stalkerRequestRules.map { it.toRule() }+ .filter { rule ->+ rule.action.isNotBlank() || rule.blockRequest || rule.paramOverrides.isNotEmpty()+ }+ )+ )+// ?? Derived UI source type ????????????????????????????????????????????????val sourceType = when {selectedTab == 0 -> SourceType.XTREAM@@ -300,6 +368,14 @@ fun ProviderSetupScreen(stalkerDeviceId.isNotBlank() ||stalkerDeviceId2.isNotBlank() ||stalkerSignature.isNotBlank() ||+ stalkerHwVersion.isNotBlank() ||+ stalkerApiUserAgent.isNotBlank() ||+ stalkerPlayerUserAgent.isNotBlank() ||+ stalkerXUserAgentLink != StalkerAdvancedOptions.LINK_ETHERNET ||+ stalkerProxyEnabled ||+ stalkerProxyHost.isNotBlank() ||+ stalkerProxyPort.isNotBlank() ||+ stalkerRequestRules.isNotEmpty() ||m3uUrl.isNotBlank())@@ -360,10 +436,21 @@ fun ProviderSetupScreen(stalkerDeviceId = stalkerDeviceId, onStalkerDeviceIdChange = { stalkerDeviceId = ProviderInputSanitizer.sanitizeStalkerDeviceIdForEditing(it) },stalkerDeviceId2 = stalkerDeviceId2, onStalkerDeviceId2Change = { stalkerDeviceId2 = ProviderInputSanitizer.sanitizeStalkerDeviceIdForEditing(it) },stalkerSignature = stalkerSignature, onStalkerSignatureChange = { stalkerSignature = ProviderInputSanitizer.sanitizeStalkerSignatureForEditing(it) },+ stalkerHwVersion = stalkerHwVersion, onStalkerHwVersionChange = { stalkerHwVersion = it },+ stalkerApiUserAgent = stalkerApiUserAgent, onStalkerApiUserAgentChange = { stalkerApiUserAgent = ProviderInputSanitizer.sanitizeHttpUserAgentForEditing(it) },+ stalkerPlayerUserAgent = stalkerPlayerUserAgent, onStalkerPlayerUserAgentChange = { stalkerPlayerUserAgent = ProviderInputSanitizer.sanitizeHttpUserAgentForEditing(it) },+ stalkerXUserAgentLink = stalkerXUserAgentLink, onStalkerXUserAgentLinkChange = { stalkerXUserAgentLink = it },+ stalkerProxyEnabled = stalkerProxyEnabled, onStalkerProxyEnabledChange = { stalkerProxyEnabled = it },+ stalkerProxyHost = stalkerProxyHost, onStalkerProxyHostChange = { stalkerProxyHost = it.trim() },+ stalkerProxyPort = stalkerProxyPort, onStalkerProxyPortChange = { stalkerProxyPort = it.filter(Char::isDigit).take(5) },+ stalkerRequestRules = stalkerRequestRules,+ onAddStalkerRequestRule = { stalkerRequestRules.add(StalkerRequestRuleUiState()) },+ onUpdateStalkerRequestRule = { index, rule -> if (index in stalkerRequestRules.indices) stalkerRequestRules[index] = rule },+ onRemoveStalkerRequestRule = { index -> if (index in stalkerRequestRules.indices) stalkerRequestRules.removeAt(index) },fileImportError = fileImportError,onFilePick = { filePickerLauncher.launch(arrayOf("*/*")) },onLoginXtream = { viewModel.loginXtream(serverUrl, username, password, name, httpUserAgent, httpHeaders) },- onLoginStalker = { viewModel.loginStalker(serverUrl, stalkerMacAddress, stalkerAuthMode, username, password, name, stalkerDeviceProfile, stalkerDeviceTimezone, stalkerDeviceLocale, stalkerSerialNumber, stalkerDeviceId, stalkerDeviceId2, stalkerSignature) },+ onLoginStalker = { viewModel.loginStalker(serverUrl, stalkerMacAddress, stalkerAuthMode, username, password, name, httpUserAgent, httpHeaders, stalkerDeviceProfile, stalkerDeviceTimezone, stalkerDeviceLocale, stalkerSerialNumber, stalkerDeviceId, stalkerDeviceId2, stalkerSignature, buildStalkerAdvancedOptionsJson()) },onAddM3u = { viewModel.addM3u(m3uUrl, name, httpUserAgent, httpHeaders) },onStartPhonePairing = viewModel::startPhonePairing,onStopPhonePairing = viewModel::stopPhonePairing,@@ -404,10 +491,21 @@ fun ProviderSetupScreen(stalkerDeviceId = stalkerDeviceId, onStalkerDeviceIdChange = { stalkerDeviceId = ProviderInputSanitizer.sanitizeStalkerDeviceIdForEditing(it) },stalkerDeviceId2 = stalkerDeviceId2, onStalkerDeviceId2Change = { stalkerDeviceId2 = ProviderInputSanitizer.sanitizeStalkerDeviceIdForEditing(it) },stalkerSignature = stalkerSignature, onStalkerSignatureChange = { stalkerSignature = ProviderInputSanitizer.sanitizeStalkerSignatureForEditing(it) },+ stalkerHwVersion = stalkerHwVersion, onStalkerHwVersionChange = { stalkerHwVersion = it },+ stalkerApiUserAgent = stalkerApiUserAgent, onStalkerApiUserAgentChange = { stalkerApiUserAgent = ProviderInputSanitizer.sanitizeHttpUserAgentForEditing(it) },+ stalkerPlayerUserAgent = stalkerPlayerUserAgent, onStalkerPlayerUserAgentChange = { stalkerPlayerUserAgent = ProviderInputSanitizer.sanitizeHttpUserAgentForEditing(it) },+ stalkerXUserAgentLink = stalkerXUserAgentLink, onStalkerXUserAgentLinkChange = { stalkerXUserAgentLink = it },+ stalkerProxyEnabled = stalkerProxyEnabled, onStalkerProxyEnabledChange = { stalkerProxyEnabled = it },+ stalkerProxyHost = stalkerProxyHost, onStalkerProxyHostChange = { stalkerProxyHost = it.trim() },+ stalkerProxyPort = stalkerProxyPort, onStalkerProxyPortChange = { stalkerProxyPort = it.filter(Char::isDigit).take(5) },+ stalkerRequestRules = stalkerRequestRules,+ onAddStalkerRequestRule = { stalkerRequestRules.add(StalkerRequestRuleUiState()) },+ onUpdateStalkerRequestRule = { index, rule -> if (index in stalkerRequestRules.indices) stalkerRequestRules[index] = rule },+ onRemoveStalkerRequestRule = { index -> if (index in stalkerRequestRules.indices) stalkerRequestRules.removeAt(index) },fileImportError = fileImportError,onFilePick = { filePickerLauncher.launch(arrayOf("*/*")) },onLoginXtream = { viewModel.loginXtream(serverUrl, username, password, name, httpUserAgent, httpHeaders) },- onLoginStalker = { viewModel.loginStalker(serverUrl, stalkerMacAddress, stalkerAuthMode, username, password, name, stalkerDeviceProfile, stalkerDeviceTimezone, stalkerDeviceLocale, stalkerSerialNumber, stalkerDeviceId, stalkerDeviceId2, stalkerSignature) },+ onLoginStalker = { viewModel.loginStalker(serverUrl, stalkerMacAddress, stalkerAuthMode, username, password, name, httpUserAgent, httpHeaders, stalkerDeviceProfile, stalkerDeviceTimezone, stalkerDeviceLocale, stalkerSerialNumber, stalkerDeviceId, stalkerDeviceId2, stalkerSignature, buildStalkerAdvancedOptionsJson()) },onAddM3u = { viewModel.addM3u(m3uUrl, name, httpUserAgent, httpHeaders) },onStartPhonePairing = viewModel::startPhonePairing,onStopPhonePairing = viewModel::stopPhonePairing,@@ -726,6 +824,17 @@ private fun ProviderFormContent(stalkerDeviceId: String, onStalkerDeviceIdChange: (String) -> Unit,stalkerDeviceId2: String, onStalkerDeviceId2Change: (String) -> Unit,stalkerSignature: String, onStalkerSignatureChange: (String) -> Unit,+ stalkerHwVersion: String, onStalkerHwVersionChange: (String) -> Unit,+ stalkerApiUserAgent: String, onStalkerApiUserAgentChange: (String) -> Unit,+ stalkerPlayerUserAgent: String, onStalkerPlayerUserAgentChange: (String) -> Unit,+ stalkerXUserAgentLink: String, onStalkerXUserAgentLinkChange: (String) -> Unit,+ stalkerProxyEnabled: Boolean, onStalkerProxyEnabledChange: (Boolean) -> Unit,+ stalkerProxyHost: String, onStalkerProxyHostChange: (String) -> Unit,+ stalkerProxyPort: String, onStalkerProxyPortChange: (String) -> Unit,+ stalkerRequestRules: List<StalkerRequestRuleUiState>,+ onAddStalkerRequestRule: () -> Unit,+ onUpdateStalkerRequestRule: (Int, StalkerRequestRuleUiState) -> Unit,+ onRemoveStalkerRequestRule: (Int) -> Unit,fileImportError: String?,onFilePick: () -> Unit,onLoginXtream: () -> Unit,@@ -835,7 +944,25 @@ private fun ProviderFormContent(stalkerDeviceId2 = stalkerDeviceId2,onStalkerDeviceId2Change = onStalkerDeviceId2Change,stalkerSignature = stalkerSignature,- onStalkerSignatureChange = onStalkerSignatureChange+ onStalkerSignatureChange = onStalkerSignatureChange,+ stalkerHwVersion = stalkerHwVersion,+ onStalkerHwVersionChange = onStalkerHwVersionChange,+ stalkerApiUserAgent = stalkerApiUserAgent,+ onStalkerApiUserAgentChange = onStalkerApiUserAgentChange,+ stalkerPlayerUserAgent = stalkerPlayerUserAgent,+ onStalkerPlayerUserAgentChange = onStalkerPlayerUserAgentChange,+ stalkerXUserAgentLink = stalkerXUserAgentLink,+ onStalkerXUserAgentLinkChange = onStalkerXUserAgentLinkChange,+ stalkerProxyEnabled = stalkerProxyEnabled,+ onStalkerProxyEnabledChange = onStalkerProxyEnabledChange,+ stalkerProxyHost = stalkerProxyHost,+ onStalkerProxyHostChange = onStalkerProxyHostChange,+ stalkerProxyPort = stalkerProxyPort,+ onStalkerProxyPortChange = onStalkerProxyPortChange,+ stalkerRequestRules = stalkerRequestRules,+ onAddStalkerRequestRule = onAddStalkerRequestRule,+ onUpdateStalkerRequestRule = onUpdateStalkerRequestRule,+ onRemoveStalkerRequestRule = onRemoveStalkerRequestRule)FormErrors(uiState.validationError, uiState.error)ActionButton(@@ -1059,7 +1186,25 @@ private fun AdvancedProviderOptionsSection(stalkerDeviceId2: String,onStalkerDeviceId2Change: (String) -> Unit,stalkerSignature: String,- onStalkerSignatureChange: (String) -> Unit+ onStalkerSignatureChange: (String) -> Unit,+ stalkerHwVersion: String = "",+ onStalkerHwVersionChange: (String) -> Unit = {},+ stalkerApiUserAgent: String = "",+ onStalkerApiUserAgentChange: (String) -> Unit = {},+ stalkerPlayerUserAgent: String = "",+ onStalkerPlayerUserAgentChange: (String) -> Unit = {},+ stalkerXUserAgentLink: String = StalkerAdvancedOptions.LINK_ETHERNET,+ onStalkerXUserAgentLinkChange: (String) -> Unit = {},+ stalkerProxyEnabled: Boolean = false,+ onStalkerProxyEnabledChange: (Boolean) -> Unit = {},+ stalkerProxyHost: String = "",+ onStalkerProxyHostChange: (String) -> Unit = {},+ stalkerProxyPort: String = "",+ onStalkerProxyPortChange: (String) -> Unit = {},+ stalkerRequestRules: List<StalkerRequestRuleUiState> = emptyList(),+ onAddStalkerRequestRule: () -> Unit = {},+ onUpdateStalkerRequestRule: (Int, StalkerRequestRuleUiState) -> Unit = { _, _ -> },+ onRemoveStalkerRequestRule: (Int) -> Unit = {}) {var showAdvancedOptions by rememberSaveable(sourceType) { mutableStateOf(false) }val defaultEpgSyncMode = when (sourceType) {@@ -1073,7 +1218,7 @@ private fun AdvancedProviderOptionsSection(val hasNonDefaultSelection = ((sourceType == SourceType.XTREAM || sourceType == SourceType.STALKER) && uiState.epgSyncMode != defaultEpgSyncMode) ||(sourceType == SourceType.XTREAM && uiState.xtreamLiveSyncMode != ProviderXtreamLiveSyncMode.AUTO) ||((sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) && !uiState.m3uVodClassificationEnabled) ||- ((sourceType == SourceType.XTREAM || sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) &&+ ((sourceType == SourceType.XTREAM || sourceType == SourceType.STALKER || sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) &&(httpUserAgent.isNotBlank() || httpHeaders.isNotBlank())) ||(sourceType == SourceType.STALKER && (stalkerAuthMode != StalkerAuthMode.AUTO ||@@ -1196,7 +1341,7 @@ private fun AdvancedProviderOptionsSection(}}- if (sourceType == SourceType.XTREAM || sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) {+ if (sourceType == SourceType.XTREAM || sourceType == SourceType.STALKER || sourceType == SourceType.M3U_URL || sourceType == SourceType.M3U_FILE) {ProviderTextField(value = httpUserAgent,onValueChange = onHttpUserAgentChange,@@ -1211,7 +1356,11 @@ private fun AdvancedProviderOptionsSection(ProviderTextField(value = httpHeaders,onValueChange = onHttpHeadersChange,- placeholder = "Custom headers (optional, Header: Value | Header2: Value)",+ placeholder = if (sourceType == SourceType.STALKER) {+ "Custom headers (optional, Header: Value | HeaderToRemove:)"+ } else {+ "Custom headers (optional, Header: Value | Header2: Value)"+ },keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None,autoCorrectEnabled = false,@@ -1349,7 +1498,7 @@ private fun AdvancedProviderOptionsSection(ProviderTextField(value = stalkerDeviceProfile,onValueChange = onStalkerDeviceProfileChange,- placeholder = "Device profile (optional)"+ placeholder = "MAG Type (optional)")ProviderTextField(value = stalkerDeviceTimezone,@@ -1381,12 +1530,208 @@ private fun AdvancedProviderOptionsSection(onValueChange = onStalkerSignatureChange,placeholder = "Signature (optional)")+ HorizontalDivider(color = SurfaceHighlight.copy(alpha = 0.45f))+ Text(+ text = "Stalker compatibility",+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = "Portal-specific overrides for stubborn MAG/Stalker servers. Leave fields empty unless a server needs them.",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ ProviderTextField(+ value = stalkerHwVersion,+ onValueChange = onStalkerHwVersionChange,+ placeholder = "hw_version override (optional)"+ )+ ProviderTextField(+ value = stalkerApiUserAgent,+ onValueChange = onStalkerApiUserAgentChange,+ placeholder = "User-Agent (API, optional)"+ )+ ProviderTextField(+ value = stalkerPlayerUserAgent,+ onValueChange = onStalkerPlayerUserAgentChange,+ placeholder = "User-Agent (Player, optional)"+ )+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ Text(+ text = "X-User-Agent Link",+ style = MaterialTheme.typography.bodyMedium,+ color = TextPrimary+ )+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StalkerLinkOptionButton(+ text = StalkerAdvancedOptions.LINK_ETHERNET,+ selected = stalkerXUserAgentLink == StalkerAdvancedOptions.LINK_ETHERNET,+ onClick = { onStalkerXUserAgentLinkChange(StalkerAdvancedOptions.LINK_ETHERNET) }+ )+ StalkerLinkOptionButton(+ text = StalkerAdvancedOptions.LINK_WIFI,+ selected = stalkerXUserAgentLink == StalkerAdvancedOptions.LINK_WIFI,+ onClick = { onStalkerXUserAgentLinkChange(StalkerAdvancedOptions.LINK_WIFI) }+ )+ }+ }+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = "Use HTTP proxy",+ style = MaterialTheme.typography.bodyMedium,+ color = TextPrimary+ )+ Text(+ text = "Applies to Stalker API and playback only.",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ Switch(+ checked = stalkerProxyEnabled,+ onCheckedChange = onStalkerProxyEnabledChange+ )+ }+ AnimatedVisibility(stalkerProxyEnabled) {+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ ProviderTextField(+ value = stalkerProxyHost,+ onValueChange = onStalkerProxyHostChange,+ placeholder = "Proxy host"+ )+ ProviderTextField(+ value = stalkerProxyPort,+ onValueChange = onStalkerProxyPortChange,+ placeholder = "Proxy port",+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)+ )+ }+ }+ StalkerRequestRulesEditor(+ rules = stalkerRequestRules,+ onAddRule = onAddStalkerRequestRule,+ onUpdateRule = onUpdateStalkerRequestRule,+ onRemoveRule = onRemoveStalkerRequestRule+ )}}}}}+@Composable+private fun StalkerLinkOptionButton(+ text: String,+ selected: Boolean,+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ modifier = Modifier.mouseClickable(onClick = onClick),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (selected) Primary.copy(alpha = 0.18f) else Surface,+ focusedContainerColor = Primary.copy(alpha = 0.28f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(BorderStroke(1.dp, if (selected) Primary else SurfaceHighlight)),+ focusedBorder = Border(BorderStroke(3.dp, PrimaryLight))+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Text(+ text = text,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp),+ style = MaterialTheme.typography.bodySmall,+ color = TextPrimary+ )+ }+}++@Composable+private fun StalkerRequestRulesEditor(+ rules: List<StalkerRequestRuleUiState>,+ onAddRule: () -> Unit,+ onUpdateRule: (Int, StalkerRequestRuleUiState) -> Unit,+ onRemoveRule: (Int) -> Unit+) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(Surface, RoundedCornerShape(12.dp))+ .border(1.dp, SurfaceHighlight, RoundedCornerShape(12.dp))+ .padding(12.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text("Request rules", style = MaterialTheme.typography.titleSmall, color = TextPrimary)+ Text(+ "Match by action, block calls, or override params. Blank values remove params.",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ TextButton(onClick = onAddRule) { Text("Add") }+ }+ rules.forEachIndexed { index, rule ->+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .border(1.dp, SurfaceHighlight.copy(alpha = 0.7f), RoundedCornerShape(10.dp))+ .padding(10.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text("Rule ${index + 1}", style = MaterialTheme.typography.bodyMedium, color = TextPrimary)+ TextButton(onClick = { onRemoveRule(index) }) { Text("Delete") }+ }+ ProviderTextField(+ value = rule.action,+ onValueChange = { onUpdateRule(index, rule.copy(action = it.trim())) },+ placeholder = "action, e.g. get_profile"+ )+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text("Block this request", style = MaterialTheme.typography.bodySmall, color = TextPrimary)+ Switch(+ checked = rule.blockRequest,+ onCheckedChange = { onUpdateRule(index, rule.copy(blockRequest = it)) }+ )+ }+ if (rule.blockRequest && rule.action.trim() in setOf("handshake", "get_profile")) {+ Text(+ text = "Warning: blocking ${rule.action.trim()} can prevent login.",+ style = MaterialTheme.typography.bodySmall,+ color = AccentAmber+ )+ }+ ProviderTextField(+ value = rule.paramsText,+ onValueChange = { onUpdateRule(index, rule.copy(paramsText = it)) },+ placeholder = "Param overrides: name=value | remove_me="+ )+ }+ }+ }+}+@Composableprivate fun XtreamLiveSyncModeOptionRow(mode: ProviderXtreamLiveSyncMode,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 c3221417..30314b13 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@@ -221,6 +221,7 @@ class ProviderSetupViewModel @Inject constructor(stalkerDeviceId = provider.stalkerDeviceId,stalkerDeviceId2 = provider.stalkerDeviceId2,stalkerSignature = provider.stalkerSignature,+ stalkerAdvancedOptionsJson = provider.stalkerAdvancedOptionsJson,epgSyncMode = provider.epgSyncMode,xtreamLiveSyncMode = provider.xtreamLiveSyncMode,hasCustomizedEpgSyncMode = true,@@ -272,13 +273,16 @@ class ProviderSetupViewModel @Inject constructor(username: String,password: String,name: String,+ httpUserAgent: String,+ httpHeaders: String,deviceProfile: String,timezone: String,locale: String,serialNumber: String = "",deviceId: String = "",deviceId2: String = "",- signature: String = ""+ signature: String = "",+ stalkerAdvancedOptionsJson: String = "") {_uiState.update {it.copy(@@ -302,6 +306,8 @@ class ProviderSetupViewModel @Inject constructor(username = username,password = password,name = name,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,deviceProfile = deviceProfile,timezone = timezone,locale = locale,@@ -309,6 +315,7 @@ class ProviderSetupViewModel @Inject constructor(deviceId = deviceId,deviceId2 = deviceId2,signature = signature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson,epgSyncMode = _uiState.value.epgSyncMode,existingProviderId = existingId),@@ -859,6 +866,7 @@ data class ProviderSetupState(val stalkerDeviceId: String = "",val stalkerDeviceId2: String = "",val stalkerSignature: String = "",+ val stalkerAdvancedOptionsJson: String = "",val createdProviderId: Long? = null,val createdProviderName: String? = null,val pendingCombinedAttachProfileId: Long? = null,diff --git a/app/src/test/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModelTest.kt b/app/src/test/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModelTest.ktindex 86e0a892..09016fb6 100644--- a/app/src/test/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModelTest.kt+++ b/app/src/test/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModelTest.kt@@ -412,6 +412,8 @@ class ProviderSetupViewModelTest {username = "",password = "",name = "MAG",+ httpUserAgent = "",+ httpHeaders = "",deviceProfile = "MAG250",timezone = "UTC",locale = "en"diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/61.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/61.jsonnew file mode 100644index 00000000..bd691120--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/61.json@@ -0,0 +1,5350 @@+{+ "formatVersion": 1,+ "database": {+ "version": 61,+ "identityHash": "edf501986892b75630f4c6c292fe89e5",+ "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, `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": "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, 'edf501986892b75630f4c6c292fe89e5')"+ ]+ }+}\ No newline at end of filediff --git a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.ktindex 06acf0a4..894b60c0 100644--- a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt+++ b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt@@ -1192,16 +1192,17 @@ class StreamVaultDatabaseMigrationTest {}@Test- fun migrate57To60_upgradeChainValidatesLatestSchema() {+ fun migrate57To61_upgradeChainValidatesLatestSchema() {migrationTestHelper.createDatabase("streamvault-57-60-test", 57).close()val migratedDb = migrationTestHelper.runMigrationsAndValidate("streamvault-57-60-test",- 60,+ 61,true,StreamVaultDatabase.MIGRATION_57_58,StreamVaultDatabase.MIGRATION_58_59,- StreamVaultDatabase.MIGRATION_59_60+ StreamVaultDatabase.MIGRATION_59_60,+ StreamVaultDatabase.MIGRATION_60_61)assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('downloads') WHERE name = 'source_stream_url'"))@@ -1209,7 +1210,23 @@ class StreamVaultDatabaseMigrationTest {assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('downloads') WHERE name = 'container_extension'"))assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('downloads') WHERE name = 'supports_resume'"))assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('downloads') WHERE name = 'retry_count'"))+ assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('providers') WHERE name = 'stalker_advanced_options_json'"))++ migratedDb.close()+ }++ @Test+ fun migrate60To61_addsStalkerAdvancedOptionsJson() {+ migrationTestHelper.createDatabase("streamvault-60-61-test", 60).close()++ val migratedDb = migrationTestHelper.runMigrationsAndValidate(+ "streamvault-60-61-test",+ 61,+ true,+ StreamVaultDatabase.MIGRATION_60_61+ )+ assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('providers') WHERE name = 'stalker_advanced_options_json'"))migratedDb.close()}diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.ktindex 0fa5b4a2..fdbbaa9a 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 = 60,+ version = 61,exportSchema = true // ← was false; schema JSON now tracked in version control)@TypeConverters(RoomEnumConverters::class)@@ -2672,6 +2672,18 @@ abstract class StreamVaultDatabase : RoomDatabase() {}}+ val MIGRATION_60_61 = object : Migration(60, 61) {+ override fun migrate(database: SupportSQLiteDatabase) {+ addColumnIfMissing(+ database,+ tableName = "providers",+ columnName = "stalker_advanced_options_json",+ columnDefinition = "TEXT NOT NULL DEFAULT ''"+ )+ 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/entity/Entities.kt b/data/src/main/java/com/streamvault/data/local/entity/Entities.ktindex 3c7be61c..75cd28e5 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@@ -44,6 +44,7 @@ data class ProviderEntity(@ColumnInfo(name = "stalker_device_id") val stalkerDeviceId: String = "",@ColumnInfo(name = "stalker_device_id2") val stalkerDeviceId2: String = "",@ColumnInfo(name = "stalker_signature") val stalkerSignature: String = "",+ @ColumnInfo(name = "stalker_advanced_options_json") val stalkerAdvancedOptionsJson: String = "",@ColumnInfo(name = "stalker_auth_mode") val stalkerAuthMode: StalkerAuthMode = StalkerAuthMode.AUTO,@ColumnInfo(name = "stalker_portal_profile") val stalkerPortalProfile: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,@ColumnInfo(name = "stalker_portal_fingerprint") val stalkerPortalFingerprint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,diff --git a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.ktindex 26e339e2..616df840 100644--- a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt+++ b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt@@ -34,6 +34,7 @@ fun ProviderEntity.toDomain() = Provider(stalkerDeviceId = stalkerDeviceId,stalkerDeviceId2 = stalkerDeviceId2,stalkerSignature = stalkerSignature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson,stalkerAuthMode = stalkerAuthMode,stalkerPortalProfile = stalkerPortalProfile,stalkerPortalFingerprint = stalkerPortalFingerprint,@@ -83,6 +84,7 @@ fun Provider.toEntity() = ProviderEntity(stalkerDeviceId = stalkerDeviceId,stalkerDeviceId2 = stalkerDeviceId2,stalkerSignature = stalkerSignature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson,stalkerAuthMode = stalkerAuthMode,stalkerPortalProfile = stalkerPortalProfile,stalkerPortalFingerprint = stalkerPortalFingerprint,diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.kt b/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.ktindex 938dadca..c37d387e 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.kt@@ -20,6 +20,8 @@ import java.io.IOExceptionimport java.io.InputStreamimport java.io.InputStreamReaderimport java.net.URI+import java.net.InetSocketAddress+import java.net.Proxyimport java.net.URLEncoderimport java.time.Instantimport java.time.LocalDate@@ -49,10 +51,11 @@ import kotlinx.serialization.json.jsonObjectimport kotlinx.serialization.json.longOrNullimport okhttp3.Cookieimport okhttp3.CookieJar+import okhttp3.Headersimport okhttp3.HttpUrlimport okhttp3.OkHttpClient-import okhttp3.Requestimport okhttp3.MediaType.Companion.toMediaType+import okhttp3.Requestimport okhttp3.RequestBody.Companion.toRequestBodyimport okhttp3.Responseimport okhttp3.HttpUrl.Companion.toHttpUrlOrNull@@ -63,9 +66,7 @@ class OkHttpStalkerApiService @Inject constructor(private val json: Json) : StalkerApiService {private val cookieJar = InMemoryStalkerCookieJar()- private val stalkerHttpClient: OkHttpClient = okHttpClient.newBuilder()- .cookieJar(cookieJar)- .build()+ private val stalkerHttpClients = ConcurrentHashMap<String, OkHttpClient>()override suspend fun authenticate(profile: StalkerDeviceProfile): Result<Pair<StalkerSession, StalkerProviderProfile>> {var lastError: Throwable? = null@@ -922,8 +923,9 @@ class OkHttpStalkerApiService @Inject constructor(method: String = "GET",body: String? = null): JsonElement = withContext(Dispatchers.IO) {- val action = query["action"]- val fullUrl = buildUrl(url, query)+ val effectiveQuery = prepareQuery(profile, query)+ val action = effectiveQuery["action"]+ val fullUrl = buildUrl(url, effectiveQuery)val requestBuilder = Request.Builder().url(fullUrl).header("User-Agent", profile.userAgent)@@ -934,13 +936,14 @@ class OkHttpStalkerApiService @Inject constructor(.apply {token?.takeIf { it.isNotBlank() }?.let { header("Authorization", "Bearer $it") }}+ .applyStalkerHeaderOverrides(profile.headerOverrides)val requestBody = body?.toRequestBody(FORM_URL_ENCODED_MEDIA_TYPE)val request = requestBuilder.method(method, requestBody).build()runCatching {- executeJsonRequest(request, action)+ executeJsonRequest(request, action, profile)}.recoverCatching { error ->if (!allowAlternateEndpointRetry) throw errorval alternateUrl = siblingLoadUrl(url)@@ -951,17 +954,18 @@ class OkHttpStalkerApiService @Inject constructor("Retrying Stalker ${action.orEmpty()} via alternate endpoint $alternateUrl after ${error.message}")val alternateRequest = request.newBuilder()- .url(buildUrl(alternateUrl, query))+ .url(buildUrl(alternateUrl, effectiveQuery)).header("Referer", StalkerUrlFactory.portalReferer(alternateUrl))- .header("Cookie", buildCookieHeader(buildUrl(alternateUrl, query), profile))+ .header("Cookie", buildCookieHeader(buildUrl(alternateUrl, effectiveQuery), profile))+ .applyStalkerHeaderOverrides(profile.headerOverrides).method(method, requestBody).build()- executeJsonRequest(alternateRequest, action)+ executeJsonRequest(alternateRequest, action, profile)}.getOrElse { throw it }}- private fun executeJsonRequest(request: Request, action: String?): JsonElement {- return stalkerHttpClient.newCall(request).execute().use { response ->+ private fun executeJsonRequest(request: Request, action: String?, profile: StalkerDeviceProfile): JsonElement {+ return stalkerHttpClientFor(profile).newCall(request).execute().use { response ->captureResponseCookies(response)if (!response.isSuccessful) {response.body?.close()@@ -1041,8 +1045,9 @@ class OkHttpStalkerApiService @Inject constructor(token: String,onItem: suspend (StalkerItemRecord) -> Unit): Int = withContext(Dispatchers.IO) {- val action = query["action"]- val fullUrl = buildUrl(url, query)+ val effectiveQuery = prepareQuery(profile, query)+ val action = effectiveQuery["action"]+ val fullUrl = buildUrl(url, effectiveQuery)val request = Request.Builder().url(fullUrl).header("User-Agent", profile.userAgent)@@ -1051,18 +1056,20 @@ class OkHttpStalkerApiService @Inject constructor(.header("Accept", "*/*").header("Cookie", buildCookieHeader(fullUrl, profile)).header("Authorization", "Bearer $token")+ .applyStalkerHeaderOverrides(profile.headerOverrides).get().build()- executeStreamingRequest(request, action, onItem)+ executeStreamingRequest(request, action, profile, onItem)}private suspend fun executeStreamingRequest(request: Request,action: String?,+ profile: StalkerDeviceProfile,onItem: suspend (StalkerItemRecord) -> Unit): Int {- return stalkerHttpClient.newCall(request).execute().use { response ->+ return stalkerHttpClientFor(profile).newCall(request).execute().use { response ->captureResponseCookies(response)if (!response.isSuccessful) {throw IOException("Portal request failed with HTTP ${response.code}.")@@ -1173,8 +1180,9 @@ class OkHttpStalkerApiService @Inject constructor(channelIdOverride: String?,onProgram: suspend (StalkerProgramRecord) -> Unit): Int = withContext(Dispatchers.IO) {- val action = query["action"]- val fullUrl = buildUrl(url, query)+ val effectiveQuery = prepareQuery(profile, query)+ val action = effectiveQuery["action"]+ val fullUrl = buildUrl(url, effectiveQuery)val request = Request.Builder().url(fullUrl).header("User-Agent", profile.userAgent)@@ -1183,19 +1191,21 @@ class OkHttpStalkerApiService @Inject constructor(.header("Accept", "*/*").header("Cookie", buildCookieHeader(fullUrl, profile)).header("Authorization", "Bearer $token")+ .applyStalkerHeaderOverrides(profile.headerOverrides).get().build()- executeStreamingPrograms(request, action, channelIdOverride, onProgram)+ executeStreamingPrograms(request, action, profile, channelIdOverride, onProgram)}private suspend fun executeStreamingPrograms(request: Request,action: String?,+ profile: StalkerDeviceProfile,channelIdOverride: String?,onProgram: suspend (StalkerProgramRecord) -> Unit): Int {- return stalkerHttpClient.newCall(request).execute().use { response ->+ return stalkerHttpClientFor(profile).newCall(request).execute().use { response ->captureResponseCookies(response)if (!response.isSuccessful) {throw IOException("Portal request failed with HTTP ${response.code}.")@@ -1398,14 +1408,60 @@ class OkHttpStalkerApiService @Inject constructor(return "${baseUrl.trimEnd('/')}?$encodedQuery"}+ private fun prepareQuery(+ profile: StalkerDeviceProfile,+ query: Map<String, String>+ ): LinkedHashMap<String, String> {+ val action = query["action"].orEmpty()+ val matchingRule = profile.advancedOptions.requestRules+ .firstOrNull { it.action.trim() == action }+ if (matchingRule?.blockRequest == true) {+ throw IOException("Stalker request '$action' was blocked by advanced settings.")+ }+ val prepared = LinkedHashMap<String, String>()+ query.forEach { (key, value) -> prepared[key] = value }+ matchingRule?.paramOverrides.orEmpty().forEach { override ->+ val name = override.name.trim()+ if (name.isBlank()) return@forEach+ val value = override.value+ if (value.isBlank()) {+ prepared.remove(name)+ } else {+ prepared[name] = value+ }+ }+ if (action == "get_profile" && prepared.containsKey("JsHttpRequest")) {+ val jsValue = prepared.remove("JsHttpRequest")+ if (jsValue != null) {+ prepared["JsHttpRequest"] = jsValue+ }+ }+ return prepared+ }++ private fun stalkerHttpClientFor(profile: StalkerDeviceProfile): OkHttpClient {+ val proxy = profile.advancedOptions.proxy+ val key = proxy?.let { "${it.host}:${it.port}" } ?: "<direct>"+ return stalkerHttpClients.computeIfAbsent(key) {+ okHttpClient.newBuilder()+ .cookieJar(cookieJar)+ .apply {+ if (proxy != null) {+ proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress(proxy.host, proxy.port)))+ }+ }+ .build()+ }+ }+private fun buildProfileQuery(profile: StalkerDeviceProfile): Map<String, String> {val timestamp = (System.currentTimeMillis() / 1000L).toString()val preset = stalkerMagPresetSpec(profile.magPreset)val metrics = buildMetricsJson(profile, preset)- return mapOf(+ val hwVersion = profile.advancedOptions.hwVersion.trim().ifBlank { preset.hwVersion }+ return linkedMapOf("type" to "stb","action" to "get_profile",- "JsHttpRequest" to "1-xml","hd" to "1","ver" to preset.versionString,"sn" to profile.serialNumber,@@ -1417,17 +1473,18 @@ class OkHttpStalkerApiService @Inject constructor("device_id2" to profile.deviceId2,"signature" to profile.signature,"auth_second_step" to "1",- "hw_version" to preset.hwVersion,+ "hw_version" to hwVersion,"not_valid_token" to "0","metrics" to metrics,- "hw_version_2" to preset.hwVersion,+ "hw_version_2" to hwVersion,"timestamp" to timestamp,"api_signature" to preset.apiSignature,"prehash" to "false","num_banks" to "2","player_version" to preset.imageVersion,"stb_lang" to profile.locale.ifBlank { preset.localization.substringBefore('.') },- "locale" to preset.localization+ "locale" to preset.localization,+ "JsHttpRequest" to "1-xml")}@@ -2391,11 +2448,15 @@ internal fun buildStalkerDeviceProfile(deviceProfile: String,timezone: String,locale: String,+ httpUserAgentOverride: String = "",+ httpHeadersOverride: String = "",serialNumberOverride: String = "",deviceIdOverride: String = "",deviceId2Override: String = "",- signatureOverride: String = ""+ signatureOverride: String = "",+ stalkerAdvancedOptionsJson: String = ""): StalkerDeviceProfile {+ val advancedOptions = StalkerAdvancedOptionsCodec.decode(stalkerAdvancedOptionsJson)val preset = stalkerMagPresetSpec(magPresetHint)val normalizedInputProfile = deviceProfile.trim()val normalizedProfile = when {@@ -2408,11 +2469,26 @@ internal fun buildStalkerDeviceProfile(val normalizedLocale = locale.ifBlank { Locale.getDefault().language.ifBlank { "en" } }val normalizedMac = macAddress.uppercase(Locale.ROOT)val normalizedUsername = username.trim()+ val normalizedHttpUserAgent = httpUserAgentOverride.trim()+ val normalizedHttpHeaders = httpHeadersOverride.trim()+ val headerOverrides = parseStalkerHeaderOverrides(normalizedHttpHeaders)val effectiveAuthMode = sanitizeStalkerAuthMode(requested = authMode,normalizedMac = normalizedMac,normalizedUsername = normalizedUsername)+ val defaultUserAgent =+ "Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) $normalizedProfile stbapp ver: 2 rev: ${preset.imageVersion} Safari/533.3"+ val apiUserAgent = advancedOptions.apiUserAgent.trim().ifBlank {+ resolveStalkerUserAgent(+ defaultUserAgent = defaultUserAgent,+ httpUserAgentOverride = normalizedHttpUserAgent,+ headerOverrides = headerOverrides+ ).orEmpty()+ }+ val playerUserAgent = advancedOptions.playerUserAgent.trim().ifBlank {+ apiUserAgent+ }return StalkerDeviceProfile(portalUrl = portalUrl,macAddress = normalizedMac,@@ -2432,8 +2508,13 @@ internal fun buildStalkerDeviceProfile(deviceId = deviceIdOverride.trim().uppercase(Locale.ROOT),deviceId2 = deviceId2Override.trim().uppercase(Locale.ROOT),signature = signatureOverride.trim().uppercase(Locale.ROOT),- userAgent = "Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) $normalizedProfile stbapp ver: 2 rev: ${preset.imageVersion} Safari/533.3",- xUserAgent = "Model: $normalizedProfile; Link: Ethernet"+ userAgent = apiUserAgent,+ playerUserAgent = playerUserAgent,+ xUserAgent = "Model: $normalizedProfile; Link: ${advancedOptions.normalizedLink}",+ httpUserAgent = normalizedHttpUserAgent,+ httpHeaders = normalizedHttpHeaders,+ headerOverrides = headerOverrides,+ advancedOptions = advancedOptions)}@@ -2490,13 +2571,57 @@ private fun StalkerDeviceProfile.withRecipe(deviceProfile = deviceProfile,timezone = timezone,locale = locale,+ httpUserAgentOverride = httpUserAgent,+ httpHeadersOverride = httpHeaders,serialNumberOverride = serialNumber,deviceIdOverride = deviceId,deviceId2Override = deviceId2,- signatureOverride = signature+ signatureOverride = signature,+ stalkerAdvancedOptionsJson = StalkerAdvancedOptionsCodec.encode(advancedOptions))}+private fun parseStalkerHeaderOverrides(rawHeaders: String): Map<String, String?> {+ if (rawHeaders.isBlank()) return emptyMap()+ return buildMap {+ rawHeaders+ .split('|')+ .map { it.trim() }+ .filter { it.isNotEmpty() }+ .forEach { entry ->+ val separatorIndex = entry.indexOf(':')+ if (separatorIndex <= 0) return@forEach+ val name = entry.substring(0, separatorIndex).trim()+ if (name.isEmpty()) return@forEach+ val value = entry.substring(separatorIndex + 1).trim().ifEmpty { null }+ put(name, value)+ }+ }+}++private fun resolveStalkerUserAgent(+ defaultUserAgent: String,+ httpUserAgentOverride: String,+ headerOverrides: Map<String, String?>+): String? {+ val overriddenUserAgent = headerOverrides.entries.firstOrNull { (name, _) ->+ name.equals("User-Agent", ignoreCase = true)+ }?.value+ return overriddenUserAgent ?: httpUserAgentOverride.ifBlank { defaultUserAgent }+}++private fun Request.Builder.applyStalkerHeaderOverrides(+ headerOverrides: Map<String, String?>+): Request.Builder = apply {+ headerOverrides.forEach { (name, value) ->+ if (value == null) {+ removeHeader(name)+ } else {+ header(name, value)+ }+ }+}+internal fun parseExpirationDate(raw: String?): Long? {val value = raw?.trim()?.takeIf { it.isNotEmpty() } ?: return nullvalue.toLongOrNull()?.let { numeric ->diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerAdvancedOptions.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerAdvancedOptions.ktnew file mode 100644index 00000000..890c1ce5--- /dev/null+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerAdvancedOptions.kt@@ -0,0 +1,79 @@+package com.streamvault.data.remote.stalker++import kotlinx.serialization.ExperimentalSerializationApi+import kotlinx.serialization.Serializable+import kotlinx.serialization.encodeToString+import kotlinx.serialization.json.Json++@Serializable+data class StalkerAdvancedOptions(+ val hwVersion: String = "",+ val apiUserAgent: String = "",+ val playerUserAgent: String = "",+ val xUserAgentLink: String = LINK_ETHERNET,+ val proxyEnabled: Boolean = false,+ val proxyHost: String = "",+ val proxyPort: Int? = null,+ val requestRules: List<StalkerRequestRule> = emptyList()+) {+ val normalizedLink: String+ get() = when {+ xUserAgentLink.equals(LINK_WIFI, ignoreCase = true) -> LINK_WIFI+ else -> LINK_ETHERNET+ }++ val proxy: StalkerHttpProxy?+ get() = if (proxyEnabled && proxyHost.isNotBlank() && proxyPort != null) {+ StalkerHttpProxy(proxyHost.trim(), proxyPort)+ } else {+ null+ }++ companion object {+ const val LINK_ETHERNET = "Ethernet"+ const val LINK_WIFI = "WiFi"+ }+}++@Serializable+data class StalkerRequestRule(+ val action: String = "",+ val blockRequest: Boolean = false,+ val paramOverrides: List<StalkerParamOverride> = emptyList()+)++@Serializable+data class StalkerParamOverride(+ val name: String = "",+ val value: String = ""+)++data class StalkerHttpProxy(+ val host: String,+ val port: Int+)++object StalkerAdvancedOptionsCodec {+ @OptIn(ExperimentalSerializationApi::class)+ private val json = Json {+ ignoreUnknownKeys = true+ encodeDefaults = true+ explicitNulls = false+ }++ fun decode(raw: String): StalkerAdvancedOptions {+ if (raw.isBlank()) return StalkerAdvancedOptions()+ return runCatching { json.decodeFromString<StalkerAdvancedOptions>(raw) }+ .getOrElse { StalkerAdvancedOptions() }+ }++ fun decodeStrict(raw: String): StalkerAdvancedOptions {+ if (raw.isBlank()) return StalkerAdvancedOptions()+ return json.decodeFromString(raw)+ }++ fun encode(options: StalkerAdvancedOptions): String {+ if (options == StalkerAdvancedOptions()) return ""+ return json.encodeToString(options)+ }+}diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.ktindex 48eef2f0..98d626ec 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.kt@@ -30,7 +30,12 @@ data class StalkerDeviceProfile(val deviceId2: String,val signature: String,val userAgent: String,- val xUserAgent: String+ val playerUserAgent: String,+ val xUserAgent: String,+ val httpUserAgent: String = "",+ val httpHeaders: String = "",+ val headerOverrides: Map<String, String?> = emptyMap(),+ val advancedOptions: StalkerAdvancedOptions = StalkerAdvancedOptions())data class StalkerSession(diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.ktindex b916239e..8db0148c 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt@@ -37,6 +37,9 @@ data class StalkerPlaybackInfo(val url: String,val headers: Map<String, String> = emptyMap(),val userAgent: String? = null,+ val allowInvalidSsl: Boolean = false,+ val proxyHost: String = "",+ val proxyPort: Int? = null,val playbackMode: StalkerPlaybackMode = StalkerPlaybackMode.DIRECT_URL,val endpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,val cookieMode: StalkerCookieMode = StalkerCookieMode.NONE,@@ -60,6 +63,8 @@ class StalkerProvider(private val authMode: StalkerAuthMode = StalkerAuthMode.AUTO,private val username: String = "",private val password: String = "",+ private val httpUserAgent: String = "",+ private val httpHeaders: String = "",private val portalFingerprintHint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,private val magPresetHint: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,private val bootstrapRecipeHint: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,@@ -74,7 +79,8 @@ class StalkerProvider(private val serialNumber: String = "",private val deviceId: String = "",private val deviceId2: String = "",- private val signature: String = ""+ private val signature: String = "",+ private val stalkerAdvancedOptionsJson: String = "") : IptvProvider {private companion object {private const val TAG = "StalkerProvider"@@ -124,6 +130,7 @@ class StalkerProvider(stalkerDeviceId = learnedDeviceProfile.deviceId,stalkerDeviceId2 = learnedDeviceProfile.deviceId2,stalkerSignature = learnedDeviceProfile.signature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson,stalkerAuthMode = profile.effectiveAuthMode,stalkerPortalProfile = profile.portalProfile,stalkerPortalFingerprint = profile.portalFingerprint,@@ -465,7 +472,10 @@ class StalkerProvider(StalkerPlaybackInfo(url = candidate,headers = buildPlaybackHeaders(session, profile, candidate),- userAgent = profile.userAgent,+ userAgent = resolvePlaybackUserAgent(profile),+ allowInvalidSsl = true,+ proxyHost = profile.advancedOptions.proxy?.host.orEmpty(),+ proxyPort = profile.advancedOptions.proxy?.port,playbackMode = adapter.adapterMode,endpointPreference = effectiveArchiveEndpointPreference(kind = kind,@@ -515,7 +525,10 @@ class StalkerProvider(StalkerPlaybackInfo(url = resolvedUrl,headers = buildPlaybackHeaders(session, profile, resolvedUrl),- userAgent = profile.userAgent,+ userAgent = resolvePlaybackUserAgent(profile),+ allowInvalidSsl = true,+ proxyHost = profile.advancedOptions.proxy?.host.orEmpty(),+ proxyPort = profile.advancedOptions.proxy?.port,playbackMode = adapter.adapterMode,endpointPreference = effectiveArchiveEndpointPreference(kind = kind,@@ -785,13 +798,16 @@ class StalkerProvider(playbackBackendHint = playbackBackendHint,username = normalizedUsername(),password = normalizedPassword(),+ httpUserAgentOverride = httpUserAgent.trim(),+ httpHeadersOverride = httpHeaders,deviceProfile = normalizedDeviceProfile(),timezone = normalizedTimezone(),locale = normalizedLocale(),serialNumberOverride = normalizedSerialNumber(),deviceIdOverride = normalizedDeviceId(),deviceId2Override = normalizedDeviceId2(),- signatureOverride = normalizedSignature()+ signatureOverride = normalizedSignature(),+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson)when (val authResult = api.authenticate(profile)) {is Result.Success -> {@@ -817,13 +833,16 @@ class StalkerProvider(playbackBackendHint = playbackBackendHint,username = normalizedUsername(),password = normalizedPassword(),+ httpUserAgentOverride = httpUserAgent.trim(),+ httpHeadersOverride = httpHeaders,deviceProfile = normalizedDeviceProfile(),timezone = normalizedTimezone(),locale = normalizedLocale(),serialNumberOverride = normalizedSerialNumber(),deviceIdOverride = normalizedDeviceId(),deviceId2Override = normalizedDeviceId2(),- signatureOverride = normalizedSignature()+ signatureOverride = normalizedSignature(),+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson)}@@ -840,13 +859,16 @@ class StalkerProvider(playbackBackendHint = profile.fingerprintEvidence.playbackBackendHint,username = normalizedUsername(),password = normalizedPassword(),+ httpUserAgentOverride = httpUserAgent.trim(),+ httpHeadersOverride = httpHeaders,deviceProfile = normalizedDeviceProfile(),timezone = normalizedTimezone(),locale = normalizedLocale(),serialNumberOverride = normalizedSerialNumber(),deviceIdOverride = normalizedDeviceId(),deviceId2Override = normalizedDeviceId2(),- signatureOverride = normalizedSignature()+ signatureOverride = normalizedSignature(),+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson)}@@ -866,8 +888,22 @@ class StalkerProvider(session.token.takeIf { it.isNotBlank() && !omitAuthorization }?.let { token ->put("Authorization", "Bearer $token")}+ profile.headerOverrides.forEach { (name, value) ->+ if (value == null) {+ remove(name)+ } else if (name.equals("User-Agent", ignoreCase = true)) {+ // Playback user agent is surfaced separately on StalkerPlaybackInfo.+ } else {+ put(name, value)+ }+ }}+ private fun resolvePlaybackUserAgent(profile: StalkerDeviceProfile): String? =+ profile.headerOverrides.entries.firstOrNull { (name, _) ->+ name.equals("User-Agent", ignoreCase = true)+ }?.value ?: profile.playerUserAgent.ifBlank { profile.userAgent.ifBlank { null } }+private fun shouldOmitPlaybackAuthorization(url: String): Boolean {val path = runCatching { URI(url).path?.lowercase(Locale.ROOT).orEmpty() }.getOrDefault("")return path.endsWith("/play/live.php") || path.endsWith("/play/movie.php")diff --git a/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.kt b/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.ktindex d04109ea..f36f4361 100644--- a/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.kt+++ b/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.kt@@ -32,7 +32,10 @@ data class ResolvedStreamUrl(val expirationTime: Long? = null,val containerExtension: String? = null,val headers: Map<String, String> = emptyMap(),- val userAgent: String? = null+ val userAgent: String? = null,+ val allowInvalidSsl: Boolean = false,+ val proxyHost: String = "",+ val proxyPort: Int? = null)@Singleton@@ -60,6 +63,7 @@ class XtreamStreamUrlResolver @Inject constructor(val deviceId: String,val deviceId2: String,val signature: String,+ val stalkerAdvancedOptionsJson: String,val provider: StalkerProvider)@@ -189,7 +193,10 @@ class XtreamStreamUrlResolver @Inject constructor(expirationTime = extractStreamExpirationTime(playbackInfo.url),containerExtension = token.containerExtension ?: fallbackContainerExtension,headers = playbackInfo.headers,- userAgent = playbackInfo.userAgent+ userAgent = playbackInfo.userAgent,+ allowInvalidSsl = playbackInfo.allowInvalidSsl,+ proxyHost = playbackInfo.proxyHost,+ proxyPort = playbackInfo.proxyPort)}ProviderType.M3U -> url.takeIf { it.isNotBlank() }?.let { passthroughUrl ->@@ -281,7 +288,10 @@ class XtreamStreamUrlResolver @Inject constructor(expirationTime = extractStreamExpirationTime(playbackInfo.url),containerExtension = fallbackContainerExtension,headers = playbackInfo.headers,- userAgent = playbackInfo.userAgent+ userAgent = playbackInfo.userAgent,+ allowInvalidSsl = playbackInfo.allowInvalidSsl,+ proxyHost = playbackInfo.proxyHost,+ proxyPort = playbackInfo.proxyPort)}@@ -360,7 +370,8 @@ class XtreamStreamUrlResolver @Inject constructor(cached.serialNumber == provider.stalkerSerialNumber &&cached.deviceId == provider.stalkerDeviceId &&cached.deviceId2 == provider.stalkerDeviceId2 &&- cached.signature == provider.stalkerSignature+ cached.signature == provider.stalkerSignature &&+ cached.stalkerAdvancedOptionsJson == provider.stalkerAdvancedOptionsJson) {return cached.provider}@@ -389,7 +400,8 @@ class XtreamStreamUrlResolver @Inject constructor(serialNumber = provider.stalkerSerialNumber,deviceId = provider.stalkerDeviceId,deviceId2 = provider.stalkerDeviceId2,- signature = provider.stalkerSignature+ signature = provider.stalkerSignature,+ stalkerAdvancedOptionsJson = provider.stalkerAdvancedOptionsJson)stalkerProviders[providerId] = CachedStalkerProvider(serverUrl = provider.serverUrl,@@ -410,6 +422,7 @@ class XtreamStreamUrlResolver @Inject constructor(deviceId = provider.stalkerDeviceId,deviceId2 = provider.stalkerDeviceId2,signature = provider.stalkerSignature,+ stalkerAdvancedOptionsJson = provider.stalkerAdvancedOptionsJson,provider = resolvedProvider)return resolvedProviderdiff --git a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.ktindex ac8e9c56..91ab0a55 100644--- a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt@@ -259,6 +259,9 @@ class ChannelRepositoryImpl @Inject constructor(title = channel.name,headers = resolvedStream.headers,userAgent = resolvedStream.userAgent,+ allowInvalidSsl = resolvedStream.allowInvalidSsl,+ proxyHost = resolvedStream.proxyHost,+ proxyPort = resolvedStream.proxyPort,streamType = StreamType.fromContainerExtension(resolvedStream.containerExtension),containerExtension = resolvedStream.containerExtension,expirationTime = resolvedStream.expirationTimediff --git a/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.ktindex d1fa16ee..a1a549dc 100644--- a/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt@@ -474,6 +474,9 @@ class MovieRepositoryImpl @Inject constructor(title = movie.name,headers = resolvedStream.headers,userAgent = resolvedStream.userAgent,+ allowInvalidSsl = resolvedStream.allowInvalidSsl,+ proxyHost = resolvedStream.proxyHost,+ proxyPort = resolvedStream.proxyPort,streamType = StreamType.fromContainerExtension(ext),containerExtension = ext,expirationTime = resolvedStream.expirationTimediff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex e9575717..3c2949cc 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -352,6 +352,8 @@ class ProviderRepositoryImpl @Inject constructor(authMode: StalkerAuthMode,username: String,password: String,+ httpUserAgent: String,+ httpHeaders: String,deviceProfile: String,timezone: String,locale: String,@@ -359,6 +361,7 @@ class ProviderRepositoryImpl @Inject constructor(deviceId: String,deviceId2: String,signature: String,+ stalkerAdvancedOptionsJson: String,epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?@@ -374,6 +377,7 @@ class ProviderRepositoryImpl @Inject constructor(val normalizedDeviceId = ProviderInputSanitizer.normalizeStalkerDeviceId(deviceId)val normalizedDeviceId2 = ProviderInputSanitizer.normalizeStalkerDeviceId(deviceId2)val normalizedSignature = ProviderInputSanitizer.normalizeStalkerSignature(signature)+ val normalizedAdvancedOptionsJson = stalkerAdvancedOptionsJson.trim()ProviderInputSanitizer.validateUrl(normalizedPortalUrl)?.let { message ->return Result.error(message)@@ -414,13 +418,16 @@ class ProviderRepositoryImpl @Inject constructor(authMode = authMode,username = normalizedUsername,password = effectivePassword,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,deviceProfile = normalizedDeviceProfile,timezone = normalizedTimezone,locale = normalizedLocale,serialNumber = normalizedSerialNumber,deviceId = normalizedDeviceId,deviceId2 = normalizedDeviceId2,- signature = normalizedSignature+ signature = normalizedSignature,+ stalkerAdvancedOptionsJson = normalizedAdvancedOptionsJson)return when (val authResult = provider.authenticate()) {@@ -433,6 +440,8 @@ class ProviderRepositoryImpl @Inject constructor(serverUrl = normalizedPortalUrl,username = normalizedUsername,password = effectivePassword,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,stalkerMacAddress = normalizedMacAddress,stalkerDeviceProfile = normalizedDeviceProfile,stalkerDeviceTimezone = normalizedTimezone,@@ -441,6 +450,7 @@ class ProviderRepositoryImpl @Inject constructor(stalkerDeviceId = normalizedDeviceId,stalkerDeviceId2 = normalizedDeviceId2,stalkerSignature = normalizedSignature,+ stalkerAdvancedOptionsJson = normalizedAdvancedOptionsJson,epgUrl = existingProvider.epgUrl,epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = false,@@ -458,6 +468,8 @@ class ProviderRepositoryImpl @Inject constructor(serverUrl = normalizedPortalUrl,username = normalizedUsername,password = effectivePassword,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,stalkerMacAddress = normalizedMacAddress,stalkerDeviceProfile = normalizedDeviceProfile,stalkerDeviceTimezone = normalizedTimezone,@@ -466,6 +478,7 @@ class ProviderRepositoryImpl @Inject constructor(stalkerDeviceId = normalizedDeviceId,stalkerDeviceId2 = normalizedDeviceId2,stalkerSignature = normalizedSignature,+ stalkerAdvancedOptionsJson = normalizedAdvancedOptionsJson,epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = false,m3uVodClassificationEnabled = false,@@ -787,6 +800,8 @@ class ProviderRepositoryImpl @Inject constructor(authMode: StalkerAuthMode,username: String,password: String,+ httpUserAgent: String = "",+ httpHeaders: String = "",portalFingerprintHint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,magPresetHint: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,bootstrapRecipeHint: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,@@ -801,7 +816,8 @@ class ProviderRepositoryImpl @Inject constructor(serialNumber: String = "",deviceId: String = "",deviceId2: String = "",- signature: String = ""+ signature: String = "",+ stalkerAdvancedOptionsJson: String = ""): StalkerProvider {return StalkerProvider(providerId = providerId,@@ -811,6 +827,8 @@ class ProviderRepositoryImpl @Inject constructor(authMode = authMode,username = username,password = password,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,portalFingerprintHint = portalFingerprintHint,magPresetHint = magPresetHint,bootstrapRecipeHint = bootstrapRecipeHint,@@ -825,7 +843,8 @@ class ProviderRepositoryImpl @Inject constructor(serialNumber = serialNumber,deviceId = deviceId,deviceId2 = deviceId2,- signature = signature+ signature = signature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson)}@@ -841,6 +860,8 @@ class ProviderRepositoryImpl @Inject constructor(} catch (_: Throwable) {""},+ httpUserAgent = entity.httpUserAgent,+ httpHeaders = entity.httpHeaders,portalFingerprintHint = entity.stalkerPortalFingerprint,magPresetHint = entity.stalkerMagPreset,bootstrapRecipeHint = entity.stalkerLastBootstrapRecipe,@@ -856,7 +877,8 @@ class ProviderRepositoryImpl @Inject constructor(serialNumber = entity.stalkerSerialNumber,deviceId = entity.stalkerDeviceId,deviceId2 = entity.stalkerDeviceId2,- signature = entity.stalkerSignature+ signature = entity.stalkerSignature,+ stalkerAdvancedOptionsJson = entity.stalkerAdvancedOptionsJson)}diff --git a/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.ktindex 613dc6af..988521bf 100644--- a/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt@@ -532,6 +532,9 @@ class SeriesRepositoryImpl @Inject constructor(title = episode.title,headers = resolvedStream.headers,userAgent = resolvedStream.userAgent,+ allowInvalidSsl = resolvedStream.allowInvalidSsl,+ proxyHost = resolvedStream.proxyHost,+ proxyPort = resolvedStream.proxyPort,streamType = StreamType.fromContainerExtension(ext),containerExtension = ext,expirationTime = resolvedStream.expirationTimediff --git a/data/src/main/java/com/streamvault/data/validation/ProviderSetupInputValidatorImpl.kt b/data/src/main/java/com/streamvault/data/validation/ProviderSetupInputValidatorImpl.ktindex 5b80ccda..dacbabe0 100644--- a/data/src/main/java/com/streamvault/data/validation/ProviderSetupInputValidatorImpl.kt+++ b/data/src/main/java/com/streamvault/data/validation/ProviderSetupInputValidatorImpl.kt@@ -6,6 +6,7 @@ import com.streamvault.domain.manager.ProviderSetupInputValidatorimport com.streamvault.domain.manager.ValidatedM3uProviderInputimport com.streamvault.domain.manager.ValidatedStalkerProviderInputimport com.streamvault.domain.manager.ValidatedXtreamProviderInput+import com.streamvault.data.remote.stalker.StalkerAdvancedOptionsCodecimport com.streamvault.domain.model.Resultimport com.streamvault.domain.model.StalkerAuthModeimport java.time.ZoneId@@ -105,19 +106,24 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInputusername: String,password: String,allowBlankPassword: Boolean,+ httpUserAgent: String,+ httpHeaders: String,deviceProfile: String,timezone: String,locale: String,serialNumber: String,deviceId: String,deviceId2: String,- signature: String+ signature: String,+ stalkerAdvancedOptionsJson: String): Result<ValidatedStalkerProviderInput> {val normalizedPortalUrl = ProviderInputSanitizer.normalizeUrl(portalUrl)val normalizedMacAddress = ProviderInputSanitizer.normalizeMacAddress(macAddress)val normalizedName = ProviderInputSanitizer.normalizeProviderName(name)val normalizedUsername = ProviderInputSanitizer.normalizeUsername(username)val normalizedPassword = ProviderInputSanitizer.normalizePassword(password)+ val normalizedHttpUserAgent = ProviderInputSanitizer.normalizeHttpUserAgent(httpUserAgent)+ val normalizedHttpHeaders = ProviderInputSanitizer.normalizeHttpHeaders(httpHeaders)val normalizedDeviceProfile = ProviderInputSanitizer.normalizeDeviceProfile(deviceProfile)val normalizedTimezone = ProviderInputSanitizer.normalizeTimezone(timezone)val normalizedLocale = ProviderInputSanitizer.normalizeLocale(locale)@@ -191,6 +197,15 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInput}}+ validateHttpOverrides(+ normalizedHttpUserAgent,+ normalizedHttpHeaders,+ allowBlankHeaderValues = true,+ allowRestrictedHeaderOverrides = true+ )?.let { message ->+ return Result.error(message)+ }+// deviceProfile becomes the X-User-Agent model and part of the device signature. Blank// is fine (defaults to MAG250 internally); a non-blank value must be a safe ASCII token.if (normalizedDeviceProfile.isNotBlank() && !DEVICE_PROFILE_SAFE_REGEX.matches(normalizedDeviceProfile)) {@@ -230,6 +245,9 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInputvalidateOptionalIdentityToken(normalizedSignature, "Signature")?.let { message ->return Result.error(message)}+ validateStalkerAdvancedOptions(stalkerAdvancedOptionsJson)?.let { message ->+ return Result.error(message)+ }return Result.success(ValidatedStalkerProviderInput(@@ -239,13 +257,16 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInputauthMode = authMode,username = normalizedUsername,password = normalizedPassword,+ httpUserAgent = normalizedHttpUserAgent,+ httpHeaders = normalizedHttpHeaders,deviceProfile = normalizedDeviceProfile,timezone = normalizedTimezone,locale = normalizedLocale,serialNumber = normalizedSerialNumber,deviceId = normalizedDeviceId,deviceId2 = normalizedDeviceId2,- signature = normalizedSignature+ signature = normalizedSignature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson.trim()))}@@ -275,6 +296,53 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInputprivate val LOCALE_SAFE_REGEX = Regex("^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$")private val IDENTITY_TOKEN_SAFE_REGEX = Regex("^[A-Za-z0-9._-]+$")private val HEX_TOKEN_SAFE_REGEX = Regex("^[A-F0-9]+$")+ private val ACTION_NAME_SAFE_REGEX = Regex("^[A-Za-z0-9_:-]+$")+ private val PARAM_NAME_SAFE_REGEX = Regex("^[A-Za-z0-9_.:-]+$")+ }++ private fun validateStalkerAdvancedOptions(raw: String): String? {+ if (raw.isBlank()) return null+ val options = runCatching { StalkerAdvancedOptionsCodec.decodeStrict(raw) }+ .getOrElse { return "Stalker advanced options could not be read." }+ if (options.proxyEnabled) {+ if (options.proxyHost.isBlank()) {+ return "Proxy host is required when HTTP proxy is enabled."+ }+ if (options.proxyHost.any { it.isWhitespace() }) {+ return "Proxy host must not contain spaces."+ }+ val port = options.proxyPort+ if (port == null || port !in 1..65535) {+ return "Proxy port must be between 1 and 65535."+ }+ }+ val actions = mutableSetOf<String>()+ options.requestRules.forEach { rule ->+ val action = rule.action.trim()+ if (action.isBlank()) {+ return "Each request rule needs an action name."+ }+ if (!ACTION_NAME_SAFE_REGEX.matches(action)) {+ return "Request rule action '$action' contains invalid characters."+ }+ if (!actions.add(action)) {+ return "Request rule action '$action' is duplicated."+ }+ val params = mutableSetOf<String>()+ rule.paramOverrides.forEach { override ->+ val name = override.name.trim()+ if (name.isBlank()) {+ return "Request rule '$action' contains a blank parameter name."+ }+ if (!PARAM_NAME_SAFE_REGEX.matches(name)) {+ return "Request rule parameter '$name' contains invalid characters."+ }+ if (!params.add(name)) {+ return "Request rule '$action' contains duplicate parameter '$name'."+ }+ }+ }+ return null}private fun validateOptionalIdentityToken(@@ -290,7 +358,12 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInputreturn if (validShape) null else "$label contains unsupported characters."}- private fun validateHttpOverrides(httpUserAgent: String, httpHeaders: String): String? {+ private fun validateHttpOverrides(+ httpUserAgent: String,+ httpHeaders: String,+ allowBlankHeaderValues: Boolean = false,+ allowRestrictedHeaderOverrides: Boolean = false+ ): String? {if (httpUserAgent.any { it == '\r' || it == '\n' }) {return "User-Agent must stay on a single line."}@@ -307,15 +380,15 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInputval seenNames = linkedSetOf<String>()entries.forEach { entry ->val separatorIndex = entry.indexOf(':')- if (separatorIndex <= 0 || separatorIndex == entry.lastIndex) {+ if (separatorIndex <= 0 || (!allowBlankHeaderValues && separatorIndex == entry.lastIndex)) {return "Custom headers must use 'Header-Name: value' format. Separate multiple headers with '|'."}val name = entry.substring(0, separatorIndex).trim()val value = entry.substring(separatorIndex + 1).trim()- if (name.isEmpty() || value.isEmpty()) {+ if (name.isEmpty() || (!allowBlankHeaderValues && value.isEmpty())) {return "Custom headers must include both a header name and a value."}- if (name.lowercase() in DISALLOWED_GENERIC_HEADER_NAMES) {+ if (!allowRestrictedHeaderOverrides && name.lowercase() in DISALLOWED_GENERIC_HEADER_NAMES) {return if (name.equals("User-Agent", ignoreCase = true)) {"Set the User-Agent in the dedicated field instead of custom headers."} else {@@ -323,7 +396,7 @@ class ProviderSetupInputValidatorImpl @Inject constructor() : ProviderSetupInput}}try {- Headers.Builder().add(name, value)+ Headers.Builder().add(name, value.ifEmpty { "x" })} catch (_: IllegalArgumentException) {return "Invalid custom header: $name"}diff --git a/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.kt b/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.ktindex 944f533e..b19bcdb7 100644--- a/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.kt@@ -104,6 +104,144 @@ class OkHttpStalkerApiServiceTest {assertThat(success.data.second.maxConnections).isEqualTo(2)}+ @Test+ fun authenticate_applies_getProfile_param_overrides_and_keeps_jshttprequest_last() = runTest {+ var profileRawQuery = ""+ val service = OkHttpStalkerApiService(+ okHttpClient = OkHttpClient.Builder()+ .addInterceptor { chain ->+ val request = chain.request()+ val action = request.url.queryParameter("action").orEmpty()+ if (action == "get_profile") {+ profileRawQuery = request.url.encodedQuery.orEmpty()+ }+ val body = when (action) {+ "handshake" -> """{"js":{"token":"token-123"}}"""+ "get_profile" -> """{"js":{"name":"Living Room","status":"1"}}"""+ else -> error("Unexpected action '$action'")+ }+ Response.Builder()+ .request(request)+ .protocol(Protocol.HTTP_1_1)+ .code(200)+ .message("OK")+ .body(body.toResponseBody("application/json".toMediaType()))+ .build()+ }+ .build(),+ json = Json { ignoreUnknownKeys = true }+ )++ val result = service.authenticate(+ buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en",+ stalkerAdvancedOptionsJson = StalkerAdvancedOptionsCodec.encode(+ StalkerAdvancedOptions(+ requestRules = listOf(+ StalkerRequestRule(+ action = "get_profile",+ paramOverrides = listOf(+ StalkerParamOverride("hd", "0"),+ StalkerParamOverride("signature", ""),+ StalkerParamOverride("custom_param", "custom-value")+ )+ )+ )+ )+ )+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ assertThat(profileRawQuery).contains("hd=0")+ assertThat(profileRawQuery).doesNotContain("&signature=")+ assertThat(profileRawQuery).contains("custom_param=custom-value")+ assertThat(profileRawQuery.substringAfterLast("&")).isEqualTo("JsHttpRequest=1-xml")+ }++ @Test+ fun authenticate_blockedCriticalRequestFailsLogin() = runTest {+ val service = OkHttpStalkerApiService(+ okHttpClient = fakeClient(+ "handshake" to """{"js":{"token":"token-123"}}""",+ "get_profile" to """{"js":{"name":"Living Room","status":"1"}}"""+ ),+ json = Json { ignoreUnknownKeys = true }+ )++ val result = service.authenticate(+ buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en",+ stalkerAdvancedOptionsJson = StalkerAdvancedOptionsCodec.encode(+ StalkerAdvancedOptions(+ requestRules = listOf(+ StalkerRequestRule(action = "get_profile", blockRequest = true)+ )+ )+ )+ )+ )++ assertThat(result).isInstanceOf(Result.Error::class.java)+ assertThat((result as Result.Error).message).contains("blocked")+ }++ @Test+ fun authenticate_applies_stalker_custom_header_overrides_and_removals() = runTest {+ val seenUserAgents = mutableListOf<String?>()+ val seenReferers = mutableListOf<String?>()+ val seenCustomHeaders = mutableListOf<String?>()+ val service = OkHttpStalkerApiService(+ okHttpClient = OkHttpClient.Builder()+ .addInterceptor { chain ->+ val request = chain.request()+ seenUserAgents += request.header("User-Agent")+ seenReferers += request.header("Referer")+ seenCustomHeaders += request.header("X-Test")+ val action = request.url.queryParameter("action").orEmpty()+ val body = when (action) {+ "handshake" -> """{"js":{"token":"token-123"}}"""+ "get_profile" -> """{"js":{"name":"Living Room","status":"1"}}"""+ else -> error("Unexpected action '$action'")+ }+ Response.Builder()+ .request(request)+ .protocol(Protocol.HTTP_1_1)+ .code(200)+ .message("OK")+ .body(body.toResponseBody("application/json".toMediaType()))+ .build()+ }+ .build(),+ json = Json { ignoreUnknownKeys = true }+ )++ val result = service.authenticate(+ buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en",+ httpUserAgentOverride = "Dedicated Agent/1.0",+ httpHeadersOverride = "User-Agent: Header Agent/2.0 | Referer: | X-Test: enabled"+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ assertThat(seenUserAgents).contains("Header Agent/2.0")+ assertThat(seenReferers).doesNotContain("https://portal.example.com/c/")+ assertThat(seenCustomHeaders).contains("enabled")+ }+@Testfun authenticate_module_gated_recipe_rebuilds_profile_for_modern_mag_preset() = runTest {val requestedStbTypes = mutableListOf<String>()diff --git a/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.kt b/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.ktindex a2f0db16..4c68061a 100644--- a/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.kt@@ -295,6 +295,43 @@ class StalkerProviderTest {assertThat(success.data.headers["Cookie"]).doesNotContain("device_id2=")assertThat(success.data.headers["Cookie"]).doesNotContain("signature=")assertThat(success.data.headers["Accept-Encoding"]).isEqualTo("identity")+ assertThat(success.data.allowInvalidSsl).isTrue()+ }++ @Test+ fun resolvePlaybackInfo_applies_custom_header_overrides_and_user_agent_removal() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(+ profile = StalkerProviderProfile(accountName = "Room"),+ createLinkUrl = "http://fdox.org:8080/play/live.php?stream=228556&play_token=abc123"+ ),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ httpHeaders = "User-Agent: | Referer: | X-Test: enabled",+ playbackBackendHint = com.streamvault.domain.model.StalkerPlaybackBackendHint.TEMP_LINK_STRICT,+ cookieModeHint = com.streamvault.domain.model.StalkerCookieMode.CREATE_LINK,+ deviceProfile = "MAG322",+ timezone = "UTC",+ locale = "en"+ )++ val result = provider.resolvePlaybackInfo(+ kind = StalkerStreamKind.LIVE,+ descriptor = checkNotNull(+ buildStalkerPlaybackDescriptor(+ primaryCmd = "ffmpeg http://localhost/ch/1200_",+ capabilities = StalkerPortalCapabilities(useHttpTemporaryLink = true)+ )+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ assertThat(success.data.userAgent).isNull()+ assertThat(success.data.allowInvalidSsl).isTrue()+ assertThat(success.data.headers).doesNotContainKey("Referer")+ assertThat(success.data.headers["X-Test"]).isEqualTo("enabled")}@Testdiff --git a/data/src/test/java/com/streamvault/data/validation/ProviderSetupInputValidatorImplTest.kt b/data/src/test/java/com/streamvault/data/validation/ProviderSetupInputValidatorImplTest.ktindex 60d18f8b..cf0194a6 100644--- a/data/src/test/java/com/streamvault/data/validation/ProviderSetupInputValidatorImplTest.kt+++ b/data/src/test/java/com/streamvault/data/validation/ProviderSetupInputValidatorImplTest.kt@@ -60,7 +60,8 @@ class ProviderSetupInputValidatorImplTest {authMode: StalkerAuthMode = StalkerAuthMode.AUTO,username: String = "",password: String = "",- macAddress: String = "00:1A:79:12:34:56"+ macAddress: String = "00:1A:79:12:34:56",+ httpHeaders: String = "") = validator.validateStalker(portalUrl = "https://portal.example.com",macAddress = macAddress,@@ -68,6 +69,8 @@ class ProviderSetupInputValidatorImplTest {authMode = authMode,username = username,password = password,+ httpUserAgent = "",+ httpHeaders = httpHeaders,deviceProfile = deviceProfile,timezone = timezone,locale = locale,@@ -83,6 +86,12 @@ class ProviderSetupInputValidatorImplTest {assertThat(result).isInstanceOf(Result.Success::class.java)}+ @Test+ fun `validateStalker allows blank custom header values for default-header removal`() {+ val result = stalkerResult(httpHeaders = "Referer: | X-Test: hello")+ assertThat(result).isInstanceOf(Result.Success::class.java)+ }+@Testfun `validateStalker accepts valid timezone`() {assertThat(stalkerResult(timezone = "America/New_York")).isInstanceOf(Result.Success::class.java)diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 81765371..d689cb93 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -12,6 +12,16 @@ All notable product changes are recorded in this document.- Fixed Stalker profile metrics so `uid` uses Device ID2, and removed `video_out` and `signature` from the generated metrics payload.- Fixed Stalker profile requests to send `prehash=false` literally instead of numeric `0`/`1` values.+### Added++- Added Stalker advanced HTTP header overrides, including support for custom headers and removing default request/playback headers by leaving an override value blank.+- Added Stalker-specific SSL bypass handling for portal requests and player playback so invalid HTTPS certificates no longer block those connections.+- Added Stalker advanced compatibility options for hw_version, separate API/player User-Agent values, Ethernet/WiFi X-User-Agent link type, HTTP proxy support for API and playback, and action-scoped request blocking/parameter overrides.++### Changed++- Changed the Stalker `Device profile` field label in setup to `MAG Type` while keeping the same underlying saved value and behavior.+## [1.0.14] - 2026-06-06### Addeddiff --git a/domain/src/main/java/com/streamvault/domain/manager/ProviderSetupInputValidator.kt b/domain/src/main/java/com/streamvault/domain/manager/ProviderSetupInputValidator.ktindex 82a4aaa0..a5f5c95b 100644--- a/domain/src/main/java/com/streamvault/domain/manager/ProviderSetupInputValidator.kt+++ b/domain/src/main/java/com/streamvault/domain/manager/ProviderSetupInputValidator.kt@@ -26,13 +26,16 @@ data class ValidatedStalkerProviderInput(val authMode: StalkerAuthMode,val username: String,val password: String,+ val httpUserAgent: String,+ val httpHeaders: String,val deviceProfile: String,val timezone: String,val locale: String,val serialNumber: String = "",val deviceId: String = "",val deviceId2: String = "",- val signature: String = ""+ val signature: String = "",+ val stalkerAdvancedOptionsJson: String = "")interface ProviderSetupInputValidator {@@ -61,12 +64,15 @@ interface ProviderSetupInputValidator {username: String,password: String,allowBlankPassword: Boolean = false,+ httpUserAgent: String = "",+ httpHeaders: String = "",deviceProfile: String,timezone: String,locale: String,serialNumber: String = "",deviceId: String = "",deviceId2: String = "",- signature: String = ""+ signature: String = "",+ stalkerAdvancedOptionsJson: String = ""): Result<ValidatedStalkerProviderInput>}diff --git a/domain/src/main/java/com/streamvault/domain/model/Provider.kt b/domain/src/main/java/com/streamvault/domain/model/Provider.ktindex 3f838bde..aaa7de9c 100644--- a/domain/src/main/java/com/streamvault/domain/model/Provider.kt+++ b/domain/src/main/java/com/streamvault/domain/model/Provider.kt@@ -19,6 +19,7 @@ data class Provider(val stalkerDeviceId: String = "",val stalkerDeviceId2: String = "",val stalkerSignature: String = "",+ val stalkerAdvancedOptionsJson: String = "",val stalkerAuthMode: StalkerAuthMode = StalkerAuthMode.AUTO,val stalkerPortalProfile: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,val stalkerPortalFingerprint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,diff --git a/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt b/domain/src/main/java/com/streamvault/domain/model/StreamInfo.ktindex 9842702e..b0da7960 100644--- a/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt+++ b/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt@@ -7,6 +7,9 @@ data class StreamInfo(val title: String? = null,val headers: Map<String, String> = emptyMap(),val userAgent: String? = null,+ val allowInvalidSsl: Boolean = false,+ val proxyHost: String = "",+ val proxyPort: Int? = null,val streamType: StreamType = StreamType.UNKNOWN,val containerExtension: String? = null,val catchUpUrl: String? = null,@@ -16,6 +19,7 @@ data class StreamInfo(init {require(url.isNotBlank()) { "StreamInfo url must not be blank" }expirationTime?.let { require(it >= 0) { "StreamInfo expirationTime must be non-negative" } }+ proxyPort?.let { require(it in 1..65535) { "StreamInfo proxyPort must be between 1 and 65535" } }}}diff --git a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.ktindex bf322db3..420ff55a 100644--- a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt@@ -51,6 +51,8 @@ interface ProviderRepository {authMode: StalkerAuthMode = StalkerAuthMode.AUTO,username: String = "",password: String = "",+ httpUserAgent: String = "",+ httpHeaders: String = "",deviceProfile: String = "",timezone: String = "",locale: String = "",@@ -58,6 +60,7 @@ interface ProviderRepository {deviceId: String = "",deviceId2: String = "",signature: String = "",+ stalkerAdvancedOptionsJson: String = "",epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,onProgress: ((String) -> Unit)? = null,id: Long? = nulldiff --git a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.ktindex e5d45555..47edc0ba 100644--- a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt+++ b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt@@ -43,6 +43,8 @@ data class StalkerProviderSetupCommand(val authMode: StalkerAuthMode = StalkerAuthMode.AUTO,val username: String = "",val password: String = "",+ val httpUserAgent: String = "",+ val httpHeaders: String = "",val deviceProfile: String = "",val timezone: String = "",val locale: String = "",@@ -50,6 +52,7 @@ data class StalkerProviderSetupCommand(val deviceId: String = "",val deviceId2: String = "",val signature: String = "",+ val stalkerAdvancedOptionsJson: String = "",val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.BACKGROUND,val existingProviderId: Long? = null)@@ -126,13 +129,16 @@ class ValidateAndAddProvider @Inject constructor(username = command.username,password = command.password,allowBlankPassword = command.existingProviderId != null,+ httpUserAgent = command.httpUserAgent,+ httpHeaders = command.httpHeaders,deviceProfile = command.deviceProfile,timezone = command.timezone,locale = command.locale,serialNumber = command.serialNumber,deviceId = command.deviceId,deviceId2 = command.deviceId2,- signature = command.signature+ signature = command.signature,+ stalkerAdvancedOptionsJson = command.stalkerAdvancedOptionsJson)) {is Result.Error -> ValidateAndAddProviderResult.ValidationError(result.message)@@ -241,13 +247,16 @@ class ValidateAndAddProvider @Inject constructor(username = command.username,password = command.password,allowBlankPassword = command.existingProviderId != null,+ httpUserAgent = command.httpUserAgent,+ httpHeaders = command.httpHeaders,deviceProfile = command.deviceProfile,timezone = command.timezone,locale = command.locale,serialNumber = command.serialNumber,deviceId = command.deviceId,deviceId2 = command.deviceId2,- signature = command.signature+ signature = command.signature,+ stalkerAdvancedOptionsJson = command.stalkerAdvancedOptionsJson)) {is Result.Success -> providerRepository.loginStalker(@@ -257,6 +266,8 @@ class ValidateAndAddProvider @Inject constructor(authMode = validated.data.authMode,username = validated.data.username,password = validated.data.password,+ httpUserAgent = validated.data.httpUserAgent,+ httpHeaders = validated.data.httpHeaders,deviceProfile = validated.data.deviceProfile,timezone = validated.data.timezone,locale = validated.data.locale,@@ -264,6 +275,7 @@ class ValidateAndAddProvider @Inject constructor(deviceId = validated.data.deviceId,deviceId2 = validated.data.deviceId2,signature = validated.data.signature,+ stalkerAdvancedOptionsJson = validated.data.stalkerAdvancedOptionsJson,epgSyncMode = command.epgSyncMode,onProgress = onProgress,id = command.existingProviderIddiff --git a/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.kt b/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.ktindex 7ee90604..3dca42a5 100644--- a/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.kt+++ b/domain/src/test/java/com/streamvault/domain/usecase/SyncProviderTest.kt@@ -146,6 +146,8 @@ private class FakeSyncProviderRepository(authMode: StalkerAuthMode,username: String,password: String,+ httpUserAgent: String,+ httpHeaders: String,deviceProfile: String,timezone: String,locale: String,@@ -153,6 +155,7 @@ private class FakeSyncProviderRepository(deviceId: String,deviceId2: String,signature: String,+ stalkerAdvancedOptionsJson: String,epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?diff --git a/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.kt b/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.ktindex 088a18db..d87ea2f0 100644--- a/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.kt+++ b/domain/src/test/java/com/streamvault/domain/usecase/ValidateAndAddProviderTest.kt@@ -431,6 +431,8 @@ class ValidateAndAddProviderTest {username = "",password = "",name = "MAG",+ httpUserAgent = "Stalker Agent/1.0",+ httpHeaders = "Referer: | X-Test: enabled",deviceProfile = "MAG250",timezone = "UTC",locale = "en"@@ -448,6 +450,8 @@ class ValidateAndAddProviderTest {username = "",password = "",name = " MAG ",+ httpUserAgent = " Stalker Agent/1.0 ",+ httpHeaders = " Referer: | X-Test: enabled ",deviceProfile = " MAG250 ",timezone = " UTC ",locale = " en ",@@ -465,6 +469,8 @@ class ValidateAndAddProviderTest {username = "",password = "",name = "MAG",+ httpUserAgent = "Stalker Agent/1.0",+ httpHeaders = "Referer: | X-Test: enabled",deviceProfile = "MAG250",timezone = "UTC",locale = "en",@@ -502,6 +508,8 @@ private class FakeProviderSetupInputValidator(username = "",password = "",name = "Provider",+ httpUserAgent = "",+ httpHeaders = "",deviceProfile = "MAG250",timezone = "UTC",locale = "en"@@ -533,13 +541,16 @@ private class FakeProviderSetupInputValidator(username: String,password: String,allowBlankPassword: Boolean,+ httpUserAgent: String,+ httpHeaders: String,deviceProfile: String,timezone: String,locale: String,serialNumber: String,deviceId: String,deviceId2: String,- signature: String+ signature: String,+ stalkerAdvancedOptionsJson: String): Result<ValidatedStalkerProviderInput> = stalkerResult}@@ -573,6 +584,8 @@ private data class StalkerCall(val username: String,val password: String,val name: String,+ val httpUserAgent: String,+ val httpHeaders: String,val deviceProfile: String,val timezone: String,val locale: String,@@ -580,6 +593,7 @@ private data class StalkerCall(val deviceId: String = "",val deviceId2: String = "",val signature: String = "",+ val stalkerAdvancedOptionsJson: String = "",val epgSyncMode: ProviderEpgSyncMode,val id: Long?)@@ -652,6 +666,8 @@ private class FakeProviderRepository : ProviderRepository {authMode: StalkerAuthMode,username: String,password: String,+ httpUserAgent: String,+ httpHeaders: String,deviceProfile: String,timezone: String,locale: String,@@ -659,6 +675,7 @@ private class FakeProviderRepository : ProviderRepository {deviceId: String,deviceId2: String,signature: String,+ stalkerAdvancedOptionsJson: String,epgSyncMode: ProviderEpgSyncMode,onProgress: ((String) -> Unit)?,id: Long?@@ -670,6 +687,8 @@ private class FakeProviderRepository : ProviderRepository {username = username,password = password,name = name,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,deviceProfile = deviceProfile,timezone = timezone,locale = locale,@@ -677,6 +696,7 @@ private class FakeProviderRepository : ProviderRepository {deviceId = deviceId,deviceId2 = deviceId2,signature = signature,+ stalkerAdvancedOptionsJson = stalkerAdvancedOptionsJson,epgSyncMode = epgSyncMode,id = id)@@ -685,6 +705,8 @@ private class FakeProviderRepository : ProviderRepository {serverUrl = portalUrl,username = username,password = password,+ httpUserAgent = httpUserAgent,+ httpHeaders = httpHeaders,stalkerMacAddress = macAddress,stalkerAuthMode = authMode,stalkerDeviceProfile = deviceProfile,diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.ktindex 062afa1a..39db6afc 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt@@ -8,6 +8,8 @@ import androidx.media3.datasource.DataSourceimport androidx.media3.datasource.okhttp.OkHttpDataSourceimport com.streamvault.domain.model.VodHttpProtocolModeimport com.streamvault.domain.model.StreamInfo+import java.net.InetSocketAddress+import java.net.Proxyimport java.net.URIimport java.util.concurrent.ConcurrentHashMapimport java.util.concurrent.TimeUnit@@ -30,7 +32,10 @@ class PlayerDataSourceFactoryProvider(private data class ClientKey(val profile: PlayerTimeoutProfile,val forceHttp1: Boolean,- val port: Int+ val port: Int,+ val allowInvalidSsl: Boolean,+ val proxyHost: String,+ val proxyPort: Int?)private val addressHealthStore = PlayerAddressHealthStore()@@ -53,8 +58,21 @@ class PlayerDataSourceFactoryProvider(vodHttpProtocolMode = vodHttpProtocolMode)val port = streamPort(streamInfo.url)- val client = clientsByKey.computeIfAbsent(ClientKey(profile, forceHttp1, port)) {- baseClient.newBuilder()+ val clientKey = ClientKey(+ profile = profile,+ forceHttp1 = forceHttp1,+ port = port,+ allowInvalidSsl = streamInfo.allowInvalidSsl,+ proxyHost = streamInfo.proxyHost.trim(),+ proxyPort = streamInfo.proxyPort+ )+ val client = clientsByKey.computeIfAbsent(clientKey) {+ val builder = if (streamInfo.allowInvalidSsl) {+ baseClient.newBuilder().applyUnsafeTlsBypass()+ } else {+ baseClient.newBuilder()+ }+ builder.addInterceptor(StalkerPlaybackRequestLoggingInterceptor).connectTimeout(profile.connectTimeoutMs, TimeUnit.MILLISECONDS).readTimeout(profile.readTimeoutMs, TimeUnit.MILLISECONDS)@@ -65,6 +83,7 @@ class PlayerDataSourceFactoryProvider(if (forceHttp1) {protocols(listOf(Protocol.HTTP_1_1))}+ streamInfo.httpProxy()?.let { proxy(it) }}.build()}@@ -119,6 +138,12 @@ class PlayerDataSourceFactoryProvider(else -> -1}}++ private fun StreamInfo.httpProxy(): Proxy? {+ val host = proxyHost.trim().takeIf { it.isNotBlank() } ?: return null+ val port = proxyPort ?: return null+ return Proxy(Proxy.Type.HTTP, InetSocketAddress(host, port))+ }}internal fun effectivePlaybackRequestProperties(diff --git a/player/src/main/java/com/streamvault/player/playback/UnsafeTlsSupport.kt b/player/src/main/java/com/streamvault/player/playback/UnsafeTlsSupport.ktnew file mode 100644index 00000000..b6409cae--- /dev/null+++ b/player/src/main/java/com/streamvault/player/playback/UnsafeTlsSupport.kt@@ -0,0 +1,21 @@+package com.streamvault.player.playback++import java.security.SecureRandom+import java.security.cert.X509Certificate+import javax.net.ssl.HostnameVerifier+import javax.net.ssl.SSLContext+import javax.net.ssl.X509TrustManager+import okhttp3.OkHttpClient++fun OkHttpClient.Builder.applyUnsafeTlsBypass(): OkHttpClient.Builder {+ val trustAllManager = object : X509TrustManager {+ override fun checkClientTrusted(chain: Array<out X509Certificate>?, authType: String?) = Unit+ override fun checkServerTrusted(chain: Array<out X509Certificate>?, authType: String?) = Unit+ override fun getAcceptedIssuers(): Array<X509Certificate> = emptyArray()+ }+ val sslContext = SSLContext.getInstance("TLS").apply {+ init(null, arrayOf(trustAllManager), SecureRandom())+ }+ return sslSocketFactory(sslContext.socketFactory, trustAllManager)+ .hostnameVerifier(HostnameVerifier { _, _ -> true })+}diff --git a/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.kt b/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.ktindex 5b38c67d..dd0e8daa 100644--- a/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.kt+++ b/player/src/main/java/com/streamvault/player/timeshift/LiveTimeshiftManager.kt@@ -5,12 +5,16 @@ import android.content.Contextimport android.content.res.Configurationimport com.streamvault.domain.model.StreamInfoimport com.streamvault.domain.model.StreamType+import com.streamvault.player.playback.applyUnsafeTlsBypassimport dagger.hilt.android.qualifiers.ApplicationContextimport java.io.ByteArrayOutputStreamimport java.io.Fileimport java.io.IOException+import java.net.InetSocketAddress+import java.net.Proxyimport java.net.URIimport java.util.Locale+import java.util.concurrent.ConcurrentHashMapimport java.util.concurrent.atomic.AtomicLongimport javax.inject.Injectimport javax.inject.Singleton@@ -71,6 +75,12 @@ internal class DefaultLiveTimeshiftManager @Inject constructor(@param:ApplicationContext private val context: Context,private val okHttpClient: OkHttpClient) : LiveTimeshiftManager, ComponentCallbacks2 {+ private val unsafeOkHttpClient: OkHttpClient by lazy {+ okHttpClient.newBuilder()+ .applyUnsafeTlsBypass()+ .build()+ }+ private val proxiedClients = ConcurrentHashMap<String, OkHttpClient>()init {context.registerComponentCallbacks(this)@@ -299,11 +309,33 @@ internal class DefaultLiveTimeshiftManager @Inject constructor(}.build()protected fun trackCall(request: Request): okhttp3.Call {- val call = okHttpClient.newCall(request)+ val call = httpClientFor(streamInfo).newCall(request)activeCall = callreturn call}+ private fun httpClientFor(streamInfo: StreamInfo): OkHttpClient {+ val proxy = streamInfo.httpProxy()+ if (proxy == null) {+ return if (streamInfo.allowInvalidSsl) unsafeOkHttpClient else okHttpClient+ }+ val key = "${streamInfo.allowInvalidSsl}:${streamInfo.proxyHost.trim()}:${streamInfo.proxyPort}"+ return proxiedClients.computeIfAbsent(key) {+ val builder = if (streamInfo.allowInvalidSsl) {+ okHttpClient.newBuilder().applyUnsafeTlsBypass()+ } else {+ okHttpClient.newBuilder()+ }+ builder.proxy(proxy).build()+ }+ }++ private fun StreamInfo.httpProxy(): Proxy? {+ val host = proxyHost.trim().takeIf { it.isNotBlank() } ?: return null+ val port = proxyPort ?: return null+ return Proxy(Proxy.Type.HTTP, InetSocketAddress(host, port))+ }+protected fun clearTrackedCall(call: okhttp3.Call) {if (activeCall === call) {activeCall = nulldiff --git a/player/src/test/java/com/streamvault/player/playback/PlayerDataSourceFactoryProviderTest.kt b/player/src/test/java/com/streamvault/player/playback/PlayerDataSourceFactoryProviderTest.ktindex 6441be38..844b72d4 100644--- a/player/src/test/java/com/streamvault/player/playback/PlayerDataSourceFactoryProviderTest.kt+++ b/player/src/test/java/com/streamvault/player/playback/PlayerDataSourceFactoryProviderTest.kt@@ -48,6 +48,23 @@ class PlayerDataSourceFactoryProviderTest {assertThat(headers).isEqualTo(original)}+ @Test+ fun `effective playback request properties keep non user agent headers intact`() {+ val headers = effectivePlaybackRequestProperties(+ headers = mapOf(+ "Cookie" to "mac=00%3A11",+ "X-User-Agent" to "Model: MAG322; Link: Ethernet"+ ),+ userAgent = "StalkerAgent/1.0"+ )++ assertThat(headers).containsExactly(+ "Cookie", "mac=00%3A11",+ "X-User-Agent", "Model: MAG322; Link: Ethernet",+ "User-Agent", "StalkerAgent/1.0"+ )+ }+@Testfun `mpeg ts live keeps okhttp data source`() {assertThat(shouldUsePlatformHttpDataSource(ResolvedStreamType.MPEG_TS_LIVE)).isFalse()