Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

Add unit tests for JellyfinImageAuthInterceptor functionality

David Nashashd2d826612136
diff --git a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt
index a948b2fa..d7930b06 100644
--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt
+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt
@@ -111,7 +111,8 @@ object DatabaseModule {
StreamVaultDatabase.MIGRATION_67_68,
StreamVaultDatabase.MIGRATION_68_69,
StreamVaultDatabase.MIGRATION_69_70,
- StreamVaultDatabase.MIGRATION_70_71
+ StreamVaultDatabase.MIGRATION_70_71,
+ StreamVaultDatabase.MIGRATION_71_72
)
// 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/plugins/PluginModels.kt b/app/src/main/java/com/streamvault/app/plugins/PluginModels.kt
index 447d25f0..913138c0 100644
--- a/app/src/main/java/com/streamvault/app/plugins/PluginModels.kt
+++ b/app/src/main/java/com/streamvault/app/plugins/PluginModels.kt
@@ -57,6 +57,14 @@ data class StreamVaultPluginOwner(
val packageName: String,
val serviceClassName: String,
val manifestId: String
+) {
+ val component: StreamVaultPluginComponent
+ get() = StreamVaultPluginComponent(packageName, serviceClassName)
+}
+
+data class StreamVaultPluginComponent(
+ val packageName: String,
+ val serviceClassName: String
)
val InstalledStreamVaultPlugin.owner: StreamVaultPluginOwner
diff --git a/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt b/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt
index 55c7cb24..b262b0bc 100644
--- a/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt
+++ b/app/src/main/java/com/streamvault/app/plugins/StreamVaultPluginManager.kt
@@ -73,7 +73,23 @@ class StreamVaultPluginManager @Inject constructor(
private var discoveryExpiresAtMillis = 0L
private val packageChangeReceiver = object : BroadcastReceiver() {
- override fun onReceive(context: Context, intent: Intent) = invalidateDiscovery()
+ override fun onReceive(context: Context, intent: Intent) {
+ invalidateDiscovery()
+ // Package broadcasts are the authoritative lifecycle signal. Reconcile immediately
+ // instead of waiting for the next process start, especially after external uninstall.
+ val pendingResult = goAsync()
+ backgroundScope.launch {
+ try {
+ reconcilePluginProviders()
+ } catch (cancelled: CancellationException) {
+ throw cancelled
+ } catch (_: Exception) {
+ // Startup reconciliation is the durable retry path.
+ } finally {
+ pendingResult.finish()
+ }
+ }
+ }
}
init {
@@ -107,21 +123,20 @@ class StreamVaultPluginManager @Inject constructor(
}
}
- /** Removes only providers with a durable ownership record for an uninstalled plugin service. */
+ /**
+ * Removes only providers whose Android service component is no longer installed.
+ *
+ * Manifest retrieval is intentionally absent from this decision: an unresponsive service,
+ * malformed update, or manifest-ID rename is not proof that its provider is orphaned.
+ */
suspend fun reconcilePluginProviders() = withContext(Dispatchers.IO) {
- val installedOwners = queryPluginServices().mapNotNull { resolveInfo ->
+ val installedComponents = queryPluginServices().mapNotNull { resolveInfo ->
val serviceInfo = resolveInfo.serviceInfo ?: return@mapNotNull null
val packageName = serviceInfo.packageName ?: return@mapNotNull null
val serviceName = serviceInfo.name ?: return@mapNotNull null
- val manifest = readManifestFromService(packageName, serviceName)
- ?: readManifestFromMetadata(serviceInfo.metaData)
- ?: StreamVaultPluginManifest(id = packageName, name = packageName)
- StreamVaultPluginOwner(packageName, serviceName, manifest.id)
+ StreamVaultPluginComponent(packageName, serviceName)
}.toSet()
- pluginProviderOwnershipDao.getAll()
- .filter { ownership ->
- StreamVaultPluginOwner(ownership.packageName, ownership.serviceClassName, ownership.manifestId) !in installedOwners
- }
+ orphanedPluginOwnerships(pluginProviderOwnershipDao.getAll(), installedComponents)
.forEach { ownership -> removeOwnedProvider(ownership) }
}
@@ -591,11 +606,7 @@ class StreamVaultPluginManager @Inject constructor(
}
private suspend fun removePluginProvider(plugin: InstalledStreamVaultPlugin): PluginActionResult? {
- val ownership = pluginProviderOwnershipDao.get(
- plugin.packageName,
- plugin.serviceClassName,
- plugin.manifest.id
- ) ?: return null
+ val ownership = trackedOwnership(plugin) ?: return null
return removeOwnedProvider(ownership)
}
@@ -611,14 +622,32 @@ class StreamVaultPluginManager @Inject constructor(
}
private suspend fun trackedProvider(plugin: InstalledStreamVaultPlugin): Provider? {
- val ownership = pluginProviderOwnershipDao.get(
- plugin.packageName,
- plugin.serviceClassName,
- plugin.manifest.id
- ) ?: return null
+ val ownership = trackedOwnership(plugin) ?: return null
return providerRepository.getProvider(ownership.providerId)
}
+ /**
+ * Resolves an exact owner first. A sole mapping for the same installed component is an
+ * unambiguous manifest-ID rename and is re-keyed atomically. Multiple legacy mappings are
+ * never guessed between.
+ */
+ private suspend fun trackedOwnership(
+ plugin: InstalledStreamVaultPlugin
+ ): PluginProviderOwnershipEntity? {
+ val owner = plugin.owner
+ pluginProviderOwnershipDao.get(
+ owner.packageName,
+ owner.serviceClassName,
+ owner.manifestId
+ )?.let { return it }
+ val componentOwnerships = pluginProviderOwnershipDao.getByComponent(
+ owner.packageName,
+ owner.serviceClassName
+ )
+ val ownership = selectPluginOwnership(owner, componentOwnerships) ?: return null
+ return pluginProviderOwnershipDao.rekeyManifestId(ownership, owner.manifestId)
+ }
+
private fun refreshTvInputCatalogInBackground() {
backgroundScope.launchCatching { tvInputChannelSyncManager.refreshTvInputCatalog() }
}
@@ -859,6 +888,30 @@ private fun String.isSafeHttpHeaderName(): Boolean =
char.isLetterOrDigit() || char in setOf('!', '#', '$', '%', '&', '\'', '*', '+', '.', '^', '_', '`', '|', '~', '-')
}
+internal fun orphanedPluginOwnerships(
+ ownerships: List<PluginProviderOwnershipEntity>,
+ installedComponents: Set<StreamVaultPluginComponent>
+): List<PluginProviderOwnershipEntity> = ownerships.filter { ownership ->
+ StreamVaultPluginComponent(ownership.packageName, ownership.serviceClassName) !in installedComponents
+}
+
+internal fun selectPluginOwnership(
+ owner: StreamVaultPluginOwner,
+ componentOwnerships: List<PluginProviderOwnershipEntity>
+): PluginProviderOwnershipEntity? {
+ componentOwnerships.firstOrNull { ownership ->
+ ownership.packageName == owner.packageName &&
+ ownership.serviceClassName == owner.serviceClassName &&
+ ownership.manifestId == owner.manifestId
+ }?.let { return it }
+ return componentOwnerships
+ .filter { ownership ->
+ ownership.packageName == owner.packageName &&
+ ownership.serviceClassName == owner.serviceClassName
+ }
+ .singleOrNull()
+}
+
@Suppress("DEPRECATION")
private fun Bundle.metaString(key: String): String = when (val value = get(key)) {
is String -> value
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgActions.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgActions.kt
index e03ab101..522dccc7 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgActions.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgActions.kt
@@ -1,6 +1,7 @@
package com.streamvault.app.ui.screens.settings
import com.streamvault.domain.model.Result
+import com.streamvault.domain.model.XmltvTimezonePolicy
import com.streamvault.domain.repository.EpgSourceRepository
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
@@ -39,10 +40,28 @@ internal class SettingsEpgActions(
}
}
- fun addEpgSource(scope: CoroutineScope, name: String, url: String, onSuccess: () -> Unit = {}, onError: () -> Unit = {}) {
+ fun addEpgSource(
+ scope: CoroutineScope,
+ name: String,
+ url: String,
+ timezoneId: String?,
+ onSuccess: () -> Unit = {},
+ onError: () -> Unit = {}
+ ) {
scope.launch {
try {
- val result = epgSourceRepository.addSource(name, url)
+ val normalizedTimezoneId = timezoneId?.trim()?.takeIf(String::isNotEmpty)
+ val timezonePolicy = when {
+ normalizedTimezoneId == null -> XmltvTimezonePolicy.REQUIRE_OFFSET
+ normalizedTimezoneId.equals("UTC", ignoreCase = true) -> XmltvTimezonePolicy.UTC
+ else -> XmltvTimezonePolicy.EXPLICIT_ZONE
+ }
+ val result = epgSourceRepository.addSource(
+ name = name,
+ url = url,
+ timezonePolicy = timezonePolicy,
+ timezoneId = normalizedTimezoneId
+ )
if (result is Result.Error) {
uiState.update { it.copy(userMessage = result.message) }
onError()
@@ -58,6 +77,54 @@ internal class SettingsEpgActions(
}
}
+ fun updateEpgSourceTimezone(
+ scope: CoroutineScope,
+ source: com.streamvault.domain.model.EpgSource,
+ timezoneId: String?,
+ onSuccess: () -> Unit = {},
+ onError: () -> Unit = {}
+ ) {
+ scope.launch {
+ try {
+ val normalizedTimezoneId = timezoneId?.trim()?.takeIf(String::isNotEmpty)
+ val timezonePolicy = when {
+ normalizedTimezoneId == null -> XmltvTimezonePolicy.REQUIRE_OFFSET
+ normalizedTimezoneId.equals("UTC", ignoreCase = true) -> XmltvTimezonePolicy.UTC
+ else -> XmltvTimezonePolicy.EXPLICIT_ZONE
+ }
+ val updateResult = epgSourceRepository.updateSource(
+ source.copy(
+ timezonePolicy = timezonePolicy,
+ timezoneId = normalizedTimezoneId
+ )
+ )
+ if (updateResult is Result.Error) {
+ uiState.update { it.copy(userMessage = updateResult.message) }
+ onError()
+ return@launch
+ }
+
+ val affectedProviders = epgSourceRepository.getProviderIdsForSource(source.id)
+ val refreshResult = epgSourceRepository.refreshSource(source.id)
+ if (refreshResult is Result.Error) {
+ uiState.update {
+ it.copy(userMessage = "Timezone saved, but refresh failed: ${refreshResult.message}")
+ }
+ onError()
+ } else {
+ refreshLoadedResolutionSummaries(affectedProviders)
+ uiState.update { it.copy(userMessage = "EPG timezone updated") }
+ onSuccess()
+ }
+ } catch (cancelled: CancellationException) {
+ throw cancelled
+ } catch (error: Exception) {
+ showUnexpectedError(error, "Failed to update EPG timezone")
+ onError()
+ }
+ }
+ }
+
fun deleteEpgSource(scope: CoroutineScope, sourceId: Long) {
scope.launch {
try {
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt
index 75f4637c..36ba811f 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSection.kt
@@ -84,6 +84,9 @@ internal fun LazyListScope.epgSourcesSection(
pendingDelete = uiState.epgPendingDeleteSourceId == source.id,
onToggleEnabled = { enabled -> viewModel.toggleEpgSourceEnabled(source.id, enabled) },
onRefresh = { viewModel.refreshEpgSource(source.id) },
+ onUpdateTimezone = { timezoneId, onSuccess, onError ->
+ viewModel.updateEpgSourceTimezone(source, timezoneId, onSuccess, onError)
+ },
onSetPendingDelete = { pending ->
viewModel.setPendingDeleteEpgSource(if (pending) source.id else null)
},
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSourceComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSourceComponents.kt
index f8dde059..b4765925 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSourceComponents.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsEpgSourceComponents.kt
@@ -32,6 +32,7 @@ import com.streamvault.app.ui.interaction.TvClickableSurface
import com.streamvault.app.ui.theme.OnSurfaceDim
import com.streamvault.app.ui.theme.Primary
import com.streamvault.domain.model.EpgSource
+import com.streamvault.domain.model.XmltvTimezonePolicy
@Composable
internal fun EpgSourceCard(
@@ -40,9 +41,21 @@ internal fun EpgSourceCard(
pendingDelete: Boolean,
onToggleEnabled: (Boolean) -> Unit,
onRefresh: () -> Unit,
+ onUpdateTimezone: (String?, () -> Unit, () -> Unit) -> Unit,
onSetPendingDelete: (Boolean) -> Unit,
onDelete: () -> Unit
) {
+ var editingTimezone by remember(source.id) { mutableStateOf(false) }
+ var timezoneInput by remember(source.id, source.timezonePolicy, source.timezoneId) {
+ mutableStateOf(
+ when (source.timezonePolicy) {
+ XmltvTimezonePolicy.REQUIRE_OFFSET -> ""
+ XmltvTimezonePolicy.UTC -> "UTC"
+ XmltvTimezonePolicy.EXPLICIT_ZONE -> source.timezoneId.orEmpty()
+ }
+ )
+ }
+ var savingTimezone by remember(source.id) { mutableStateOf(false) }
Box(
modifier = Modifier
.fillMaxWidth()
@@ -54,6 +67,68 @@ internal fun EpgSourceCard(
Column(modifier = Modifier.weight(1f)) {
Text(source.name, style = MaterialTheme.typography.titleSmall, color = Color.White)
Text(displayableEpgUrl(source.url), style = MaterialTheme.typography.bodySmall, color = OnSurfaceDim, maxLines = 1)
+ Text(
+ text = when (source.timezonePolicy) {
+ XmltvTimezonePolicy.REQUIRE_OFFSET -> "Timezone: XMLTV offset required"
+ XmltvTimezonePolicy.UTC -> "Timezone: UTC"
+ XmltvTimezonePolicy.EXPLICIT_ZONE -> "Timezone: ${source.timezoneId}"
+ },
+ style = MaterialTheme.typography.bodySmall,
+ color = OnSurfaceDim
+ )
+ if (editingTimezone) {
+ EpgSourceTextField(
+ value = timezoneInput,
+ onValueChange = { timezoneInput = it },
+ placeholder = "IANA timezone, UTC, or blank to require XMLTV offsets"
+ )
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ TvClickableSurface(
+ onClick = {
+ savingTimezone = true
+ onUpdateTimezone(
+ timezoneInput.trim().takeIf(String::isNotEmpty),
+ {
+ savingTimezone = false
+ editingTimezone = false
+ },
+ { savingTimezone = false }
+ )
+ },
+ enabled = !savingTimezone,
+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = Primary.copy(alpha = 0.15f),
+ focusedContainerColor = Primary.copy(alpha = 0.3f)
+ ),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
+ ) {
+ Text(
+ if (savingTimezone) "Saving..." else "Save timezone",
+ modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp),
+ style = MaterialTheme.typography.labelSmall,
+ color = Primary
+ )
+ }
+ TvClickableSurface(
+ onClick = { editingTimezone = false },
+ enabled = !savingTimezone,
+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = Color.White.copy(alpha = 0.08f),
+ focusedContainerColor = Color.White.copy(alpha = 0.15f)
+ ),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
+ ) {
+ Text(
+ "Cancel",
+ modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp),
+ style = MaterialTheme.typography.labelSmall,
+ color = OnSurfaceDim
+ )
+ }
+ }
+ }
if (source.lastError != null) {
Text("Error: ${source.lastError}", style = MaterialTheme.typography.bodySmall, color = Color(0xFFEF5350))
}
@@ -64,6 +139,23 @@ internal fun EpgSourceCard(
}
val sourceActionShape = RoundedCornerShape(8.dp)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ TvClickableSurface(
+ onClick = { editingTimezone = !editingTimezone },
+ shape = ClickableSurfaceDefaults.shape(sourceActionShape),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = Color.White.copy(alpha = 0.08f),
+ focusedContainerColor = Color.White.copy(alpha = 0.15f)
+ ),
+ border = epgActionBorder(sourceActionShape),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
+ ) {
+ Text(
+ "Timezone",
+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp),
+ style = MaterialTheme.typography.labelSmall,
+ color = OnSurfaceDim
+ )
+ }
TvClickableSurface(
onClick = { onToggleEnabled(!source.enabled) },
shape = ClickableSurfaceDefaults.shape(sourceActionShape),
@@ -148,6 +240,7 @@ internal fun EpgSourceCard(
internal fun AddEpgSourceCard(viewModel: SettingsViewModel) {
var newName by remember { mutableStateOf("") }
var newUrl by remember { mutableStateOf("") }
+ var newTimezoneId by remember { mutableStateOf("") }
var isSubmitting by remember { mutableStateOf(false) }
val context = LocalContext.current
val filePickerLauncher = rememberLauncherForActivityResult(
@@ -196,17 +289,24 @@ internal fun AddEpgSourceCard(viewModel: SettingsViewModel) {
Text("Browse", modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp), style = MaterialTheme.typography.labelMedium, color = Primary)
}
}
+ EpgSourceTextField(
+ value = newTimezoneId,
+ onValueChange = { newTimezoneId = it },
+ placeholder = "Timezone for offset-less dates (e.g. Europe/Amsterdam); blank requires XMLTV offsets"
+ )
val addSourceShape = RoundedCornerShape(8.dp)
TvClickableSurface(
onClick = {
if (!isSubmitting && newName.isNotBlank() && newUrl.isNotBlank()) {
val nameToSubmit = newName.trim()
val urlToSubmit = newUrl.trim()
+ val timezoneToSubmit = newTimezoneId.trim().takeIf(String::isNotEmpty)
isSubmitting = true
- viewModel.addEpgSource(nameToSubmit, urlToSubmit,
+ viewModel.addEpgSource(nameToSubmit, urlToSubmit, timezoneToSubmit,
onSuccess = {
newName = ""
newUrl = ""
+ newTimezoneId = ""
isSubmitting = false
},
onError = { isSubmitting = false }
@@ -248,4 +348,4 @@ private fun displayableEpgUrl(url: String): String = when {
if (!decoded.isNullOrBlank() && decoded.length < 60) "local: $decoded" else "local file"
}
else -> url
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt
index 98c64ae3..dbc4b620 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt
@@ -1246,8 +1246,29 @@ class SettingsViewModel @Inject constructor(
epgActions.loadEpgAssignments(viewModelScope, providerId)
}
- fun addEpgSource(name: String, url: String, onSuccess: () -> Unit = {}, onError: () -> Unit = {}) {
- epgActions.addEpgSource(viewModelScope, name, url, onSuccess, onError)
+ fun addEpgSource(
+ name: String,
+ url: String,
+ timezoneId: String? = null,
+ onSuccess: () -> Unit = {},
+ onError: () -> Unit = {}
+ ) {
+ epgActions.addEpgSource(viewModelScope, name, url, timezoneId, onSuccess, onError)
+ }
+
+ fun updateEpgSourceTimezone(
+ source: com.streamvault.domain.model.EpgSource,
+ timezoneId: String?,
+ onSuccess: () -> Unit = {},
+ onError: () -> Unit = {}
+ ) {
+ epgActions.updateEpgSourceTimezone(
+ viewModelScope,
+ source,
+ timezoneId,
+ onSuccess,
+ onError
+ )
}
fun setPendingDeleteEpgSource(id: Long?) {
diff --git a/app/src/test/java/com/streamvault/app/plugins/StreamVaultPluginOwnerTest.kt b/app/src/test/java/com/streamvault/app/plugins/StreamVaultPluginOwnerTest.kt
index 93a8c035..009a13ec 100644
--- a/app/src/test/java/com/streamvault/app/plugins/StreamVaultPluginOwnerTest.kt
+++ b/app/src/test/java/com/streamvault/app/plugins/StreamVaultPluginOwnerTest.kt
@@ -1,6 +1,7 @@
package com.streamvault.app.plugins
import com.google.common.truth.Truth.assertThat
+import com.streamvault.data.local.entity.PluginProviderOwnershipEntity
import org.junit.Test
class StreamVaultPluginOwnerTest {
@@ -20,4 +21,75 @@ class StreamVaultPluginOwnerTest {
assertThat(first).isNotEqualTo(second)
}
+
+ @Test
+ fun `manifest rename retains sole provider owned by the same component`() {
+ val ownership = ownership(
+ packageName = "com.example.plugin",
+ serviceClassName = "PluginService",
+ manifestId = "old-id",
+ providerId = 42L
+ )
+
+ val selected = selectPluginOwnership(
+ StreamVaultPluginOwner("com.example.plugin", "PluginService", "new-id"),
+ listOf(ownership)
+ )
+
+ assertThat(selected).isEqualTo(ownership)
+ }
+
+ @Test
+ fun `manifest rename never adopts an ambiguous component mapping`() {
+ val owner = StreamVaultPluginOwner("com.example.plugin", "PluginService", "new-id")
+ val ownerships = listOf(
+ ownership(owner.packageName, owner.serviceClassName, "old-a", 41L),
+ ownership(owner.packageName, owner.serviceClassName, "old-b", 42L)
+ )
+
+ assertThat(selectPluginOwnership(owner, ownerships)).isNull()
+ }
+
+ @Test
+ fun `reconciliation ignores manifest IDs while installed component remains`() {
+ val ownership = ownership(
+ packageName = "com.example.plugin",
+ serviceClassName = "PluginService",
+ manifestId = "manifest-unavailable-or-renamed",
+ providerId = 42L
+ )
+
+ val orphaned = orphanedPluginOwnerships(
+ listOf(ownership),
+ setOf(StreamVaultPluginComponent(ownership.packageName, ownership.serviceClassName))
+ )
+
+ assertThat(orphaned).isEmpty()
+ }
+
+ @Test
+ fun `reconciliation removes only ownership for an absent component`() {
+ val installed = ownership("com.example.installed", "PluginService", "shared-id", 41L)
+ val removed = ownership("com.example.removed", "PluginService", "shared-id", 42L)
+
+ val orphaned = orphanedPluginOwnerships(
+ listOf(installed, removed),
+ setOf(StreamVaultPluginComponent(installed.packageName, installed.serviceClassName))
+ )
+
+ assertThat(orphaned).containsExactly(removed)
+ }
+
+ private fun ownership(
+ packageName: String,
+ serviceClassName: String,
+ manifestId: String,
+ providerId: Long
+ ) = PluginProviderOwnershipEntity(
+ packageName = packageName,
+ serviceClassName = serviceClassName,
+ manifestId = manifestId,
+ providerId = providerId,
+ createdAt = 1L
+ )
}
diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/72.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/72.json
new file mode 100644
index 00000000..5d3878c9
--- /dev/null
+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/72.json
@@ -0,0 +1,5977 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 72,
+ "identityHash": "587ce50641fa03e4737b79b8c3d51d3c",
+ "entities": [
+ {
+ "tableName": "providers",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `server_url` TEXT NOT NULL, `username` TEXT NOT NULL, `password` TEXT NOT NULL, `m3u_url` TEXT NOT NULL, `epg_url` TEXT NOT NULL, `http_user_agent` TEXT NOT NULL, `http_headers` TEXT NOT NULL, `stalker_mac_address` TEXT NOT NULL, `stalker_device_profile` TEXT NOT NULL, `stalker_device_timezone` TEXT NOT NULL, `stalker_device_locale` TEXT NOT NULL, `stalker_serial_number` TEXT NOT NULL, `stalker_device_id` TEXT NOT NULL, `stalker_device_id2` TEXT NOT NULL, `stalker_signature` TEXT NOT NULL, `stalker_advanced_options_json` TEXT NOT NULL, `stalker_auth_mode` TEXT NOT NULL, `stalker_portal_profile` TEXT NOT NULL, `stalker_portal_fingerprint` TEXT NOT NULL, `stalker_mag_preset` TEXT NOT NULL, `stalker_last_bootstrap_recipe` TEXT NOT NULL, `stalker_endpoint_preference` TEXT NOT NULL, `stalker_cookie_mode` TEXT NOT NULL, `stalker_playback_backend_hint` TEXT NOT NULL, `stalker_last_playback_mode` TEXT, `stalker_credentials_required` INTEGER NOT NULL, `stalker_mac_required` INTEGER NOT NULL, `stalker_uses_temp_links` INTEGER NOT NULL, `stalker_module_restricted` INTEGER NOT NULL, `stalker_strict_fingerprint_required` INTEGER NOT NULL, `stalker_recipe_fallback_used` INTEGER NOT NULL, `stalker_recipe_rediscovery_attempts` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `epg_sync_mode` TEXT NOT NULL, `guide_source_policy` TEXT NOT NULL, `channel_logo_source_policy` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `xtream_live_sync_mode` TEXT NOT NULL, `m3u_vod_classification_enabled` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "serverUrl",
+ "columnName": "server_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "username",
+ "columnName": "username",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "password",
+ "columnName": "password",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "m3uUrl",
+ "columnName": "m3u_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgUrl",
+ "columnName": "epg_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "httpUserAgent",
+ "columnName": "http_user_agent",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "httpHeaders",
+ "columnName": "http_headers",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerMacAddress",
+ "columnName": "stalker_mac_address",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceProfile",
+ "columnName": "stalker_device_profile",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceTimezone",
+ "columnName": "stalker_device_timezone",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceLocale",
+ "columnName": "stalker_device_locale",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerSerialNumber",
+ "columnName": "stalker_serial_number",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceId",
+ "columnName": "stalker_device_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceId2",
+ "columnName": "stalker_device_id2",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerSignature",
+ "columnName": "stalker_signature",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerAdvancedOptionsJson",
+ "columnName": "stalker_advanced_options_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerAuthMode",
+ "columnName": "stalker_auth_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerPortalProfile",
+ "columnName": "stalker_portal_profile",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerPortalFingerprint",
+ "columnName": "stalker_portal_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerMagPreset",
+ "columnName": "stalker_mag_preset",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerLastBootstrapRecipe",
+ "columnName": "stalker_last_bootstrap_recipe",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerEndpointPreference",
+ "columnName": "stalker_endpoint_preference",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerCookieMode",
+ "columnName": "stalker_cookie_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerPlaybackBackendHint",
+ "columnName": "stalker_playback_backend_hint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerLastPlaybackMode",
+ "columnName": "stalker_last_playback_mode",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "stalkerCredentialsRequired",
+ "columnName": "stalker_credentials_required",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerMacRequired",
+ "columnName": "stalker_mac_required",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerUsesTemporaryLinks",
+ "columnName": "stalker_uses_temp_links",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerModuleRestricted",
+ "columnName": "stalker_module_restricted",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerStrictFingerprintRequired",
+ "columnName": "stalker_strict_fingerprint_required",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerRecipeFallbackUsed",
+ "columnName": "stalker_recipe_fallback_used",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerRecipeRediscoveryAttempts",
+ "columnName": "stalker_recipe_rediscovery_attempts",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isActive",
+ "columnName": "is_active",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "maxConnections",
+ "columnName": "max_connections",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "expirationDate",
+ "columnName": "expiration_date",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "apiVersion",
+ "columnName": "api_version",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "allowedOutputFormatsJson",
+ "columnName": "allowed_output_formats_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSyncMode",
+ "columnName": "epg_sync_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "guideSourcePolicy",
+ "columnName": "guide_source_policy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelLogoSourcePolicy",
+ "columnName": "channel_logo_source_policy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xtreamFastSyncEnabled",
+ "columnName": "xtream_fast_sync_enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xtreamLiveSyncMode",
+ "columnName": "xtream_live_sync_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "m3uVodClassificationEnabled",
+ "columnName": "m3u_vod_classification_enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncedAt",
+ "columnName": "last_synced_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_providers_server_url_username_stalker_mac_address",
+ "unique": true,
+ "columnNames": [
+ "server_url",
+ "username",
+ "stalker_mac_address"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username_stalker_mac_address` ON `${TABLE_NAME}` (`server_url`, `username`, `stalker_mac_address`)"
+ }
+ ]
+ },
+ {
+ "tableName": "channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logoUrl",
+ "columnName": "logo_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "groupTitle",
+ "columnName": "group_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgChannelId",
+ "columnName": "epg_channel_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "number",
+ "columnName": "number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSupported",
+ "columnName": "catch_up_supported",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpDays",
+ "columnName": "catch_up_days",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSource",
+ "columnName": "catchUpSource",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logicalGroupId",
+ "columnName": "logical_group_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "errorCount",
+ "columnName": "error_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "qualityOptionsJson",
+ "columnName": "quality_options_json",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channels_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_channels_provider_id_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"
+ },
+ {
+ "name": "index_channels_provider_id_stream_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "stream_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"
+ },
+ {
+ "name": "index_channels_logical_group_id",
+ "unique": false,
+ "columnNames": [
+ "logical_group_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"
+ },
+ {
+ "name": "index_channels_provider_id_category_id_logical_group_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "logical_group_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channel_preferences",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `audio_video_offset_ms` INTEGER, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`channel_id`) REFERENCES `channels`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "aspectRatio",
+ "columnName": "aspect_ratio",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "audioVideoOffsetMs",
+ "columnName": "audio_video_offset_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channel_preferences_channel_id",
+ "unique": true,
+ "columnNames": [
+ "channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_preferences_channel_id` ON `${TABLE_NAME}` (`channel_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "channels",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "channel_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channels_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`channels`)",
+ "fields": [
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": []
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "simple",
+ "tokenizerArgs": [],
+ "contentTable": "channels",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": [
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_UPDATE BEFORE UPDATE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_DELETE BEFORE DELETE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_UPDATE AFTER UPDATE ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_INSERT AFTER INSERT ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"
+ ]
+ },
+ {
+ "tableName": "movies",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "durationSeconds",
+ "columnName": "duration_seconds",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchProgress",
+ "columnName": "watch_progress",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchCount",
+ "columnName": "watch_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastWatchedAt",
+ "columnName": "last_watched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cacheState",
+ "columnName": "cache_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "detailHydratedAt",
+ "columnName": "detail_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remoteStaleAt",
+ "columnName": "remote_stale_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_movies_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_movies_provider_id_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"
+ },
+ {
+ "name": "index_movies_provider_id_stream_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "stream_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_movies_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"
+ },
+ {
+ "name": "index_movies_provider_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_movies_provider_id_category_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_movies_provider_id_rating_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "rating",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"
+ },
+ {
+ "name": "index_movies_provider_id_added_at_release_date_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "added_at",
+ "release_date",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_added_at_release_date_name_id` ON `${TABLE_NAME}` (`provider_id`, `added_at`, `release_date`, `name`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "movies_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`movies`)",
+ "fields": [
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": []
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "simple",
+ "tokenizerArgs": [],
+ "contentTable": "movies",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": [
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_UPDATE BEFORE UPDATE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_DELETE BEFORE DELETE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_UPDATE AFTER UPDATE ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_INSERT AFTER INSERT ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"
+ ]
+ },
+ {
+ "tableName": "series",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerSeriesId",
+ "columnName": "provider_series_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "episodeRunTime",
+ "columnName": "episode_run_time",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cacheState",
+ "columnName": "cache_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "detailHydratedAt",
+ "columnName": "detail_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remoteStaleAt",
+ "columnName": "remote_stale_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_series_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_series_provider_id_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"
+ },
+ {
+ "name": "index_series_provider_id_series_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "series_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_series_provider_id_series_id` ON `${TABLE_NAME}` (`provider_id`, `series_id`)"
+ },
+ {
+ "name": "index_series_provider_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_series_provider_id_category_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_series_provider_id_rating_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "rating",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"
+ },
+ {
+ "name": "index_series_provider_id_last_modified_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "last_modified",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_last_modified_name_id` ON `${TABLE_NAME}` (`provider_id`, `last_modified`, `name`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "series_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",
+ "fields": [
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": []
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "simple",
+ "tokenizerArgs": [],
+ "contentTable": "series",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": [
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"
+ ]
+ },
+ {
+ "tableName": "episodes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "episodeId",
+ "columnName": "episode_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "episodeNumber",
+ "columnName": "episode_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seasonNumber",
+ "columnName": "season_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "durationSeconds",
+ "columnName": "duration_seconds",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchProgress",
+ "columnName": "watch_progress",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastWatchedAt",
+ "columnName": "last_watched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_episodes_series_id",
+ "unique": false,
+ "columnNames": [
+ "series_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"
+ },
+ {
+ "name": "index_episodes_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_episodes_provider_id_episode_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "episode_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "series",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "series_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "categories",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentId",
+ "columnName": "parent_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_categories_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_categories_provider_id_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"
+ },
+ {
+ "name": "index_categories_provider_id_category_id_type",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channel_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logoUrl",
+ "columnName": "logo_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "groupTitle",
+ "columnName": "group_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgChannelId",
+ "columnName": "epg_channel_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "number",
+ "columnName": "number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSupported",
+ "columnName": "catch_up_supported",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpDays",
+ "columnName": "catch_up_days",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSource",
+ "columnName": "catchUpSource",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logicalGroupId",
+ "columnName": "logical_group_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "errorCount",
+ "columnName": "error_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "stream_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channel_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_channel_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "movie_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "durationSeconds",
+ "columnName": "duration_seconds",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "stream_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_movie_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_movie_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "series_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `provider_series_key` TEXT NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `provider_series_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerSeriesId",
+ "columnName": "provider_series_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "providerSeriesKey",
+ "columnName": "provider_series_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "episodeRunTime",
+ "columnName": "episode_run_time",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "provider_series_key"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_series_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_series_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "category_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentId",
+ "columnName": "parent_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "category_id",
+ "type"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_category_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_category_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ },
+ {
+ "name": "index_category_import_stage_provider_id_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "programs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "description",
+ "columnName": "description",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "startTime",
+ "columnName": "start_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "endTime",
+ "columnName": "end_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lang",
+ "columnName": "lang",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "hasArchive",
+ "columnName": "has_archive",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_programs_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_programs_provider_id_channel_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"
+ },
+ {
+ "name": "index_programs_provider_id_end_time_channel_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "end_time",
+ "channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_end_time_channel_id` ON `${TABLE_NAME}` (`provider_id`, `end_time`, `channel_id`)"
+ },
+ {
+ "name": "index_programs_provider_id_start_time_end_time",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "start_time",
+ "end_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `start_time`, `end_time`)"
+ },
+ {
+ "name": "index_programs_start_time",
+ "unique": false,
+ "columnNames": [
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_start_time` ON `${TABLE_NAME}` (`start_time`)"
+ },
+ {
+ "name": "index_programs_provider_id_channel_id_start_time",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`)"
+ },
+ {
+ "name": "index_programs_provider_id_channel_id_start_time_end_time",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "start_time",
+ "end_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`, `end_time`)"
+ }
+ ]
+ },
+ {
+ "tableName": "favorites",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `group_key` INTEGER NOT NULL, `added_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`group_id`) REFERENCES `virtual_groups`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentId",
+ "columnName": "content_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "position",
+ "columnName": "position",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "groupId",
+ "columnName": "group_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "groupKey",
+ "columnName": "group_key",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_favorites_provider_id_content_id_content_type_group_key",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "content_id",
+ "content_type",
+ "group_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_provider_id_content_id_content_type_group_key` ON `${TABLE_NAME}` (`provider_id`, `content_id`, `content_type`, `group_key`)"
+ },
+ {
+ "name": "index_favorites_provider_id_content_type_group_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "group_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_provider_id_content_type_group_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `group_id`)"
+ },
+ {
+ "name": "index_favorites_group_id_position",
+ "unique": false,
+ "columnNames": [
+ "group_id",
+ "position"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_group_id_position` ON `${TABLE_NAME}` (`group_id`, `position`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "virtual_groups",
+ "onDelete": "SET NULL",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "group_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "virtual_groups",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconEmoji",
+ "columnName": "icon_emoji",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "position",
+ "columnName": "position",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_virtual_groups_provider_id_content_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"
+ },
+ {
+ "name": "index_virtual_groups_position",
+ "unique": false,
+ "columnNames": [
+ "position"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_position` ON `${TABLE_NAME}` (`position`)"
+ },
+ {
+ "name": "index_virtual_groups_content_type",
+ "unique": false,
+ "columnNames": [
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_content_type` ON `${TABLE_NAME}` (`content_type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "playback_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `poster_url` TEXT, `stream_url` TEXT NOT NULL, `resume_position_ms` INTEGER NOT NULL, `total_duration_ms` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `watched_status` TEXT NOT NULL, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentId",
+ "columnName": "content_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "resumePositionMs",
+ "columnName": "resume_position_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalDurationMs",
+ "columnName": "total_duration_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastWatchedAt",
+ "columnName": "last_watched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchCount",
+ "columnName": "watch_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchedStatus",
+ "columnName": "watched_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "seasonNumber",
+ "columnName": "season_number",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "episodeNumber",
+ "columnName": "episode_number",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playback_history_content_id_content_type_provider_id",
+ "unique": true,
+ "columnNames": [
+ "content_id",
+ "content_type",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_history_content_id_content_type_provider_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `provider_id`)"
+ },
+ {
+ "name": "index_playback_history_last_watched_at",
+ "unique": false,
+ "columnNames": [
+ "last_watched_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_last_watched_at` ON `${TABLE_NAME}` (`last_watched_at`)"
+ },
+ {
+ "name": "index_playback_history_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_playback_history_provider_id_content_type_content_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "content_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `content_id`)"
+ },
+ {
+ "name": "index_playback_history_provider_id_content_type_last_watched_at",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "last_watched_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_last_watched_at` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `last_watched_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "tmdb_identity",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tmdb_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `canonical_provider_id` INTEGER NOT NULL, `first_seen_at` INTEGER NOT NULL, PRIMARY KEY(`tmdb_id`, `content_type`), FOREIGN KEY(`canonical_provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "canonicalProviderId",
+ "columnName": "canonical_provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "firstSeenAt",
+ "columnName": "first_seen_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "tmdb_id",
+ "content_type"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_tmdb_identity_content_type",
+ "unique": false,
+ "columnNames": [
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_content_type` ON `${TABLE_NAME}` (`content_type`)"
+ },
+ {
+ "name": "index_tmdb_identity_canonical_provider_id",
+ "unique": false,
+ "columnNames": [
+ "canonical_provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_canonical_provider_id` ON `${TABLE_NAME}` (`canonical_provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "canonical_provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "search_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `content_scope` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `used_at` INTEGER NOT NULL, `use_count` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "query",
+ "columnName": "query",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentScope",
+ "columnName": "content_scope",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "usedAt",
+ "columnName": "used_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "useCount",
+ "columnName": "use_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_search_history_content_scope_provider_id_used_at",
+ "unique": false,
+ "columnNames": [
+ "content_scope",
+ "provider_id",
+ "used_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_content_scope_provider_id_used_at` ON `${TABLE_NAME}` (`content_scope`, `provider_id`, `used_at`)"
+ },
+ {
+ "name": "index_search_history_used_at",
+ "unique": false,
+ "columnNames": [
+ "used_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_used_at` ON `${TABLE_NAME}` (`used_at`)"
+ },
+ {
+ "name": "index_search_history_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_search_history_query_content_scope_provider_id",
+ "unique": true,
+ "columnNames": [
+ "query",
+ "content_scope",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_search_history_query_content_scope_provider_id` ON `${TABLE_NAME}` (`query`, `content_scope`, `provider_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "sync_metadata",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_live_success` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_series_success` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_epg_success` INTEGER NOT NULL, `last_movie_attempt` INTEGER NOT NULL, `last_movie_success` INTEGER NOT NULL, `last_movie_partial` INTEGER NOT NULL, `live_count` INTEGER NOT NULL, `movie_count` INTEGER NOT NULL, `series_count` INTEGER NOT NULL, `epg_count` INTEGER NOT NULL, `last_sync_status` TEXT NOT NULL, `movie_sync_mode` TEXT NOT NULL, `movie_warnings_count` INTEGER NOT NULL, `movie_catalog_stale` INTEGER NOT NULL, `live_avoid_full_until` INTEGER NOT NULL, `movie_avoid_full_until` INTEGER NOT NULL, `series_avoid_full_until` INTEGER NOT NULL, `live_sequential_failures_remembered` INTEGER NOT NULL, `live_healthy_sync_streak` INTEGER NOT NULL, `movie_parallel_failures_remembered` INTEGER NOT NULL, `movie_healthy_sync_streak` INTEGER NOT NULL, `series_sequential_failures_remembered` INTEGER NOT NULL, `series_healthy_sync_streak` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastLiveSync",
+ "columnName": "last_live_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastLiveSuccess",
+ "columnName": "last_live_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMovieSync",
+ "columnName": "last_movie_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSeriesSync",
+ "columnName": "last_series_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSeriesSuccess",
+ "columnName": "last_series_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastEpgSync",
+ "columnName": "last_epg_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastEpgSuccess",
+ "columnName": "last_epg_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMovieAttempt",
+ "columnName": "last_movie_attempt",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMovieSuccess",
+ "columnName": "last_movie_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMoviePartial",
+ "columnName": "last_movie_partial",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveCount",
+ "columnName": "live_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieCount",
+ "columnName": "movie_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesCount",
+ "columnName": "series_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgCount",
+ "columnName": "epg_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncStatus",
+ "columnName": "last_sync_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieSyncMode",
+ "columnName": "movie_sync_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieWarningsCount",
+ "columnName": "movie_warnings_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieCatalogStale",
+ "columnName": "movie_catalog_stale",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveAvoidFullUntil",
+ "columnName": "live_avoid_full_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieAvoidFullUntil",
+ "columnName": "movie_avoid_full_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesAvoidFullUntil",
+ "columnName": "series_avoid_full_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveSequentialFailuresRemembered",
+ "columnName": "live_sequential_failures_remembered",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveHealthySyncStreak",
+ "columnName": "live_healthy_sync_streak",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieParallelFailuresRemembered",
+ "columnName": "movie_parallel_failures_remembered",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieHealthySyncStreak",
+ "columnName": "movie_healthy_sync_streak",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesSequentialFailuresRemembered",
+ "columnName": "series_sequential_failures_remembered",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesHealthySyncStreak",
+ "columnName": "series_healthy_sync_streak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "movie_category_hydration",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastHydratedAt",
+ "columnName": "last_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "itemCount",
+ "columnName": "item_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastStatus",
+ "columnName": "last_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastLoadedPage",
+ "columnName": "last_loaded_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastAttemptedPage",
+ "columnName": "last_attempted_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessfulPage",
+ "columnName": "last_successful_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPages",
+ "columnName": "total_pages",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isComplete",
+ "columnName": "is_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "pageSize",
+ "columnName": "page_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryAfterMs",
+ "columnName": "retry_after_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureCount",
+ "columnName": "failure_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryBudgetRemaining",
+ "columnName": "retry_budget_remaining",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPageFingerprint",
+ "columnName": "last_page_fingerprint",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_movie_category_hydration_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "series_category_hydration",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastHydratedAt",
+ "columnName": "last_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "itemCount",
+ "columnName": "item_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastStatus",
+ "columnName": "last_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastLoadedPage",
+ "columnName": "last_loaded_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastAttemptedPage",
+ "columnName": "last_attempted_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessfulPage",
+ "columnName": "last_successful_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPages",
+ "columnName": "total_pages",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isComplete",
+ "columnName": "is_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "pageSize",
+ "columnName": "page_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryAfterMs",
+ "columnName": "retry_after_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureCount",
+ "columnName": "failure_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryBudgetRemaining",
+ "columnName": "retry_budget_remaining",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPageFingerprint",
+ "columnName": "last_page_fingerprint",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_series_category_hydration_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_sources",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `etag` TEXT, `last_modified_header` TEXT, `timezone_policy` TEXT NOT NULL, `timezone_id` 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"
+ },
+ {
+ "fieldPath": "timezonePolicy",
+ "columnName": "timezone_policy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timezoneId",
+ "columnName": "timezone_id",
+ "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, `exact_alarm_armed` INTEGER NOT NULL, `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": "exactAlarmArmed",
+ "columnName": "exact_alarm_armed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "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, `exact_alarm_armed` INTEGER NOT NULL, `delivery_state` TEXT NOT NULL, `delivery_attempt_token` TEXT, `delivery_attempted_at` INTEGER, `delivery_attempt_count` INTEGER NOT NULL, `delivery_failure_reason` TEXT, `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": "exactAlarmArmed",
+ "columnName": "exact_alarm_armed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deliveryState",
+ "columnName": "delivery_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deliveryAttemptToken",
+ "columnName": "delivery_attempt_token",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "deliveryAttemptedAt",
+ "columnName": "delivery_attempted_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "deliveryAttemptCount",
+ "columnName": "delivery_attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deliveryFailureReason",
+ "columnName": "delivery_failure_reason",
+ "affinity": "TEXT"
+ },
+ {
+ "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, `owner_id` TEXT, `owner_epoch` INTEGER NOT NULL, `heartbeat_at` INTEGER, `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": "ownerId",
+ "columnName": "owner_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "ownerEpoch",
+ "columnName": "owner_epoch",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "heartbeatAt",
+ "columnName": "heartbeat_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "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`)"
+ }
+ ]
+ },
+ {
+ "tableName": "provider_deletion_cleanup",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `action` TEXT NOT NULL, `target_id` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "action",
+ "columnName": "action",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetId",
+ "columnName": "target_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_deletion_cleanup_provider_id_action_target_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "action",
+ "target_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_deletion_cleanup_provider_id_action_target_id` ON `${TABLE_NAME}` (`provider_id`, `action`, `target_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "plugin_provider_ownership",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`package_name` TEXT NOT NULL, `service_class_name` TEXT NOT NULL, `manifest_id` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, PRIMARY KEY(`package_name`, `service_class_name`, `manifest_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "packageName",
+ "columnName": "package_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "serviceClassName",
+ "columnName": "service_class_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "manifestId",
+ "columnName": "manifest_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "package_name",
+ "service_class_name",
+ "manifest_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_plugin_provider_ownership_provider_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_plugin_provider_ownership_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "provider_config_revisions",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `revision` INTEGER NOT NULL, `config_json` TEXT NOT NULL, `state` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `revision`), 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": "revision",
+ "columnName": "revision",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configJson",
+ "columnName": "config_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "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
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "revision"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_config_revisions_provider_id_state",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_config_revisions_provider_id_state` ON `${TABLE_NAME}` (`provider_id`, `state`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "backup_restore_checkpoints",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`restore_key` TEXT NOT NULL, `room_complete` INTEGER NOT NULL, `preferences_complete` INTEGER NOT NULL, `presets_complete` INTEGER NOT NULL, `schedules_complete` INTEGER NOT NULL, `state` TEXT NOT NULL, `preference_snapshot_json` TEXT, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`restore_key`))",
+ "fields": [
+ {
+ "fieldPath": "restoreKey",
+ "columnName": "restore_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "roomComplete",
+ "columnName": "room_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "preferencesComplete",
+ "columnName": "preferences_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "presetsComplete",
+ "columnName": "presets_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "schedulesComplete",
+ "columnName": "schedules_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "preferenceSnapshotJson",
+ "columnName": "preference_snapshot_json",
+ "affinity": "TEXT"
+ },
+ {
+ "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
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "restore_key"
+ ]
+ }
+ },
+ {
+ "tableName": "provider_workflows",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `generation` INTEGER NOT NULL, `state` TEXT NOT NULL, `reason` TEXT NOT NULL, `priority` INTEGER NOT NULL, `force` INTEGER NOT NULL, `current_phase` TEXT, `lease_token` TEXT, `lease_expires_at` INTEGER, `heartbeat_at` INTEGER, `progress_message` TEXT, `last_error_code` TEXT, `last_error_message` 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": "generation",
+ "columnName": "generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "force",
+ "columnName": "force",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "currentPhase",
+ "columnName": "current_phase",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "leaseToken",
+ "columnName": "lease_token",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "leaseExpiresAt",
+ "columnName": "lease_expires_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "heartbeatAt",
+ "columnName": "heartbeat_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "progressMessage",
+ "columnName": "progress_message",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorCode",
+ "columnName": "last_error_code",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorMessage",
+ "columnName": "last_error_message",
+ "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_provider_workflows_state",
+ "unique": false,
+ "columnNames": [
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_state` ON `${TABLE_NAME}` (`state`)"
+ },
+ {
+ "name": "index_provider_workflows_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ },
+ {
+ "name": "index_provider_workflows_lease_expires_at",
+ "unique": false,
+ "columnNames": [
+ "lease_expires_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_lease_expires_at` ON `${TABLE_NAME}` (`lease_expires_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "provider_workflow_phases",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `generation` INTEGER NOT NULL, `phase` TEXT NOT NULL, `state` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `checkpoint` TEXT, `last_error_code` TEXT, `last_error_message` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`, `generation`, `phase`), 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": "generation",
+ "columnName": "generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "phase",
+ "columnName": "phase",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "checkpoint",
+ "columnName": "checkpoint",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorCode",
+ "columnName": "last_error_code",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorMessage",
+ "columnName": "last_error_message",
+ "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",
+ "generation",
+ "phase"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_workflow_phases_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_provider_workflow_phases_state",
+ "unique": false,
+ "columnNames": [
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_state` ON `${TABLE_NAME}` (`state`)"
+ },
+ {
+ "name": "index_provider_workflow_phases_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ }
+ ],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '587ce50641fa03e4737b79b8c3d51d3c')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt
index 5d805825..7fe9bdfe 100644
--- a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt
+++ b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt
@@ -1542,6 +1542,46 @@ class StreamVaultDatabaseMigrationTest {
migratedDb.close()
}
+ @Test
+ fun migrate71To72_addsDeterministicXmltvTimezonePolicy() {
+ val databaseName = "streamvault-71-72-test"
+ migrationTestHelper.createDatabase(databaseName, 71).apply {
+ execSQL(
+ """
+ INSERT INTO epg_sources (
+ id, name, url, enabled, last_refresh_at, last_success_at, last_error,
+ priority, created_at, updated_at, etag, last_modified_header
+ ) VALUES (
+ 1, 'Existing guide', 'https://example.com/guide.xml', 1, 0, 0, NULL,
+ 0, 100, 100, NULL, NULL
+ )
+ """.trimIndent()
+ )
+ close()
+ }
+
+ val migratedDb = migrationTestHelper.runMigrationsAndValidate(
+ databaseName,
+ 72,
+ true,
+ StreamVaultDatabase.MIGRATION_71_72
+ )
+
+ assertEquals(
+ 1,
+ countRows(
+ migratedDb,
+ """
+ SELECT COUNT(*) FROM epg_sources
+ WHERE id = 1
+ AND timezone_policy = 'REQUIRE_OFFSET'
+ AND timezone_id IS NULL
+ """.trimIndent()
+ )
+ )
+ migratedDb.close()
+ }
+
private fun countRows(db: androidx.sqlite.db.SupportSQLiteDatabase, sql: String): Int {
db.query(sql).use { cursor ->
if (!cursor.moveToFirst()) return 0
diff --git a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt
index a89b4078..d1d02ee7 100644
--- a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt
+++ b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt
@@ -22,6 +22,7 @@ import com.streamvault.domain.model.StalkerMagPreset
import com.streamvault.domain.model.StalkerPlaybackBackendHint
import com.streamvault.domain.model.StalkerPortalFingerprint
import com.streamvault.domain.model.StalkerPortalProfile
+import com.streamvault.domain.model.XmltvTimezonePolicy
import java.util.logging.Logger
class RoomEnumConverters {
@@ -175,6 +176,13 @@ class RoomEnumConverters {
fun toContentType(value: String?): ContentType? =
enumValueOrDefault(value, ContentType.LIVE, contentTypeAliases())
+ @TypeConverter
+ fun fromXmltvTimezonePolicy(value: XmltvTimezonePolicy?): String? = value?.name
+
+ @TypeConverter
+ fun toXmltvTimezonePolicy(value: String?): XmltvTimezonePolicy? =
+ enumValueOrDefault(value, XmltvTimezonePolicy.REQUIRE_OFFSET)
+
private inline fun <reified T : Enum<T>> enumValueOrDefault(
value: String?,
defaultValue: T,
diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
index e156bc43..44eafc17 100644
--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
@@ -56,7 +56,7 @@ import com.streamvault.data.local.entity.*
ProviderWorkflowEntity::class,
ProviderWorkflowPhaseEntity::class
],
- version = 71,
+ version = 72,
exportSchema = true // ← was false; schema JSON now tracked in version control
)
@TypeConverters(RoomEnumConverters::class)
@@ -2963,6 +2963,22 @@ abstract class StreamVaultDatabase : RoomDatabase() {
}
}
+ /**
+ * Migration 71 -> 72: make the interpretation of offset-free XMLTV timestamps an
+ * explicit property of the source. Existing sources require an offset until the user
+ * deliberately selects UTC or an IANA timezone; they must never inherit device state.
+ */
+ val MIGRATION_71_72 = object : Migration(71, 72) {
+ override fun migrate(database: SupportSQLiteDatabase) {
+ database.execSQL(
+ "ALTER TABLE epg_sources ADD COLUMN timezone_policy TEXT NOT NULL DEFAULT 'REQUIRE_OFFSET'"
+ )
+ database.execSQL(
+ "ALTER TABLE epg_sources ADD COLUMN timezone_id TEXT"
+ )
+ }
+ }
+
private fun imageUrlMigrationSql(table: String, column: String): String = """
UPDATE $table SET $column = CASE
WHEN instr($column, 'streamvault_provider_id=') > 0 THEN $column
diff --git a/data/src/main/java/com/streamvault/data/local/dao/Daos.kt b/data/src/main/java/com/streamvault/data/local/dao/Daos.kt
index 92ca6c90..d055b5b4 100644
--- a/data/src/main/java/com/streamvault/data/local/dao/Daos.kt
+++ b/data/src/main/java/com/streamvault/data/local/dao/Daos.kt
@@ -40,6 +40,9 @@ abstract class ProviderDao {
@Query("SELECT * FROM providers WHERE id = :id")
abstract suspend fun getById(id: Long): ProviderEntity?
+ @Query("SELECT * FROM providers WHERE id = :id")
+ abstract fun getByIdSync(id: Long): ProviderEntity?
+
@Query("SELECT * FROM providers WHERE id IN (:ids)")
abstract suspend fun getByIds(ids: List<Long>): List<ProviderEntity>
diff --git a/data/src/main/java/com/streamvault/data/local/dao/PluginProviderOwnershipDao.kt b/data/src/main/java/com/streamvault/data/local/dao/PluginProviderOwnershipDao.kt
index b6937b00..e9b6b814 100644
--- a/data/src/main/java/com/streamvault/data/local/dao/PluginProviderOwnershipDao.kt
+++ b/data/src/main/java/com/streamvault/data/local/dao/PluginProviderOwnershipDao.kt
@@ -4,6 +4,7 @@ import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
+import androidx.room.Transaction
import com.streamvault.data.local.entity.PluginProviderOwnershipEntity
@Dao
@@ -24,6 +25,17 @@ interface PluginProviderOwnershipDao {
@Query("SELECT * FROM plugin_provider_ownership")
suspend fun getAll(): List<PluginProviderOwnershipEntity>
+ @Query("""
+ SELECT * FROM plugin_provider_ownership
+ WHERE package_name = :packageName
+ AND service_class_name = :serviceClassName
+ ORDER BY created_at ASC, manifest_id ASC
+ """)
+ suspend fun getByComponent(
+ packageName: String,
+ serviceClassName: String
+ ): List<PluginProviderOwnershipEntity>
+
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsert(ownership: PluginProviderOwnershipEntity)
@@ -34,4 +46,21 @@ interface PluginProviderOwnershipDao {
AND manifest_id = :manifestId
""")
suspend fun delete(packageName: String, serviceClassName: String, manifestId: String)
+
+ /**
+ * Atomically follows a manifest-ID rename for one installed service component.
+ *
+ * Package/service is Android's durable lifecycle identity. The manifest ID remains part of
+ * the public plugin identity, but changing it must not briefly leave an unowned provider or
+ * collide with the unique provider ownership index.
+ */
+ @Transaction
+ suspend fun rekeyManifestId(
+ ownership: PluginProviderOwnershipEntity,
+ newManifestId: String
+ ): PluginProviderOwnershipEntity {
+ if (ownership.manifestId == newManifestId) return ownership
+ delete(ownership.packageName, ownership.serviceClassName, ownership.manifestId)
+ return ownership.copy(manifestId = newManifestId).also { upsert(it) }
+ }
}
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.kt
index 898a32ab..b1f988df 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
@@ -21,6 +21,7 @@ import com.streamvault.domain.model.StalkerPlaybackBackendHint
import com.streamvault.domain.model.StalkerPortalFingerprint
import com.streamvault.domain.model.StalkerPortalProfile
import com.streamvault.domain.model.ProviderXtreamLiveSyncMode
+import com.streamvault.domain.model.XmltvTimezonePolicy
@Entity(
tableName = "providers",
@@ -983,7 +984,10 @@ data class EpgSourceEntity(
@ColumnInfo(name = "created_at") val createdAt: Long = System.currentTimeMillis(),
@ColumnInfo(name = "updated_at") val updatedAt: Long = System.currentTimeMillis(),
val etag: String? = null,
- @ColumnInfo(name = "last_modified_header") val lastModifiedHeader: String? = null
+ @ColumnInfo(name = "last_modified_header") val lastModifiedHeader: String? = null,
+ @ColumnInfo(name = "timezone_policy")
+ val timezonePolicy: XmltvTimezonePolicy = XmltvTimezonePolicy.REQUIRE_OFFSET,
+ @ColumnInfo(name = "timezone_id") val timezoneId: String? = null
)
// ── Provider ↔ EPG Source Assignment ───────────────────────────────
diff --git a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt
index 011dfe48..6488cdad 100644
--- a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt
+++ b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt
@@ -13,6 +13,7 @@ import com.streamvault.data.local.DatabaseTransactionRunner
import com.streamvault.data.local.dao.BackupRestoreCheckpointDao
import com.streamvault.data.local.dao.ChannelDao
import com.streamvault.data.local.dao.EpisodeDao
+import com.streamvault.data.local.dao.EpgSourceDao
import com.streamvault.data.local.dao.FavoriteDao
import com.streamvault.data.local.dao.MovieDao
import com.streamvault.data.local.dao.PlaybackHistoryDao
@@ -92,7 +93,8 @@ class BackupManagerImpl @Inject constructor(
private val transactionRunner: DatabaseTransactionRunner,
private val gson: Gson,
private val backupRestoreCheckpointDao: BackupRestoreCheckpointDao? = null,
- private val channelDao: ChannelDao
+ private val channelDao: ChannelDao,
+ private val epgSourceDao: EpgSourceDao? = null
) : BackupManager {
override suspend fun exportConfig(uriString: String): com.streamvault.domain.model.Result<Unit> = withContext(Dispatchers.IO) {
@@ -231,7 +233,8 @@ class BackupManagerImpl @Inject constructor(
multiViewPresets = multiViewPresets,
protectedCategories = protectedCategories,
scheduledRecordings = scheduledRecordings,
- portableProviderPreferences = buildPortableProviderPreferences(providerEntities)
+ portableProviderPreferences = buildPortableProviderPreferences(providerEntities),
+ epgSources = epgSourceDao?.getAllSync()?.map { it.toDomain() }
)
// Compute checksum over the data without checksum field
@@ -622,12 +625,14 @@ class BackupManagerImpl @Inject constructor(
private fun importedRoomSections(backupData: BackupData, plan: BackupImportPlan): List<String> = buildList {
if (plan.importProviders && backupData.providers != null) add("Providers")
+ if (plan.importProviders && backupData.epgSources != null && epgSourceDao != null) add("EPG Sources")
if (plan.importSavedLibrary) add("Saved Library")
if (plan.importPlaybackHistory && backupData.playbackHistory != null) add("Playback History")
}
private fun skippedRoomSections(backupData: BackupData, plan: BackupImportPlan): List<String> = buildList {
if (!plan.importProviders || backupData.providers == null) add("Providers")
+ if (!plan.importProviders || backupData.epgSources == null || epgSourceDao == null) add("EPG Sources")
if (!plan.importSavedLibrary) add("Saved Library")
if (!plan.importPlaybackHistory || backupData.playbackHistory == null) add("Playback History")
}
@@ -712,6 +717,7 @@ class BackupManagerImpl @Inject constructor(
backupData.portableProviderPreferences,
PortableProviderPreferencesBackup::class.java
)
+ writeNamedJsonField(jsonWriter, "epgSources", backupData.epgSources, EPG_SOURCE_LIST_TYPE)
jsonWriter.endObject()
}
}
@@ -792,6 +798,7 @@ class BackupManagerImpl @Inject constructor(
var protectedCategories: List<ProtectedCategoryBackup>? = null
var scheduledRecordings: List<ScheduledRecordingBackup>? = null
var portableProviderPreferences: PortableProviderPreferencesBackup? = null
+ var epgSources: List<com.streamvault.domain.model.EpgSource>? = null
val seenFields = hashSetOf<String>()
var headerRead = false
@@ -836,6 +843,8 @@ class BackupManagerImpl @Inject constructor(
readLimitedArray(reader, SCHEDULED_RECORDING_TYPE, MAX_SECTION_ITEMS, "recording schedules")
"portableProviderPreferences" -> portableProviderPreferences =
readPortableProviderPreferences(reader)
+ "epgSources" -> epgSources =
+ readLimitedArray(reader, EPG_SOURCE_TYPE, MAX_EPG_SOURCES, "EPG sources")
else -> reader.skipValue()
}
}
@@ -864,7 +873,8 @@ class BackupManagerImpl @Inject constructor(
multiViewPresets = multiViewPresets,
protectedCategories = protectedCategories,
scheduledRecordings = scheduledRecordings,
- portableProviderPreferences = portableProviderPreferences
+ portableProviderPreferences = portableProviderPreferences,
+ epgSources = epgSources
)
}
@@ -1066,7 +1076,21 @@ class BackupManagerImpl @Inject constructor(
require(data.playbackHistory.orEmpty().size <= MAX_SECTION_ITEMS) { "Backup has too much playback history" }
require(data.protectedCategories.orEmpty().size <= MAX_SECTION_ITEMS) { "Backup has too many protected categories" }
require(data.scheduledRecordings.orEmpty().size <= MAX_SECTION_ITEMS) { "Backup has too many recording schedules" }
+ require(data.epgSources.orEmpty().size <= MAX_EPG_SOURCES) { "Backup has too many EPG sources" }
require(data.multiViewPresets.orEmpty().values.sumOf { it.size } <= MAX_SECTION_ITEMS) { "Backup has too many preset entries" }
+ data.epgSources.orEmpty().forEach { source ->
+ require(source.name.length <= MAX_FIELD_CHARS && source.url.length <= MAX_FIELD_CHARS) {
+ "Backup contains an overlong EPG source"
+ }
+ require(source.timezoneId.orEmpty().length <= MAX_FIELD_CHARS) {
+ "Backup contains an overlong EPG timezone"
+ }
+ if (source.timezonePolicy == com.streamvault.domain.model.XmltvTimezonePolicy.EXPLICIT_ZONE) {
+ requireNotNull(source.timezoneId?.trim()?.takeIf { it.isNotEmpty() }) {
+ "Backup contains an EPG source without its explicit timezone"
+ }.also(java.time.ZoneId::of)
+ }
+ }
data.preferences.orEmpty().forEach { (key, value) ->
require(key.length <= MAX_FIELD_CHARS && value.length <= MAX_FIELD_CHARS) { "Backup contains an overlong preference" }
}
@@ -1211,7 +1235,8 @@ class BackupManagerImpl @Inject constructor(
multiViewPresets.orEmpty().all { it.value.isEmpty() } &&
protectedCategories.isNullOrEmpty() &&
scheduledRecordings.isNullOrEmpty() &&
- portableProviderPreferences == null
+ portableProviderPreferences == null &&
+ epgSources.isNullOrEmpty()
private suspend fun capturePreferenceSnapshot(providerEntities: List<ProviderEntity>): Map<String, String> {
val parentalPinBackup = preferencesRepository.exportParentalPinBackup()
@@ -1569,8 +1594,32 @@ class BackupManagerImpl @Inject constructor(
}
importedSections += "Providers"
} ?: run { skippedSections += "Providers" }
+ backupData.epgSources?.let { sources ->
+ val dao = epgSourceDao
+ if (dao == null) {
+ skippedSections += "EPG Sources"
+ } else {
+ sources.forEach { source ->
+ val existing = dao.getByUrl(source.url)
+ if (existing != null && plan.conflictStrategy == BackupConflictStrategy.KEEP_EXISTING) {
+ return@forEach
+ }
+ val entity = source.copy(
+ id = existing?.id ?: 0L,
+ lastRefreshAt = 0L,
+ lastSuccessAt = 0L,
+ lastError = null,
+ etag = null,
+ lastModifiedHeader = null
+ ).toEntity()
+ if (existing == null) dao.insert(entity) else dao.update(entity)
+ }
+ importedSections += "EPG Sources"
+ }
+ }
} else {
skippedSections += "Providers"
+ if (!backupData.epgSources.isNullOrEmpty()) skippedSections += "EPG Sources"
}
if (plan.importSavedLibrary) {
@@ -1884,6 +1933,7 @@ internal fun countScheduledRecordingConflicts(
const val MAX_JSON_DEPTH = 64
const val MAX_PREFERENCES = 5_000
const val MAX_PROVIDERS = 1_000
+ const val MAX_EPG_SOURCES = 10_000
const val MAX_SECTION_ITEMS = 100_000
const val MAX_FIELD_CHARS = 8_192
}
@@ -2186,7 +2236,7 @@ private const val RESTORE_STATE_FAILED_BEFORE_COMMIT = "FAILED_BEFORE_COMMIT"
private const val RESTORE_SNAPSHOT_PRESET_1 = "__restore_snapshot_preset_1"
private const val RESTORE_SNAPSHOT_PRESET_2 = "__restore_snapshot_preset_2"
private const val RESTORE_SNAPSHOT_PRESET_3 = "__restore_snapshot_preset_3"
-private const val CURRENT_BACKUP_VERSION = 9
+private const val CURRENT_BACKUP_VERSION = 10
private const val FILE_URI_SCHEME = "file"
private val PORTABLE_VIRTUAL_CATEGORY_IDS = setOf(-998L, -999L)
private val MAP_STRING_STRING_TYPE: Type = object : TypeToken<Map<String, String>>() {}.type
@@ -2203,6 +2253,9 @@ private val PORTABLE_CHANNEL_REFERENCE_TYPE: Type = PortableChannelReference::cl
private val LONG_TYPE: Type = java.lang.Long::class.java
private val STRING_TYPE: Type = String::class.java
private val PROVIDER_LIST_TYPE: Type = object : TypeToken<List<com.streamvault.domain.model.Provider>>() {}.type
+private val EPG_SOURCE_TYPE: Type = com.streamvault.domain.model.EpgSource::class.java
+private val EPG_SOURCE_LIST_TYPE: Type =
+ object : TypeToken<List<com.streamvault.domain.model.EpgSource>>() {}.type
private val FAVORITE_LIST_TYPE: Type = object : TypeToken<List<com.streamvault.domain.model.Favorite>>() {}.type
private val VIRTUAL_GROUP_LIST_TYPE: Type = object : TypeToken<List<com.streamvault.domain.model.VirtualGroup>>() {}.type
private val PLAYBACK_HISTORY_LIST_TYPE: Type = object : TypeToken<List<com.streamvault.domain.model.PlaybackHistory>>() {}.type
diff --git a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt
index 6a56ddf5..97d571cf 100644
--- a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt
+++ b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt
@@ -750,7 +750,9 @@ fun EpgSourceEntity.toDomain() = com.streamvault.domain.model.EpgSource(
createdAt = createdAt,
updatedAt = updatedAt,
etag = etag,
- lastModifiedHeader = lastModifiedHeader
+ lastModifiedHeader = lastModifiedHeader,
+ timezonePolicy = timezonePolicy,
+ timezoneId = timezoneId
)
fun com.streamvault.domain.model.EpgSource.toEntity() = EpgSourceEntity(
@@ -765,7 +767,9 @@ fun com.streamvault.domain.model.EpgSource.toEntity() = EpgSourceEntity(
createdAt = createdAt,
updatedAt = updatedAt,
etag = etag,
- lastModifiedHeader = lastModifiedHeader
+ lastModifiedHeader = lastModifiedHeader,
+ timezonePolicy = timezonePolicy,
+ timezoneId = timezoneId
)
// ── Provider EPG Source Assignment ─────────────────────────────────
diff --git a/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt b/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt
index 776bc896..3f4368d1 100644
--- a/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt
+++ b/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt
@@ -556,20 +556,22 @@ class XmltvParser {
}
}
- private fun parseDate(dateStr: String?, parsingZoneId: ZoneId): Long {
+ private fun parseDate(dateStr: String?, parsingZoneId: ZoneId?): Long {
if (dateStr.isNullOrBlank()) return 0
offsetDateFormats.firstNotNullOfOrNull { formatter ->
parseOffsetDateTime(dateStr, formatter)
}?.let { return it }
- localDateTimeFormats.firstNotNullOfOrNull { formatter ->
- parseLocalDateTime(dateStr, formatter, parsingZoneId)
- }?.let { return it }
+ if (parsingZoneId != null) {
+ localDateTimeFormats.firstNotNullOfOrNull { formatter ->
+ parseLocalDateTime(dateStr, formatter, parsingZoneId)
+ }?.let { return it }
- localDateFormats.firstNotNullOfOrNull { formatter ->
- parseLocalDate(dateStr, formatter, parsingZoneId)
- }?.let { return it }
+ localDateFormats.firstNotNullOfOrNull { formatter ->
+ parseLocalDate(dateStr, formatter, parsingZoneId)
+ }?.let { return it }
+ }
// Last resort: extract the timestamp portion only if no timezone offset is detectable.
//
@@ -589,7 +591,7 @@ class XmltvParser {
(dateStr.contains('Z') || dateStr.contains('z') ||
dateStr.contains('+') ||
dateStr.lastIndexOf('-') > 12)
- if (!hasTimezoneMarker) {
+ if (!hasTimezoneMarker && parsingZoneId != null) {
val cleaned = dateStr.replace("""[^\d]""".toRegex(), "")
if (cleaned.length >= 14) {
return parseLocalDateTime(
@@ -603,7 +605,11 @@ class XmltvParser {
// Give up
}
- logger.warning("Unparseable XMLTV date: $dateStr")
+ if (parsingZoneId == null) {
+ logger.warning("XMLTV date has no offset and the source requires explicit offsets: $dateStr")
+ } else {
+ logger.warning("Unparseable XMLTV date: $dateStr")
+ }
return 0
}
@@ -640,15 +646,14 @@ class XmltvParser {
.toEpochMilli()
}.getOrNull()
- private fun resolveParsingZoneId(timezoneId: String?): ZoneId {
+ private fun resolveParsingZoneId(timezoneId: String?): ZoneId? {
val normalizedTimezoneId = timezoneId?.trim().orEmpty()
- if (normalizedTimezoneId.isBlank()) return ZoneId.systemDefault()
+ if (normalizedTimezoneId.isBlank()) return null
- return runCatching { ZoneId.of(normalizedTimezoneId) }
- .getOrElse {
- val fallbackZoneId = ZoneId.systemDefault()
- logger.warning("Invalid XMLTV timezone '$timezoneId'; defaulting to ${fallbackZoneId.id}")
- fallbackZoneId
- }
+ return try {
+ ZoneId.of(normalizedTimezoneId)
+ } catch (error: Exception) {
+ throw IllegalArgumentException("Invalid XMLTV timezone '$timezoneId'", error)
+ }
}
}
diff --git a/data/src/main/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptor.kt b/data/src/main/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptor.kt
index f1fb0446..c20276b7 100644
--- a/data/src/main/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptor.kt
+++ b/data/src/main/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptor.kt
@@ -15,57 +15,44 @@ class JellyfinImageAuthInterceptor @Inject constructor(
private val providerDao: ProviderDao,
private val credentialCrypto: CredentialCrypto
) : Interceptor {
- private companion object {
- private const val CACHE_TTL_MILLIS = 30_000L
- }
-
- @Volatile
- private var cachedProviders: List<ProviderEntity> = emptyList()
-
- @Volatile
- private var cacheExpiresAtMillis: Long = 0L
-
override fun intercept(chain: Interceptor.Chain): okhttp3.Response {
val request = chain.request()
- if (!request.header("Authorization").isNullOrBlank()) {
- return chain.proceed(request)
- }
-
// Image credentials are account-scoped. A URL without this marker is
// deliberately not guessed from its host: two accounts may share it.
- val providerId = request.url.queryParameter("streamvault_provider_id")?.toLongOrNull()
- ?: return chain.proceed(request)
- val provider = jellyfinProviders().firstOrNull { it.id == providerId }
+ val marker = request.url.queryParameter("streamvault_provider_id")
?: return chain.proceed(request)
- if (!provider.matches(request.url)) return chain.proceed(request)
+ // The marker is app-internal routing metadata and must never reach Jellyfin or any
+ // mismatched host, even when it is malformed or the caller supplied its own auth.
+ val sanitizedRequest = request.newBuilder()
+ .url(request.url.newBuilder().removeAllQueryParameters("streamvault_provider_id").build())
+ .build()
+ if (!request.header("Authorization").isNullOrBlank()) {
+ return chain.proceed(sanitizedRequest)
+ }
+
+ val providerId = marker.toLongOrNull() ?: return chain.proceed(sanitizedRequest)
+ // Query the exact account on every request. Provider edits and deletes must take effect
+ // immediately; a short-lived list cache can otherwise attach a revoked account token.
+ val provider = runCatching { providerDao.getByIdSync(providerId) }
+ .getOrNull()
+ ?.takeIf { it.type == ProviderType.JELLYFIN }
+ ?: return chain.proceed(sanitizedRequest)
+ if (!provider.matches(request.url)) return chain.proceed(sanitizedRequest)
val accessToken = runCatching { credentialCrypto.decryptIfNeeded(provider.password) }
.getOrNull()
?.takeIf { it.isNotBlank() }
- ?: return chain.proceed(request)
+ ?: return chain.proceed(sanitizedRequest)
return chain.proceed(
- request.newBuilder()
- .url(request.url.newBuilder().removeAllQueryParameters("streamvault_provider_id").build())
+ sanitizedRequest.newBuilder()
.header(
"Authorization",
buildJellyfinAuthorizationHeader(provider.serverUrl, provider.username, accessToken)
)
- .build()
+ .build()
)
}
- private fun jellyfinProviders(): List<ProviderEntity> {
- val now = System.currentTimeMillis()
- if (now < cacheExpiresAtMillis) {
- return cachedProviders
- }
- val refreshed = runCatching { providerDao.getByTypeSync(ProviderType.JELLYFIN) }
- .getOrDefault(emptyList())
- cachedProviders = refreshed
- cacheExpiresAtMillis = now + CACHE_TTL_MILLIS
- return refreshed
- }
-
private fun ProviderEntity.matches(url: HttpUrl): Boolean {
val baseUrl = serverUrl.toHttpUrlOrNull() ?: return false
if (url.scheme != baseUrl.scheme || url.host != baseUrl.host || url.port != baseUrl.port) {
diff --git a/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt
index 278de2ef..12275fe2 100644
--- a/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt
+++ b/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt
@@ -10,7 +10,6 @@ import com.streamvault.data.local.dao.ChannelEpgMappingDao
import com.streamvault.data.local.dao.EpgChannelDao
import com.streamvault.data.local.dao.EpgProgrammeDao
import com.streamvault.data.local.dao.EpgSourceDao
-import com.streamvault.data.local.dao.ProviderDao
import com.streamvault.data.local.dao.ProviderEpgSourceDao
import com.streamvault.data.local.entity.ChannelEpgMappingEntity
import com.streamvault.data.local.entity.EpgChannelEntity
@@ -37,6 +36,7 @@ import com.streamvault.domain.model.EpgSource
import com.streamvault.domain.model.Program
import com.streamvault.domain.model.ProviderEpgSourceAssignment
import com.streamvault.domain.model.Result
+import com.streamvault.domain.model.XmltvTimezonePolicy
import com.streamvault.domain.repository.EpgSourceRepository
import com.streamvault.domain.util.PersistedTimestampPolicy
import kotlinx.coroutines.Dispatchers
@@ -92,7 +92,6 @@ class EpgSourceRepositoryImpl @Inject constructor(
@ApplicationContext private val context: Context,
private val epgSourceDao: EpgSourceDao,
private val providerEpgSourceDao: ProviderEpgSourceDao,
- private val providerDao: ProviderDao,
private val channelEpgMappingDao: ChannelEpgMappingDao,
private val epgChannelDao: EpgChannelDao,
private val epgProgrammeDao: EpgProgrammeDao,
@@ -129,7 +128,12 @@ class EpgSourceRepositoryImpl @Inject constructor(
override suspend fun getSourceById(id: Long): EpgSource? =
epgSourceDao.getById(id)?.toDomain()
- override suspend fun addSource(name: String, url: String): Result<EpgSource> {
+ override suspend fun addSource(
+ name: String,
+ url: String,
+ timezonePolicy: XmltvTimezonePolicy,
+ timezoneId: String?
+ ): Result<EpgSource> {
val trimmed = url.trim()
if (trimmed.isBlank()) return Result.error("URL cannot be empty")
val trimmedUrl = ProviderInputSanitizer.resolveUrlProtocol(trimmed)
@@ -138,12 +142,17 @@ class EpgSourceRepositoryImpl @Inject constructor(
val existing = epgSourceDao.getByUrl(trimmedUrl)
if (existing != null) return Result.error("A source with this URL already exists")
+ val normalizedTimezone = validateXmltvTimezonePolicy(timezonePolicy, timezoneId)
+ if (normalizedTimezone is Result.Error) return normalizedTimezone
+ val normalizedTimezoneId = (normalizedTimezone as Result.Success).data
val trimmedName = name.trim().takeIf { it.isNotEmpty() } ?: "EPG Source"
val now = System.currentTimeMillis()
val entity = EpgSourceEntity(
name = trimmedName,
url = trimmedUrl,
+ timezonePolicy = timezonePolicy,
+ timezoneId = normalizedTimezoneId,
createdAt = now,
updatedAt = now
)
@@ -158,12 +167,17 @@ class EpgSourceRepositoryImpl @Inject constructor(
if (validationError != null) return Result.error(validationError)
val existing = epgSourceDao.getById(source.id) ?: return Result.error("Source not found")
+ val normalizedTimezone = validateXmltvTimezonePolicy(source.timezonePolicy, source.timezoneId)
+ if (normalizedTimezone is Result.Error) return normalizedTimezone
+ val normalizedTimezoneId = (normalizedTimezone as Result.Success).data
epgSourceDao.update(
existing.copy(
name = source.name.trim().takeIf { it.isNotEmpty() } ?: existing.name,
url = trimmedUrl,
enabled = source.enabled,
priority = source.priority,
+ timezonePolicy = source.timezonePolicy,
+ timezoneId = normalizedTimezoneId,
updatedAt = System.currentTimeMillis()
)
)
@@ -344,7 +358,7 @@ class EpgSourceRepositoryImpl @Inject constructor(
// Stage new data under a negative source ID to avoid clobbering
// live data during download/parse. Swap atomically on success.
val stagingId = -sourceId
- val sourceTimezoneId = resolveSourceTimezoneId(sourceId)
+ val sourceTimezoneId = source.parserTimezoneId()
prepareStagingSource(source, stagingId)
rawInputStream.use { raw ->
@@ -599,6 +613,8 @@ class EpgSourceRepositoryImpl @Inject constructor(
url = "streamvault://epg-source-staging/${source.id}",
enabled = false,
priority = Int.MAX_VALUE,
+ timezonePolicy = source.timezonePolicy,
+ timezoneId = source.timezoneId,
createdAt = now,
updatedAt = now
)
@@ -606,26 +622,30 @@ class EpgSourceRepositoryImpl @Inject constructor(
}
}
- private suspend fun resolveSourceTimezoneId(sourceId: Long): String? {
- val providerTimezoneIds = providerEpgSourceDao.getProviderIdsForSourceSync(sourceId)
- .distinct()
- .mapNotNull { providerId ->
- providerDao.getById(providerId)
- ?.stalkerDeviceTimezone
- ?.trim()
- ?.takeIf(String::isNotEmpty)
- }
- .distinct()
+ private fun EpgSourceEntity.parserTimezoneId(): String? = when (timezonePolicy) {
+ XmltvTimezonePolicy.REQUIRE_OFFSET -> null
+ XmltvTimezonePolicy.UTC -> "UTC"
+ XmltvTimezonePolicy.EXPLICIT_ZONE -> timezoneId
+ }
+}
- return when (providerTimezoneIds.size) {
- 0 -> null
- 1 -> providerTimezoneIds.single()
- else -> {
- Log.w(
- TAG,
- "Source $sourceId has multiple provider timezones $providerTimezoneIds; defaulting no-offset XMLTV timestamps to system timezone"
- )
- null
+internal fun validateXmltvTimezonePolicy(
+ policy: XmltvTimezonePolicy,
+ timezoneId: String?
+): Result<String?> {
+ val normalized = timezoneId?.trim()?.takeIf(String::isNotEmpty)
+ return when (policy) {
+ XmltvTimezonePolicy.REQUIRE_OFFSET,
+ XmltvTimezonePolicy.UTC -> Result.success(null)
+ XmltvTimezonePolicy.EXPLICIT_ZONE -> {
+ if (normalized == null) {
+ Result.error("Choose a timezone for offset-less XMLTV timestamps")
+ } else {
+ runCatching { java.time.ZoneId.of(normalized).id }
+ .fold(
+ onSuccess = Result.Companion::success,
+ onFailure = { Result.error("Invalid XMLTV timezone '$normalized'", it) }
+ )
}
}
}
diff --git a/data/src/test/java/com/streamvault/data/manager/BackupManagerImplTest.kt b/data/src/test/java/com/streamvault/data/manager/BackupManagerImplTest.kt
index 5a7de840..096ff14d 100644
--- a/data/src/test/java/com/streamvault/data/manager/BackupManagerImplTest.kt
+++ b/data/src/test/java/com/streamvault/data/manager/BackupManagerImplTest.kt
@@ -7,6 +7,7 @@ import com.google.gson.Gson
import com.google.common.truth.Truth.assertThat
import com.streamvault.data.local.DatabaseTransactionRunner
import com.streamvault.data.local.dao.EpisodeDao
+import com.streamvault.data.local.dao.EpgSourceDao
import com.streamvault.data.local.dao.FavoriteDao
import com.streamvault.data.local.dao.MovieDao
import com.streamvault.data.local.dao.PlaybackHistoryDao
@@ -16,6 +17,7 @@ import com.streamvault.data.local.dao.ChannelDao
import com.streamvault.data.local.dao.RecordingScheduleDao
import com.streamvault.data.local.dao.VirtualGroupDao
import com.streamvault.data.local.entity.ProviderEntity
+import com.streamvault.data.local.entity.EpgSourceEntity
import com.streamvault.data.local.entity.BackupRestoreCheckpointEntity
import com.streamvault.data.local.entity.ChannelEntity
import com.streamvault.data.local.entity.RecordingScheduleEntity
@@ -40,6 +42,7 @@ import com.streamvault.domain.model.ContentType
import com.streamvault.domain.model.Category
import com.streamvault.domain.model.DecoderMode
import com.streamvault.domain.model.Favorite
+import com.streamvault.domain.model.EpgSource
import com.streamvault.domain.model.PlaybackHistory
import com.streamvault.domain.model.Provider
import com.streamvault.domain.model.ProviderType
@@ -47,6 +50,7 @@ import com.streamvault.domain.model.RecordingItem
import com.streamvault.domain.model.RecordingRecurrence
import com.streamvault.domain.model.RecordingStatus
import com.streamvault.domain.model.Result
+import com.streamvault.domain.model.XmltvTimezonePolicy
import com.streamvault.domain.repository.CategoryRepository
import java.io.ByteArrayInputStream
import java.io.File
@@ -71,6 +75,64 @@ import org.mockito.kotlin.whenever
class BackupManagerImplTest {
+ @Test
+ fun `importConfig preserves explicit EPG source timezone interpretation`() = runBlocking {
+ val context: Context = mock()
+ val providerDao: ProviderDao = mock()
+ val epgSourceDao: EpgSourceDao = mock()
+ val file = File.createTempFile("streamvault-epg-timezone", ".json")
+ val backupData = BackupData(
+ version = 10,
+ epgSources = listOf(
+ EpgSource(
+ id = 91L,
+ name = "Local-time guide",
+ url = "https://example.com/guide.xml",
+ timezonePolicy = XmltvTimezonePolicy.EXPLICIT_ZONE,
+ timezoneId = "Europe/Amsterdam"
+ )
+ )
+ )
+ FileOutputStream(file).use { it.write(Gson().toJson(backupData).toByteArray()) }
+ whenever(providerDao.getAllSync()).thenReturn(emptyList())
+ whenever(epgSourceDao.getByUrl("https://example.com/guide.xml")).thenReturn(
+ EpgSourceEntity(
+ id = 7L,
+ name = "Existing",
+ url = "https://example.com/guide.xml"
+ )
+ )
+
+ try {
+ val result = backupManagerForValidation(
+ context = context,
+ providerDao = providerDao,
+ epgSourceDao = epgSourceDao
+ ).importConfig(
+ uriString = file.toURI().toString(),
+ plan = BackupImportPlan(
+ importPreferences = false,
+ importProviders = true,
+ importSavedLibrary = false,
+ importPlaybackHistory = false,
+ importMultiViewPresets = false,
+ importRecordingSchedules = false,
+ conflictStrategy = BackupConflictStrategy.REPLACE_EXISTING
+ )
+ )
+
+ assertThat(result).isInstanceOf(Result.Success::class.java)
+ verify(epgSourceDao).update(argThat<EpgSourceEntity> {
+ id == 7L &&
+ timezonePolicy == XmltvTimezonePolicy.EXPLICIT_ZONE &&
+ timezoneId == "Europe/Amsterdam"
+ })
+ } finally {
+ file.delete()
+ }
+ Unit
+ }
+
@Test
fun `inspectBackup rejects oversized non seekable input with typed byte limit`() = runBlocking {
val context: Context = mock()
@@ -173,7 +235,7 @@ class BackupManagerImplTest {
fun `inspectBackup rejects unsupported version before reading sections`() = runBlocking {
val error = inspectAdmissionFailure(
"unsupported-version",
- """{"version":10,"preferences":{"value":"${"x".repeat(8_193)}"}}"""
+ """{"version":11,"preferences":{"value":"${"x".repeat(8_193)}"}}"""
)
assertThat(error.reason).isEqualTo(BackupAdmissionReason.UNSUPPORTED_VERSION)
@@ -1873,6 +1935,7 @@ class BackupManagerImplTest {
categoryRepository: CategoryRepository = mock(),
virtualGroupDao: VirtualGroupDao = mock(),
credentialCrypto: CredentialCrypto = mock(),
+ epgSourceDao: EpgSourceDao? = null,
): BackupManagerImpl = BackupManagerImpl(
context = context,
preferencesRepository = preferencesRepository,
@@ -1891,7 +1954,8 @@ class BackupManagerImplTest {
},
gson = Gson(),
backupRestoreCheckpointDao = checkpointDao,
- channelDao = channelDao
+ channelDao = channelDao,
+ epgSourceDao = epgSourceDao
)
private fun preferencesOnlyPlan() = BackupImportPlan(
diff --git a/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt b/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt
index fc1a068b..8325a378 100644
--- a/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt
+++ b/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt
@@ -9,6 +9,8 @@ import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import java.io.ByteArrayOutputStream
+import java.time.LocalDateTime
+import java.time.ZoneId
import java.util.TimeZone
import java.util.zip.GZIPOutputStream
@@ -93,7 +95,7 @@ class XmltvParserTest {
</tv>
""".trimIndent()
- val programs = parser.parse(xml.byteInputStream())
+ val programs = parser.parse(xml.byteInputStream(), timezoneId = "UTC")
assertThat(programs).hasSize(2)
// Both programs should have non-zero timestamps
@@ -141,7 +143,7 @@ class XmltvParserTest {
</tv>
""".trimIndent()
- val programs = parser.parse(xml.byteInputStream())
+ val programs = parser.parse(xml.byteInputStream(), timezoneId = "Pacific/Honolulu")
assertThat(programs).hasSize(1)
val prog = programs[0]
@@ -170,50 +172,67 @@ class XmltvParserTest {
}
@Test
- fun `parse_noOffsetTimestamp_defaultsToSystemTimezoneWhenTimezoneMissing`() {
- val originalTimeZone = TimeZone.getDefault()
+ fun `parse_noOffsetTimestamp_isRejectedIndependentlyOfDeviceTimezone`() {
+ val xml = """
+ <?xml version="1.0"?>
+ <tv>
+ <programme start="20250101120000" stop="20250101130000" channel="ch1">
+ <title>Timezone Test</title>
+ </programme>
+ </tv>
+ """.trimIndent()
+
+ val original = TimeZone.getDefault()
try {
- TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"))
- val xml = """
- <?xml version="1.0"?>
- <tv>
- <programme start="20250101120000" stop="20250101130000" channel="ch1">
- <title>Timezone Test</title>
- </programme>
- </tv>
- """.trimIndent()
-
- val programs = parser.parse(xml.byteInputStream())
-
- assertThat(programs).hasSize(1)
- assertThat(programs.single().startTime).isEqualTo(1_735_729_200_000L)
+ listOf("Asia/Jerusalem", "America/Los_Angeles").forEach { deviceZone ->
+ TimeZone.setDefault(TimeZone.getTimeZone(deviceZone))
+ assertThat(parser.parse(xml.byteInputStream())).isEmpty()
+ }
} finally {
- TimeZone.setDefault(originalTimeZone)
+ TimeZone.setDefault(original)
}
}
- @Test
- fun `parse_noOffsetTimestamp_defaultsToSystemTimezoneWhenTimezoneInvalid`() {
- val originalTimeZone = TimeZone.getDefault()
- try {
- TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"))
- val xml = """
+ @Test
+ fun `parse_explicitTimezone_appliesDstRules`() {
+ val xml = """
+ <?xml version="1.0"?>
+ <tv>
+ <programme start="20250115120000" stop="20250115130000" channel="ch1">
+ <title>Winter</title>
+ </programme>
+ <programme start="20250715120000" stop="20250715130000" channel="ch1">
+ <title>Summer</title>
+ </programme>
+ </tv>
+ """.trimIndent()
+ val zone = ZoneId.of("Europe/Amsterdam")
+
+ val programs = parser.parse(xml.byteInputStream(), timezoneId = zone.id)
+
+ assertThat(programs.map { it.startTime }).containsExactly(
+ LocalDateTime.of(2025, 1, 15, 12, 0).atZone(zone).toInstant().toEpochMilli(),
+ LocalDateTime.of(2025, 7, 15, 12, 0).atZone(zone).toInstant().toEpochMilli()
+ ).inOrder()
+ }
+
+ @Test
+ fun `parse_noOffsetTimestamp_rejectsInvalidTimezoneConfiguration`() {
+ val xml = """
<?xml version="1.0"?>
<tv>
<programme start="20250101120000" stop="20250101130000" channel="ch1">
- <title>Timezone Test</title>
+ <title>Timezone Test</title>
</programme>
</tv>
- """.trimIndent()
+ """.trimIndent()
- val programs = parser.parse(xml.byteInputStream(), timezoneId = "Mars/Olympus")
+ val failure = runCatching {
+ parser.parse(xml.byteInputStream(), timezoneId = "Mars/Olympus")
+ }.exceptionOrNull()
- assertThat(programs).hasSize(1)
- assertThat(programs.single().startTime).isEqualTo(1_735_729_200_000L)
- } finally {
- TimeZone.setDefault(originalTimeZone)
- }
- }
+ assertThat(failure).isInstanceOf(IllegalArgumentException::class.java)
+ }
@Test
fun `parse_emptyStream_returnsEmpty`() {
diff --git a/data/src/test/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptorTest.kt b/data/src/test/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptorTest.kt
new file mode 100644
index 00000000..3ad140a5
--- /dev/null
+++ b/data/src/test/java/com/streamvault/data/remote/jellyfin/JellyfinImageAuthInterceptorTest.kt
@@ -0,0 +1,134 @@
+package com.streamvault.data.remote.jellyfin
+
+import com.google.common.truth.Truth.assertThat
+import com.streamvault.data.local.dao.ProviderDao
+import com.streamvault.data.local.entity.ProviderEntity
+import com.streamvault.data.security.CredentialCrypto
+import com.streamvault.domain.model.ProviderType
+import java.util.concurrent.ConcurrentHashMap
+import okhttp3.Interceptor
+import okhttp3.MediaType.Companion.toMediaType
+import okhttp3.OkHttpClient
+import okhttp3.Protocol
+import okhttp3.Request
+import okhttp3.Response
+import okhttp3.ResponseBody.Companion.toResponseBody
+import org.junit.Test
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.whenever
+
+class JellyfinImageAuthInterceptorTest {
+ private val providerDao: ProviderDao = mock()
+ private val credentialCrypto = object : CredentialCrypto {
+ override fun encryptIfNeeded(value: String): String = value
+ override fun decryptIfNeeded(value: String): String = value
+ }
+ private val interceptor = JellyfinImageAuthInterceptor(providerDao, credentialCrypto)
+
+ @Test
+ fun `two accounts on one server receive only their exact token`() {
+ whenever(providerDao.getByIdSync(1L)).thenReturn(provider(1L, "account-a", "token-a"))
+ whenever(providerDao.getByIdSync(2L)).thenReturn(provider(2L, "account-b", "token-b"))
+ val captured = ConcurrentHashMap<Long, Request>()
+
+ listOf(1L, 2L).parallelStream().forEach { providerId ->
+ captured[providerId] = execute(
+ "https://media.example/jellyfin/Items/item/Images/Primary" +
+ "?tag=art&streamvault_provider_id=$providerId"
+ )
+ }
+
+ assertThat(captured.getValue(1L).header("Authorization")).isEqualTo(
+ buildJellyfinAuthorizationHeader("https://media.example/jellyfin", "account-a", "token-a")
+ )
+ assertThat(captured.getValue(1L).header("Authorization")).doesNotContain("token-b")
+ assertThat(captured.getValue(2L).header("Authorization")).isEqualTo(
+ buildJellyfinAuthorizationHeader("https://media.example/jellyfin", "account-b", "token-b")
+ )
+ assertThat(captured.getValue(2L).header("Authorization")).doesNotContain("token-a")
+ captured.values.forEach { request ->
+ assertThat(request.url.queryParameter("streamvault_provider_id")).isNull()
+ }
+ }
+
+ @Test
+ fun `provider edits and deletes take effect on the next request`() {
+ whenever(providerDao.getByIdSync(7L))
+ .thenReturn(provider(7L, "account", "old-token"))
+ .thenReturn(provider(7L, "account", "new-token"))
+ .thenReturn(null)
+ val url = "https://media.example/jellyfin/Items/item/Images/Primary?streamvault_provider_id=7"
+
+ val beforeEdit = execute(url)
+ val afterEdit = execute(url)
+ val afterDelete = execute(url)
+
+ assertThat(beforeEdit.header("Authorization")).contains("Token=\"old-token\"")
+ assertThat(afterEdit.header("Authorization")).contains("Token=\"new-token\"")
+ assertThat(afterDelete.header("Authorization")).isNull()
+ assertThat(afterDelete.url.queryParameter("streamvault_provider_id")).isNull()
+ }
+
+ @Test
+ fun `same host with a different base path is not authenticated`() {
+ whenever(providerDao.getByIdSync(3L)).thenReturn(
+ provider(3L, "account", "secret", serverUrl = "https://media.example/jellyfin")
+ )
+
+ val captured = execute(
+ "https://media.example/other/Items/item/Images/Primary?streamvault_provider_id=3"
+ )
+
+ assertThat(captured.header("Authorization")).isNull()
+ assertThat(captured.url.queryParameter("streamvault_provider_id")).isNull()
+ }
+
+ @Test
+ fun `internal marker is stripped when caller already supplied authorization`() {
+ val captured = execute(
+ url = "https://media.example/jellyfin/Items/item/Images/Primary?streamvault_provider_id=9",
+ authorization = "Bearer caller-token"
+ )
+
+ assertThat(captured.header("Authorization")).isEqualTo("Bearer caller-token")
+ assertThat(captured.url.queryParameter("streamvault_provider_id")).isNull()
+ }
+
+ private fun execute(url: String, authorization: String? = null): Request {
+ lateinit var captured: Request
+ val terminal = Interceptor { chain ->
+ captured = chain.request()
+ Response.Builder()
+ .request(captured)
+ .protocol(Protocol.HTTP_1_1)
+ .code(200)
+ .message("OK")
+ .body("ok".toResponseBody("text/plain".toMediaType()))
+ .build()
+ }
+ val client = OkHttpClient.Builder()
+ .addInterceptor(interceptor)
+ .addInterceptor(terminal)
+ .build()
+ val request = Request.Builder()
+ .url(url)
+ .apply { authorization?.let { header("Authorization", it) } }
+ .build()
+ client.newCall(request).execute().close()
+ return captured
+ }
+
+ private fun provider(
+ id: Long,
+ username: String,
+ token: String,
+ serverUrl: String = "https://media.example/jellyfin"
+ ) = ProviderEntity(
+ id = id,
+ name = "Jellyfin $id",
+ type = ProviderType.JELLYFIN,
+ serverUrl = serverUrl,
+ username = username,
+ password = token
+ )
+}
diff --git a/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt b/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt
index 99627ca0..20de4c7a 100644
--- a/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt
+++ b/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt
@@ -690,6 +690,7 @@ class XtreamStreamUrlResolverTest {
override fun getActive() = flowOf(provider)
override suspend fun getByUrlAndUser(serverUrl: String, username: String, stalkerMacAddress: String): ProviderEntity? = null
override suspend fun getById(id: Long): ProviderEntity? = provider?.takeIf { it.id == id }
+ override fun getByIdSync(id: Long): ProviderEntity? = provider?.takeIf { it.id == id }
override suspend fun getByIds(ids: List<Long>): List<ProviderEntity> =
listOfNotNull(provider).filter { it.id in ids }
override fun getByTypeSync(type: ProviderType): List<ProviderEntity> =
diff --git a/data/src/test/java/com/streamvault/data/repository/EpgSourceRepositoryImplTest.kt b/data/src/test/java/com/streamvault/data/repository/EpgSourceRepositoryImplTest.kt
index 85bbb1ff..5be820fb 100644
--- a/data/src/test/java/com/streamvault/data/repository/EpgSourceRepositoryImplTest.kt
+++ b/data/src/test/java/com/streamvault/data/repository/EpgSourceRepositoryImplTest.kt
@@ -10,13 +10,11 @@ import com.streamvault.data.local.dao.ChannelEpgMappingDao
import com.streamvault.data.local.dao.EpgChannelDao
import com.streamvault.data.local.dao.EpgProgrammeDao
import com.streamvault.data.local.dao.EpgSourceDao
-import com.streamvault.data.local.dao.ProviderDao
import com.streamvault.data.local.dao.ProviderEpgSourceDao
import com.streamvault.data.local.entity.ChannelEpgMappingEntity
import com.streamvault.data.local.entity.EpgChannelEntity
import com.streamvault.data.local.entity.EpgProgrammeEntity
import com.streamvault.data.local.entity.EpgSourceEntity
-import com.streamvault.data.local.entity.ProviderEntity
import com.streamvault.data.local.entity.ProviderEpgSourceEntity
import com.streamvault.data.parser.XmltvParser
import com.streamvault.data.preferences.PreferencesRepository
@@ -24,7 +22,7 @@ import com.streamvault.domain.model.ContentType
import com.streamvault.domain.model.EpgMatchType
import com.streamvault.domain.model.EpgSourceType
import com.streamvault.domain.model.Result
-import com.streamvault.domain.model.ProviderType
+import com.streamvault.domain.model.XmltvTimezonePolicy
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.IOException
@@ -71,7 +69,6 @@ class EpgSourceRepositoryImplTest {
private val contentResolver: ContentResolver = mock()
private val epgSourceDao: EpgSourceDao = mock()
private val providerEpgSourceDao: ProviderEpgSourceDao = mock()
- private val providerDao: ProviderDao = mock()
private val channelEpgMappingDao: ChannelEpgMappingDao = mock()
private val epgChannelDao: EpgChannelDao = mock()
private val epgProgrammeDao: EpgProgrammeDao = mock()
@@ -94,13 +91,11 @@ class EpgSourceRepositoryImplTest {
whenever(epgHttpClientBuilder.readTimeout(any<Long>(), any())).thenReturn(epgHttpClientBuilder)
whenever(epgHttpClientBuilder.build()).thenReturn(okHttpClient)
runBlocking {
- whenever(providerDao.getById(any())).thenReturn(null)
}
repository = EpgSourceRepositoryImpl(
context = context,
epgSourceDao = epgSourceDao,
providerEpgSourceDao = providerEpgSourceDao,
- providerDao = providerDao,
channelEpgMappingDao = channelEpgMappingDao,
epgChannelDao = epgChannelDao,
epgProgrammeDao = epgProgrammeDao,
@@ -306,7 +301,6 @@ class EpgSourceRepositoryImplTest {
context = context,
epgSourceDao = epgSourceDao,
providerEpgSourceDao = providerEpgSourceDao,
- providerDao = providerDao,
channelEpgMappingDao = channelEpgMappingDao,
epgChannelDao = epgChannelDao,
epgProgrammeDao = epgProgrammeDao,
@@ -420,11 +414,13 @@ class EpgSourceRepositoryImplTest {
}
@Test
- fun `refreshSource passes shared provider timezone to parser when assignments agree`() = runTest {
+ fun `refreshSource uses explicit source timezone regardless of assignments`() = runTest {
val source = EpgSourceEntity(
id = 10L,
name = "Primary",
- url = "https://example.com/epg.xml"
+ url = "https://example.com/epg.xml",
+ timezonePolicy = XmltvTimezonePolicy.EXPLICIT_ZONE,
+ timezoneId = "America/New_York"
)
val request = Request.Builder().url(source.url).build()
val response = Response.Builder()
@@ -441,24 +437,6 @@ class EpgSourceRepositoryImplTest {
enqueueResponse(call, response)
whenever(xmltvParser.maybeDecompressGzip(eq(source.url), any())).thenAnswer { it.arguments[1] }
whenever(providerEpgSourceDao.getProviderIdsForSourceSync(10L)).thenReturn(listOf(7L, 8L))
- whenever(providerDao.getById(7L)).thenReturn(
- ProviderEntity(
- id = 7L,
- name = "Provider 7",
- type = ProviderType.M3U,
- serverUrl = "https://provider7.example.com",
- stalkerDeviceTimezone = "America/New_York"
- )
- )
- whenever(providerDao.getById(8L)).thenReturn(
- ProviderEntity(
- id = 8L,
- name = "Provider 8",
- type = ProviderType.M3U,
- serverUrl = "https://provider8.example.com",
- stalkerDeviceTimezone = "America/New_York"
- )
- )
val result = repository.refreshSource(10L)
@@ -467,7 +445,7 @@ class EpgSourceRepositoryImplTest {
}
@Test
- fun `refreshSource falls back to system timezone when assigned providers disagree`() = runTest {
+ fun `refreshSource requires offsets when source has no timezone override`() = runTest {
val source = EpgSourceEntity(
id = 10L,
name = "Primary",
@@ -488,24 +466,6 @@ class EpgSourceRepositoryImplTest {
enqueueResponse(call, response)
whenever(xmltvParser.maybeDecompressGzip(eq(source.url), any())).thenAnswer { it.arguments[1] }
whenever(providerEpgSourceDao.getProviderIdsForSourceSync(10L)).thenReturn(listOf(7L, 8L))
- whenever(providerDao.getById(7L)).thenReturn(
- ProviderEntity(
- id = 7L,
- name = "Provider 7",
- type = ProviderType.M3U,
- serverUrl = "https://provider7.example.com",
- stalkerDeviceTimezone = "America/New_York"
- )
- )
- whenever(providerDao.getById(8L)).thenReturn(
- ProviderEntity(
- id = 8L,
- name = "Provider 8",
- type = ProviderType.M3U,
- serverUrl = "https://provider8.example.com",
- stalkerDeviceTimezone = "Europe/London"
- )
- )
val result = repository.refreshSource(10L)
@@ -513,6 +473,26 @@ class EpgSourceRepositoryImplTest {
verify(xmltvParser).parseStreamingWithChannels(any(), isNull(), any(), any())
}
+ @Test
+ fun `timezone policy validation accepts only valid explicit IANA zones`() {
+ val valid = validateXmltvTimezonePolicy(
+ XmltvTimezonePolicy.EXPLICIT_ZONE,
+ " Europe/Amsterdam "
+ )
+ val invalid = validateXmltvTimezonePolicy(
+ XmltvTimezonePolicy.EXPLICIT_ZONE,
+ "Mars/Olympus"
+ )
+ val missing = validateXmltvTimezonePolicy(
+ XmltvTimezonePolicy.EXPLICIT_ZONE,
+ null
+ )
+
+ assertThat((valid as Result.Success).data).isEqualTo("Europe/Amsterdam")
+ assertThat(invalid).isInstanceOf(Result.Error::class.java)
+ assertThat(missing).isInstanceOf(Result.Error::class.java)
+ }
+
private class CloseTrackingInputStream : ByteArrayInputStream(byteArrayOf()) {
var closed: Boolean = false
private set
diff --git a/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt b/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt
index 0ebee9d0..26f84aaf 100644
--- a/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt
+++ b/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt
@@ -109,6 +109,7 @@ class SyncManagerTest {
private val provider: ProviderEntity? = sampleProvider()
) : ProviderDao() {
override suspend fun getById(id: Long): ProviderEntity? = provider
+ override fun getByIdSync(id: Long): ProviderEntity? = provider?.takeIf { it.id == id }
override suspend fun getByIds(ids: List<Long>): List<ProviderEntity> =
listOfNotNull(provider).filter { it.id in ids }
override suspend fun updateSyncTime(id: Long, timestamp: Long) = Unit
diff --git a/docs/IPTV_CODE_REVIEW.md b/docs/IPTV_CODE_REVIEW.md
index b417f233..3ff05374 100644
--- a/docs/IPTV_CODE_REVIEW.md
+++ b/docs/IPTV_CODE_REVIEW.md
@@ -624,11 +624,11 @@ Phase 3 should keep these shared defects separate from provider-specific behavio
| M3U-001 | Playlist decoding is fixed to UTF-8 and only the first header EPG URL is retained | Confirmed defect | Medium |
| M3U-002 | Query-bearing VOD file URLs are classified as live streams | Confirmed defect | Medium |
| XMLTV-001 | The 200 MB EPG limit measures compressed, not decompressed, bytes | Resolved (2026-07-26) | High |
-| XMLTV-002 | Shared no-offset XMLTV sources fall back to the device timezone | Architectural concern | Medium |
+| XMLTV-002 | Shared no-offset XMLTV sources fall back to the device timezone | Implemented; migration/device verification pending (2026-07-30) | Medium |
| JELLYFIN-001 | Jellyfin catalog APIs buffer unpaginated libraries without a byte bound | Confirmed defect | High |
-| JELLYFIN-002 | Images from two accounts on one server use whichever provider matches first | Confirmed defect | High |
-| PLUGIN-001 | Plugin provider fallback can overwrite/delete a user-created M3U provider | Resolved (2026-07-26) | High |
-| PLUGIN-002 | Manifest IDs are not package-scoped and absent plugins are not reconciled | Resolved (2026-07-26) | High |
+| JELLYFIN-002 | Images from two accounts on one server use whichever provider matches first | Implemented; migration/device verification pending (2026-07-30) | High |
+| PLUGIN-001 | Plugin provider fallback can overwrite/delete a user-created M3U provider | Implemented; ownership lifecycle matrix pending (2026-07-30) | High |
+| PLUGIN-002 | Manifest IDs are not package-scoped and absent plugins are not reconciled | Implemented; package lifecycle matrix pending (2026-07-30) | High |
| PLUGIN-003 | Playback preparation is a sequential, multi-minute, first-handler chain | Implemented; IPC lifecycle verification pending (2026-07-27) | High |
## Stalker Portal deep review
@@ -723,7 +723,7 @@ Phase 3 should keep these shared defects separate from provider-specific behavio
### XTREAM-002 — A transient category failure is cached as an empty adult-category set
-- **Classification:** Resolved (2026-07-26)
+- **Classification:** Implemented; ownership lifecycle matrix pending (2026-07-30)
- **Severity:** Medium
- **Where:** `XtreamProvider.loadAdultCategoryIds:665-697`; long-lived provider caches in `MovieRepositoryImpl:138,1680-1713` and `SeriesRepositoryImpl:113,1660-1693`.
- **Current behavior:** Category fetch failure is caught, logged, converted to `emptyList`, then transformed to an empty set and cached by content type. Subsequent item mapping never retries category loading for that provider instance. Repository provider instances can live for the process.
@@ -779,7 +779,7 @@ Phase 3 should keep these shared defects separate from provider-specific behavio
### XMLTV-002 — Shared no-offset XMLTV sources fall back to the device timezone
-- **Classification:** Architectural concern
+- **Classification:** Implemented; migration/device verification pending (2026-07-30)
- **Severity:** Medium
- **Where:** `EpgSourceRepositoryImpl.resolveSourceTimezoneId:584-605`; `XmltvParser.resolveParsingZoneId:643-652`; unique URL/source and many-provider assignment entities.
- **Current behavior:** The repository derives timezone only from assigned providers' `stalkerDeviceTimezone`. Zero timezones or more than one distinct timezone returns `null`; the parser then uses `ZoneId.systemDefault()`. A unique EPG source is parsed once, so it cannot represent different no-offset interpretations per provider.
@@ -789,6 +789,8 @@ Phase 3 should keep these shared defects separate from provider-specific behavio
- **Fix scope:** EPG source model and assignment UX; schema work in Phase 4.
- **Required tests:** Same source on devices with different system zones; one/multiple provider zones; explicit source override; DST; offset-bearing input unaffected; backup/restore preserves interpretation.
+**Resolution:** XMLTV interpretation is now owned by the EPG source through an explicit `REQUIRE_OFFSET`, `UTC`, or `EXPLICIT_ZONE` policy. Parsing no longer consults the Android/JVM default timezone or derives a shared source's interpretation from assigned providers. Existing sources migrate to the safe `REQUIRE_OFFSET` policy, while settings allow users to choose UTC or a validated IANA timezone and immediately reparse the source. The policy and timezone are included in backup format v10 and restored transactionally with other Room-backed configuration. Focused parser, repository, backup, compile, and migration-compilation coverage passes; on-device execution of the 71→72 migration remains pending.
+
## Jellyfin, local media, and recordings review
### JELLYFIN-001 — Jellyfin catalog APIs buffer unpaginated libraries without a byte bound
@@ -810,7 +812,7 @@ Focused JVM coverage verifies explicit continuation parameters, multi-page conti
### JELLYFIN-002 — Images from two accounts on one server use whichever provider matches first
-- **Classification:** Confirmed defect
+- **Classification:** Implemented; migration/device verification pending (2026-07-30)
- **Severity:** High
- **Where:** `JellyfinImageAuthInterceptor.kt:13-76`; image URLs built without provider identity at `JellyfinProvider.kt:223-331`; provider lookup is `firstOrNull` by scheme/host/port/base path.
- **Current behavior:** Image requests carry no provider/account ID. The singleton interceptor loads all Jellyfin providers and selects the first whose base URL matches, then attaches that provider's token. Two users/providers on the same server/base path are indistinguishable. Provider order has no documented ownership rule.
@@ -820,7 +822,7 @@ Focused JVM coverage verifies explicit continuation parameters, multi-page conti
- **Fix scope:** Image URL/request contract across data/app/Coil.
- **Required tests:** Two accounts same base URL, different base paths, active-provider switch, delete/edit within cache TTL, parallel image requests, and token-specific visibility.
-**Resolution (2026-07-26):** Every generated Jellyfin image URL now carries an internal provider ID, which the interceptor validates against the URL before attaching that provider's token. It never guesses an account from host/path. Database migration 64→65 backfills the marker on existing Jellyfin movie, series, and episode artwork URLs, so already-synced catalogs receive the same account identity on upgrade.
+**Implementation (updated 2026-07-30):** Every generated Jellyfin image URL carries an internal provider ID, which the interceptor validates against the URL before attaching that exact provider's token. It never guesses an account from host/path. The interceptor now queries the exact provider on every request so an edit/delete takes effect immediately, and strips the app-internal marker on every marked request, including malformed, mismatched-path, missing-provider, and caller-authenticated cases. Database migration 64→65 backfills the marker on existing Jellyfin movie, series, and episode artwork URLs. Focused tests cover parallel accounts on one base URL, different base paths, immediate token edit/delete, and marker stripping. The finding remains open until the populated migration and device/Coil cache behavior are verified.
The Phase 2 recording cancellation defect REC-001 remains the principal provider-adjacent recording fault. Local recordings themselves use persisted file/SAF outputs rather than a separate catalog provider; their end-to-end scheduling, reconciliation, and playback flows remain in Phase 4.
@@ -838,11 +840,11 @@ The Phase 2 recording cancellation defect REC-001 remains the principal provider
- **Fix scope:** Plugin-provider persistence model and migration.
- **Required tests:** Same name as user provider, two plugins same provider name, lost preferences with existing mapping, disable/delete, restore, provider rename, and atomic mapping/provider creation.
-**Resolution:** Plugin-created M3U providers now receive a durable Room ownership record keyed by the plugin package, service class, and manifest ID. Plugin synchronization and disable cleanup resolve only through that record; the unsafe display-name fallback was removed. Consequently, a user-created M3U provider is never implicitly adopted, updated, or deleted by a plugin. Existing ambiguous legacy mappings are intentionally not auto-adopted, preserving user providers safely during upgrade.
+**Implementation:** Plugin-created M3U providers receive a durable Room ownership record keyed by the plugin package, service class, and manifest ID. Plugin synchronization and disable cleanup resolve only through that record; the unsafe display-name fallback was removed. Existing ambiguous legacy mappings are intentionally not auto-adopted. The finding remains open until the same-name, lost-preference, disable/delete, restore, rename, and atomic provider-plus-mapping creation matrix passes.
### PLUGIN-002 — Manifest IDs are not package-scoped and absent plugins are not reconciled
-- **Classification:** Resolved (2026-07-26)
+- **Classification:** Implemented; package lifecycle matrix pending (2026-07-30)
- **Severity:** High
- **Where:** `discoverPlugins:55-60`, enabled/provider keys at `90,496,504,532,680-681`, `resolvePlugin:545-575`; no package-removal or installed-set reconciliation path was found.
- **Current behavior:** Discovery deduplicates solely by plugin-supplied `manifest.id`. Enable state and provider mapping are also keyed only by that ID, not package/service. Two installed packages with the same ID share state and one disappears from discovery. If a package is uninstalled externally, its preferences and M3U provider/catalog remain because cleanup only occurs through `setPluginEnabled(false)` on an installed plugin object.
@@ -852,7 +854,7 @@ The Phase 2 recording cancellation defect REC-001 remains the principal provider
- **Fix scope:** Plugin identity/lifecycle architecture.
- **Required tests:** Duplicate IDs, multiple services in one package, uninstall/replace/reinstall/signature/version change as product policy allows, active/combined source cleanup, and user adoption preservation.
-**Resolution:** Plugin enablement and provider ownership now use the package/service/manifest triple, so manifest-ID collisions across packages or services cannot share state or provider mappings. Startup reconciliation compares durable ownership records with installed service components and removes only providers proven to be owned by an absent plugin, including active-source cleanup. Legacy enabled state is migrated only when the manifest ID is unique among installed services.
+**Implementation (updated 2026-07-30):** Plugin enablement and provider ownership use the package/service/manifest triple, so manifest-ID collisions across packages or services cannot share state or provider mappings. Reconciliation now uses the installed Android package/service component as the deletion authority and never treats transient manifest IPC failure or a manifest-ID rename as uninstall. Package broadcasts trigger immediate reconciliation with a `goAsync` lifetime, startup remains the durable retry, and a sole mapping for a renamed manifest ID is re-keyed atomically; ambiguous component mappings are never guessed between. Legacy enabled state is migrated only when the manifest ID is unique among installed services. The finding remains open pending uninstall/replace/reinstall, signature/version policy, active/combined-source, and explicit user-adoption device/integration coverage.
### PLUGIN-003 — Playback preparation is a sequential, multi-minute, first-handler chain
@@ -1297,6 +1299,12 @@ WP0 and the initial WP7 harness can start immediately. WP1 establishes the cance
- **Deliverables:** capability-based provider interfaces and provider-specific configuration/runtime records; per-provider Stalker cookie/session containers; typed authentication-expiry handling; provider-zone date parsing; collision-resistant remote identity; account-specific Jellyfin image resolution; package/component-scoped plugin IDs and explicit ownership; stable source timezone policy.
- **Exit criteria:** concurrent same-host/different-account fixtures prove cookie/image/session isolation; nonnumeric IDs remain unique across restart/migration; plugin uninstall cannot alter user-owned M3U data; absent/renamed plugins reconcile deterministically; shared XMLTV sources require explicit timezone or preserve per-assignment semantics.
+**Implementation evidence (2026-07-30):**
+
+- Plugins: reconciliation deletion is now package/service-component scoped and runs both at startup and on package lifecycle broadcasts. Manifest retrieval failure cannot masquerade as uninstall; a sole manifest-ID rename retains and atomically re-keys its provider ownership, while ambiguous mappings are left untouched. Focused ownership-policy tests cover cross-package ID reuse, multiple services, rename retention, ambiguity, and component absence.
+- Jellyfin: image authentication now performs an exact provider-ID lookup without a stale account cache and always removes internal routing metadata before network dispatch. Parallel same-server account, base-path, edit/delete, and pre-authenticated request tests pass.
+- Status policy: PLUGIN-001 and PLUGIN-002 were changed from “resolved” to implemented-but-open. Their complete ownership creation, restore, uninstall/replace/reinstall, active/combined-source, and adoption-policy matrices are still required for WP3 closure.
+
### WP4 — Bounded ingestion and provider correctness
- **Findings:** SYNC-001, STALKER-004, XTREAM-002, M3U-001, M3U-002, XMLTV-001, JELLYFIN-001.
diff --git a/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt b/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt
index d6aa0282..fce4b74e 100644
--- a/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt
+++ b/domain/src/main/java/com/streamvault/domain/manager/BackupManager.kt
@@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.Flow
import com.streamvault.domain.model.Result
data class BackupData(
- val version: Int = 9,
+ val version: Int = 10,
val checksum: String? = null,
val preferences: Map<String, String>? = null,
val providers: List<Provider>? = null,
@@ -18,7 +18,8 @@ data class BackupData(
val multiViewPresets: Map<String, List<Long>>? = null,
val protectedCategories: List<ProtectedCategoryBackup>? = null,
val scheduledRecordings: List<ScheduledRecordingBackup>? = null,
- val portableProviderPreferences: PortableProviderPreferencesBackup? = null
+ val portableProviderPreferences: PortableProviderPreferencesBackup? = null,
+ val epgSources: List<com.streamvault.domain.model.EpgSource>? = null
)
/**
diff --git a/domain/src/main/java/com/streamvault/domain/model/EpgModels.kt b/domain/src/main/java/com/streamvault/domain/model/EpgModels.kt
index 7b9f961c..160a9dd8 100644
--- a/domain/src/main/java/com/streamvault/domain/model/EpgModels.kt
+++ b/domain/src/main/java/com/streamvault/domain/model/EpgModels.kt
@@ -3,6 +3,17 @@ package com.streamvault.domain.model
/**
* Represents an external EPG source (e.g. an XMLTV URL).
*/
+enum class XmltvTimezonePolicy {
+ /** XMLTV timestamps must contain an explicit offset or UTC designator. */
+ REQUIRE_OFFSET,
+
+ /** Offset-less XMLTV timestamps are interpreted as UTC. */
+ UTC,
+
+ /** Offset-less XMLTV timestamps are interpreted in [EpgSource.timezoneId]. */
+ EXPLICIT_ZONE
+}
+
data class EpgSource(
val id: Long = 0,
val name: String,
@@ -15,7 +26,9 @@ data class EpgSource(
val createdAt: Long = System.currentTimeMillis(),
val updatedAt: Long = System.currentTimeMillis(),
val etag: String? = null,
- val lastModifiedHeader: String? = null
+ val lastModifiedHeader: String? = null,
+ val timezonePolicy: XmltvTimezonePolicy = XmltvTimezonePolicy.REQUIRE_OFFSET,
+ val timezoneId: String? = null
)
/**
diff --git a/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt
index 8c90a95b..e0d31921 100644
--- a/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt
+++ b/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt
@@ -7,6 +7,7 @@ import com.streamvault.domain.model.EpgSource
import com.streamvault.domain.model.Program
import com.streamvault.domain.model.ProviderEpgSourceAssignment
import com.streamvault.domain.model.Result
+import com.streamvault.domain.model.XmltvTimezonePolicy
import kotlinx.coroutines.flow.Flow
interface EpgSourceRepository {
@@ -17,7 +18,12 @@ interface EpgSourceRepository {
suspend fun getSourceById(id: Long): EpgSource?
- suspend fun addSource(name: String, url: String): Result<EpgSource>
+ suspend fun addSource(
+ name: String,
+ url: String,
+ timezonePolicy: XmltvTimezonePolicy = XmltvTimezonePolicy.REQUIRE_OFFSET,
+ timezoneId: String? = null
+ ): Result<EpgSource>
suspend fun updateSource(source: EpgSource): Result<Unit>