Skip to content

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

Implement Stalker index-first sync hardening

David Nashashe5e6be3acb76
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 4f0373a0..dc0f87d3 100644
--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt
+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt
@@ -90,7 +90,8 @@ object DatabaseModule {
StreamVaultDatabase.MIGRATION_48_49,
StreamVaultDatabase.MIGRATION_49_50,
StreamVaultDatabase.MIGRATION_50_51,
- StreamVaultDatabase.MIGRATION_51_52
+ StreamVaultDatabase.MIGRATION_51_52,
+ StreamVaultDatabase.MIGRATION_52_53
)
// 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/ui/screens/settings/SettingsSyncActions.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsSyncActions.kt
index 7563eb05..69f72772 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsSyncActions.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsSyncActions.kt
@@ -145,7 +145,9 @@ internal class SettingsSyncActions(
uiState.update { state -> state.copy(syncProgress = progress, syncingProviderName = providerName) }
}) {
is Result.Error -> failures += "${selection.label(appContext)}: ${result.message}"
- else -> completed += selection.completionLabel(isXtream = provider?.type == ProviderType.XTREAM_CODES)
+ else -> completed += selection.completionLabel(
+ isXtream = provider?.type == ProviderType.XTREAM_CODES || provider?.type == ProviderType.STALKER_PORTAL
+ )
}
}
@@ -195,7 +197,7 @@ internal class SettingsSyncActions(
return buildList {
add(ProviderSyncSelection.TV)
add(ProviderSyncSelection.MOVIES)
- if (provider?.type == ProviderType.XTREAM_CODES) {
+ if (provider?.type == ProviderType.XTREAM_CODES || provider?.type == ProviderType.STALKER_PORTAL) {
add(ProviderSyncSelection.SERIES)
}
add(ProviderSyncSelection.EPG)
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 c19b0ee4..608de400 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
@@ -78,7 +78,7 @@ import kotlinx.coroutines.launch
import kotlin.math.max
import javax.inject.Inject
-private const val XTREAM_INDEX_STATUS_PREFIX = "Xtream index:"
+private const val BACKGROUND_INDEX_STATUS_PREFIX = "Background index:"
@HiltViewModel
@OptIn(ExperimentalCoroutinesApi::class)
@@ -288,7 +288,7 @@ class SettingsViewModel @Inject constructor(
val preservedWarnings = state.syncWarningsByProvider
.filterKeys { it in providerIds }
.mapValues { (_, warnings) ->
- warnings.filterNot { warning -> warning.startsWith(XTREAM_INDEX_STATUS_PREFIX) }
+ warnings.filterNot { warning -> warning.startsWith(BACKGROUND_INDEX_STATUS_PREFIX) }
}
.filterValues { it.isNotEmpty() }
state.copy(
@@ -351,9 +351,9 @@ class SettingsViewModel @Inject constructor(
else -> section.lowercase().replaceFirstChar { it.titlecase() }
}
return when (state) {
- "PARTIAL" -> "$XTREAM_INDEX_STATUS_PREFIX $label partial: ${indexedRows} indexed"
- "FAILED_RETRYABLE" -> "$XTREAM_INDEX_STATUS_PREFIX $label retryable failed${lastError?.let { ": $it" }.orEmpty()}"
- "FAILED_PERMANENT" -> "$XTREAM_INDEX_STATUS_PREFIX $label permanently failed${lastError?.let { ": $it" }.orEmpty()}"
+ "PARTIAL" -> "$BACKGROUND_INDEX_STATUS_PREFIX $label partial: ${indexedRows} indexed"
+ "FAILED_RETRYABLE" -> "$BACKGROUND_INDEX_STATUS_PREFIX $label retryable failed${lastError?.let { ": $it" }.orEmpty()}"
+ "FAILED_PERMANENT" -> "$BACKGROUND_INDEX_STATUS_PREFIX $label permanently failed${lastError?.let { ": $it" }.orEmpty()}"
else -> null
}
}
diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/53.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/53.json
new file mode 100644
index 00000000..09d5192e
--- /dev/null
+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/53.json
@@ -0,0 +1,5057 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 53,
+ "identityHash": "feb751bea12eb7d3f6c0960db057a565",
+ "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, `is_active` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `epg_sync_mode` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `xtream_live_sync_mode` TEXT NOT NULL, `m3u_vod_classification_enabled` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "serverUrl",
+ "columnName": "server_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "username",
+ "columnName": "username",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "password",
+ "columnName": "password",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "m3uUrl",
+ "columnName": "m3u_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgUrl",
+ "columnName": "epg_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "httpUserAgent",
+ "columnName": "http_user_agent",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "httpHeaders",
+ "columnName": "http_headers",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerMacAddress",
+ "columnName": "stalker_mac_address",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceProfile",
+ "columnName": "stalker_device_profile",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceTimezone",
+ "columnName": "stalker_device_timezone",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stalkerDeviceLocale",
+ "columnName": "stalker_device_locale",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isActive",
+ "columnName": "is_active",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "maxConnections",
+ "columnName": "max_connections",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "expirationDate",
+ "columnName": "expiration_date",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "apiVersion",
+ "columnName": "api_version",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "allowedOutputFormatsJson",
+ "columnName": "allowed_output_formats_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSyncMode",
+ "columnName": "epg_sync_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xtreamFastSyncEnabled",
+ "columnName": "xtream_fast_sync_enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xtreamLiveSyncMode",
+ "columnName": "xtream_live_sync_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "m3uVodClassificationEnabled",
+ "columnName": "m3u_vod_classification_enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncedAt",
+ "columnName": "last_synced_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_providers_server_url_username_stalker_mac_address",
+ "unique": true,
+ "columnNames": [
+ "server_url",
+ "username",
+ "stalker_mac_address"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username_stalker_mac_address` ON `${TABLE_NAME}` (`server_url`, `username`, `stalker_mac_address`)"
+ }
+ ]
+ },
+ {
+ "tableName": "channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logoUrl",
+ "columnName": "logo_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "groupTitle",
+ "columnName": "group_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgChannelId",
+ "columnName": "epg_channel_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "number",
+ "columnName": "number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSupported",
+ "columnName": "catch_up_supported",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpDays",
+ "columnName": "catch_up_days",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSource",
+ "columnName": "catchUpSource",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logicalGroupId",
+ "columnName": "logical_group_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "errorCount",
+ "columnName": "error_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "qualityOptionsJson",
+ "columnName": "quality_options_json",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channels_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_channels_provider_id_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"
+ },
+ {
+ "name": "index_channels_provider_id_stream_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "stream_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"
+ },
+ {
+ "name": "index_channels_logical_group_id",
+ "unique": false,
+ "columnNames": [
+ "logical_group_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"
+ },
+ {
+ "name": "index_channels_provider_id_category_id_logical_group_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "logical_group_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channel_preferences",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `audio_video_offset_ms` INTEGER, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`channel_id`) REFERENCES `channels`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "aspectRatio",
+ "columnName": "aspect_ratio",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "audioVideoOffsetMs",
+ "columnName": "audio_video_offset_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channel_preferences_channel_id",
+ "unique": true,
+ "columnNames": [
+ "channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_preferences_channel_id` ON `${TABLE_NAME}` (`channel_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "channels",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "channel_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channels_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`channels`)",
+ "fields": [
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": []
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "simple",
+ "tokenizerArgs": [],
+ "contentTable": "channels",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": [
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_UPDATE BEFORE UPDATE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_DELETE BEFORE DELETE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_UPDATE AFTER UPDATE ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_INSERT AFTER INSERT ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"
+ ]
+ },
+ {
+ "tableName": "movies",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "durationSeconds",
+ "columnName": "duration_seconds",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchProgress",
+ "columnName": "watch_progress",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchCount",
+ "columnName": "watch_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastWatchedAt",
+ "columnName": "last_watched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cacheState",
+ "columnName": "cache_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "detailHydratedAt",
+ "columnName": "detail_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remoteStaleAt",
+ "columnName": "remote_stale_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_movies_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_movies_provider_id_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"
+ },
+ {
+ "name": "index_movies_provider_id_stream_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "stream_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_movies_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"
+ },
+ {
+ "name": "index_movies_provider_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_movies_provider_id_category_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_movies_provider_id_rating_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "rating",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"
+ },
+ {
+ "name": "index_movies_provider_id_added_at_release_date_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "added_at",
+ "release_date",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_added_at_release_date_name_id` ON `${TABLE_NAME}` (`provider_id`, `added_at`, `release_date`, `name`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "movies_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`movies`)",
+ "fields": [
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": []
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "simple",
+ "tokenizerArgs": [],
+ "contentTable": "movies",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": [
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_UPDATE BEFORE UPDATE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_DELETE BEFORE DELETE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_UPDATE AFTER UPDATE ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_INSERT AFTER INSERT ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"
+ ]
+ },
+ {
+ "tableName": "series",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerSeriesId",
+ "columnName": "provider_series_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "episodeRunTime",
+ "columnName": "episode_run_time",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cacheState",
+ "columnName": "cache_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "detailHydratedAt",
+ "columnName": "detail_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remoteStaleAt",
+ "columnName": "remote_stale_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_series_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_series_provider_id_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"
+ },
+ {
+ "name": "index_series_provider_id_series_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "series_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_series_provider_id_series_id` ON `${TABLE_NAME}` (`provider_id`, `series_id`)"
+ },
+ {
+ "name": "index_series_provider_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_series_provider_id_category_id_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"
+ },
+ {
+ "name": "index_series_provider_id_rating_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "rating",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"
+ },
+ {
+ "name": "index_series_provider_id_last_modified_name_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "last_modified",
+ "name",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_last_modified_name_id` ON `${TABLE_NAME}` (`provider_id`, `last_modified`, `name`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "series_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",
+ "fields": [
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": []
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "simple",
+ "tokenizerArgs": [],
+ "contentTable": "series",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": [
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",
+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"
+ ]
+ },
+ {
+ "tableName": "episodes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "episodeId",
+ "columnName": "episode_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "episodeNumber",
+ "columnName": "episode_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seasonNumber",
+ "columnName": "season_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "durationSeconds",
+ "columnName": "duration_seconds",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchProgress",
+ "columnName": "watch_progress",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastWatchedAt",
+ "columnName": "last_watched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_episodes_series_id",
+ "unique": false,
+ "columnNames": [
+ "series_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"
+ },
+ {
+ "name": "index_episodes_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_episodes_provider_id_episode_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "episode_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "series",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "series_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "categories",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentId",
+ "columnName": "parent_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isUserProtected",
+ "columnName": "is_user_protected",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_categories_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_categories_provider_id_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"
+ },
+ {
+ "name": "index_categories_provider_id_category_id_type",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channel_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logoUrl",
+ "columnName": "logo_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "groupTitle",
+ "columnName": "group_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgChannelId",
+ "columnName": "epg_channel_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "number",
+ "columnName": "number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSupported",
+ "columnName": "catch_up_supported",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpDays",
+ "columnName": "catch_up_days",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catchUpSource",
+ "columnName": "catchUpSource",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "logicalGroupId",
+ "columnName": "logical_group_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "errorCount",
+ "columnName": "error_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "stream_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channel_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_channel_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "movie_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "durationSeconds",
+ "columnName": "duration_seconds",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "stream_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_movie_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_movie_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "series_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `provider_series_key` TEXT NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `provider_series_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerSeriesId",
+ "columnName": "provider_series_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "providerSeriesKey",
+ "columnName": "provider_series_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "backdropUrl",
+ "columnName": "backdrop_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "plot",
+ "columnName": "plot",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "cast",
+ "columnName": "cast",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "director",
+ "columnName": "director",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "releaseDate",
+ "columnName": "release_date",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "youtubeTrailer",
+ "columnName": "youtube_trailer",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "episodeRunTime",
+ "columnName": "episode_run_time",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "provider_series_key"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_series_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_series_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "category_import_stage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "sessionId",
+ "columnName": "session_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentId",
+ "columnName": "parent_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "session_id",
+ "provider_id",
+ "category_id",
+ "type"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_category_import_stage_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_category_import_stage_session_id_provider_id",
+ "unique": false,
+ "columnNames": [
+ "session_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"
+ },
+ {
+ "name": "index_category_import_stage_provider_id_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "programs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "description",
+ "columnName": "description",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "startTime",
+ "columnName": "start_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "endTime",
+ "columnName": "end_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lang",
+ "columnName": "lang",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "hasArchive",
+ "columnName": "has_archive",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_programs_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_programs_provider_id_channel_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"
+ },
+ {
+ "name": "index_programs_provider_id_end_time_channel_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "end_time",
+ "channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_end_time_channel_id` ON `${TABLE_NAME}` (`provider_id`, `end_time`, `channel_id`)"
+ },
+ {
+ "name": "index_programs_provider_id_start_time_end_time",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "start_time",
+ "end_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `start_time`, `end_time`)"
+ },
+ {
+ "name": "index_programs_start_time",
+ "unique": false,
+ "columnNames": [
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_start_time` ON `${TABLE_NAME}` (`start_time`)"
+ },
+ {
+ "name": "index_programs_provider_id_channel_id_start_time",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`)"
+ },
+ {
+ "name": "index_programs_provider_id_channel_id_start_time_end_time",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "start_time",
+ "end_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`, `end_time`)"
+ }
+ ]
+ },
+ {
+ "tableName": "favorites",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `group_key` INTEGER NOT NULL, `added_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`group_id`) REFERENCES `virtual_groups`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentId",
+ "columnName": "content_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "position",
+ "columnName": "position",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "groupId",
+ "columnName": "group_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "groupKey",
+ "columnName": "group_key",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_favorites_provider_id_content_id_content_type_group_key",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "content_id",
+ "content_type",
+ "group_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_provider_id_content_id_content_type_group_key` ON `${TABLE_NAME}` (`provider_id`, `content_id`, `content_type`, `group_key`)"
+ },
+ {
+ "name": "index_favorites_provider_id_content_type_group_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "group_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_provider_id_content_type_group_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `group_id`)"
+ },
+ {
+ "name": "index_favorites_group_id_position",
+ "unique": false,
+ "columnNames": [
+ "group_id",
+ "position"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_group_id_position` ON `${TABLE_NAME}` (`group_id`, `position`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "virtual_groups",
+ "onDelete": "SET NULL",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "group_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "virtual_groups",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconEmoji",
+ "columnName": "icon_emoji",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "position",
+ "columnName": "position",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_virtual_groups_provider_id_content_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"
+ },
+ {
+ "name": "index_virtual_groups_position",
+ "unique": false,
+ "columnNames": [
+ "position"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_position` ON `${TABLE_NAME}` (`position`)"
+ },
+ {
+ "name": "index_virtual_groups_content_type",
+ "unique": false,
+ "columnNames": [
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_content_type` ON `${TABLE_NAME}` (`content_type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "playback_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `poster_url` TEXT, `stream_url` TEXT NOT NULL, `resume_position_ms` INTEGER NOT NULL, `total_duration_ms` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `watched_status` TEXT NOT NULL, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentId",
+ "columnName": "content_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "resumePositionMs",
+ "columnName": "resume_position_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalDurationMs",
+ "columnName": "total_duration_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastWatchedAt",
+ "columnName": "last_watched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchCount",
+ "columnName": "watch_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "watchedStatus",
+ "columnName": "watched_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "seasonNumber",
+ "columnName": "season_number",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "episodeNumber",
+ "columnName": "episode_number",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playback_history_content_id_content_type_provider_id",
+ "unique": true,
+ "columnNames": [
+ "content_id",
+ "content_type",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_history_content_id_content_type_provider_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `provider_id`)"
+ },
+ {
+ "name": "index_playback_history_last_watched_at",
+ "unique": false,
+ "columnNames": [
+ "last_watched_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_last_watched_at` ON `${TABLE_NAME}` (`last_watched_at`)"
+ },
+ {
+ "name": "index_playback_history_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_playback_history_provider_id_content_type_content_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "content_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `content_id`)"
+ },
+ {
+ "name": "index_playback_history_provider_id_content_type_last_watched_at",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "last_watched_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_last_watched_at` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `last_watched_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "tmdb_identity",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tmdb_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `canonical_provider_id` INTEGER NOT NULL, `first_seen_at` INTEGER NOT NULL, PRIMARY KEY(`tmdb_id`, `content_type`), FOREIGN KEY(`canonical_provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "tmdbId",
+ "columnName": "tmdb_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "canonicalProviderId",
+ "columnName": "canonical_provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "firstSeenAt",
+ "columnName": "first_seen_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "tmdb_id",
+ "content_type"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_tmdb_identity_content_type",
+ "unique": false,
+ "columnNames": [
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_content_type` ON `${TABLE_NAME}` (`content_type`)"
+ },
+ {
+ "name": "index_tmdb_identity_canonical_provider_id",
+ "unique": false,
+ "columnNames": [
+ "canonical_provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_canonical_provider_id` ON `${TABLE_NAME}` (`canonical_provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "canonical_provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "search_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `content_scope` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `used_at` INTEGER NOT NULL, `use_count` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "query",
+ "columnName": "query",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentScope",
+ "columnName": "content_scope",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "usedAt",
+ "columnName": "used_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "useCount",
+ "columnName": "use_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_search_history_content_scope_provider_id_used_at",
+ "unique": false,
+ "columnNames": [
+ "content_scope",
+ "provider_id",
+ "used_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_content_scope_provider_id_used_at` ON `${TABLE_NAME}` (`content_scope`, `provider_id`, `used_at`)"
+ },
+ {
+ "name": "index_search_history_used_at",
+ "unique": false,
+ "columnNames": [
+ "used_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_used_at` ON `${TABLE_NAME}` (`used_at`)"
+ },
+ {
+ "name": "index_search_history_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_search_history_query_content_scope_provider_id",
+ "unique": true,
+ "columnNames": [
+ "query",
+ "content_scope",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_search_history_query_content_scope_provider_id` ON `${TABLE_NAME}` (`query`, `content_scope`, `provider_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "sync_metadata",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_live_success` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_series_success` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_epg_success` INTEGER NOT NULL, `last_movie_attempt` INTEGER NOT NULL, `last_movie_success` INTEGER NOT NULL, `last_movie_partial` INTEGER NOT NULL, `live_count` INTEGER NOT NULL, `movie_count` INTEGER NOT NULL, `series_count` INTEGER NOT NULL, `epg_count` INTEGER NOT NULL, `last_sync_status` TEXT NOT NULL, `movie_sync_mode` TEXT NOT NULL, `movie_warnings_count` INTEGER NOT NULL, `movie_catalog_stale` INTEGER NOT NULL, `live_avoid_full_until` INTEGER NOT NULL, `movie_avoid_full_until` INTEGER NOT NULL, `series_avoid_full_until` INTEGER NOT NULL, `live_sequential_failures_remembered` INTEGER NOT NULL, `live_healthy_sync_streak` INTEGER NOT NULL, `movie_parallel_failures_remembered` INTEGER NOT NULL, `movie_healthy_sync_streak` INTEGER NOT NULL, `series_sequential_failures_remembered` INTEGER NOT NULL, `series_healthy_sync_streak` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastLiveSync",
+ "columnName": "last_live_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastLiveSuccess",
+ "columnName": "last_live_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMovieSync",
+ "columnName": "last_movie_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSeriesSync",
+ "columnName": "last_series_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSeriesSuccess",
+ "columnName": "last_series_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastEpgSync",
+ "columnName": "last_epg_sync",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastEpgSuccess",
+ "columnName": "last_epg_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMovieAttempt",
+ "columnName": "last_movie_attempt",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMovieSuccess",
+ "columnName": "last_movie_success",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastMoviePartial",
+ "columnName": "last_movie_partial",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveCount",
+ "columnName": "live_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieCount",
+ "columnName": "movie_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesCount",
+ "columnName": "series_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgCount",
+ "columnName": "epg_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncStatus",
+ "columnName": "last_sync_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieSyncMode",
+ "columnName": "movie_sync_mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieWarningsCount",
+ "columnName": "movie_warnings_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieCatalogStale",
+ "columnName": "movie_catalog_stale",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveAvoidFullUntil",
+ "columnName": "live_avoid_full_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieAvoidFullUntil",
+ "columnName": "movie_avoid_full_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesAvoidFullUntil",
+ "columnName": "series_avoid_full_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveSequentialFailuresRemembered",
+ "columnName": "live_sequential_failures_remembered",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "liveHealthySyncStreak",
+ "columnName": "live_healthy_sync_streak",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieParallelFailuresRemembered",
+ "columnName": "movie_parallel_failures_remembered",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "movieHealthySyncStreak",
+ "columnName": "movie_healthy_sync_streak",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesSequentialFailuresRemembered",
+ "columnName": "series_sequential_failures_remembered",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesHealthySyncStreak",
+ "columnName": "series_healthy_sync_streak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "movie_category_hydration",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastHydratedAt",
+ "columnName": "last_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "itemCount",
+ "columnName": "item_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastStatus",
+ "columnName": "last_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastLoadedPage",
+ "columnName": "last_loaded_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastAttemptedPage",
+ "columnName": "last_attempted_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessfulPage",
+ "columnName": "last_successful_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPages",
+ "columnName": "total_pages",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isComplete",
+ "columnName": "is_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "pageSize",
+ "columnName": "page_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryAfterMs",
+ "columnName": "retry_after_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureCount",
+ "columnName": "failure_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryBudgetRemaining",
+ "columnName": "retry_budget_remaining",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPageFingerprint",
+ "columnName": "last_page_fingerprint",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_movie_category_hydration_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "series_category_hydration",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastHydratedAt",
+ "columnName": "last_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "itemCount",
+ "columnName": "item_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastStatus",
+ "columnName": "last_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastLoadedPage",
+ "columnName": "last_loaded_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastAttemptedPage",
+ "columnName": "last_attempted_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessfulPage",
+ "columnName": "last_successful_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPages",
+ "columnName": "total_pages",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isComplete",
+ "columnName": "is_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "pageSize",
+ "columnName": "page_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryAfterMs",
+ "columnName": "retry_after_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureCount",
+ "columnName": "failure_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryBudgetRemaining",
+ "columnName": "retry_budget_remaining",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPageFingerprint",
+ "columnName": "last_page_fingerprint",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_series_category_hydration_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_sources",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `etag` TEXT, `last_modified_header` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "url",
+ "columnName": "url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastRefreshAt",
+ "columnName": "last_refresh_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessAt",
+ "columnName": "last_success_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "etag",
+ "columnName": "etag",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastModifiedHeader",
+ "columnName": "last_modified_header",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_epg_sources_url",
+ "unique": true,
+ "columnNames": [
+ "url"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_sources_url` ON `${TABLE_NAME}` (`url`)"
+ }
+ ]
+ },
+ {
+ "tableName": "provider_epg_sources",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `epg_source_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_epg_sources_provider_id_epg_source_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_epg_sources_provider_id_epg_source_id` ON `${TABLE_NAME}` (`provider_id`, `epg_source_id`)"
+ },
+ {
+ "name": "index_provider_epg_sources_epg_source_id",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_epg_sources_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "epg_sources",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "epg_source_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `display_name` TEXT NOT NULL, `normalized_name` TEXT NOT NULL, `icon_url` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xmltvChannelId",
+ "columnName": "xmltv_channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "displayName",
+ "columnName": "display_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "normalizedName",
+ "columnName": "normalized_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconUrl",
+ "columnName": "icon_url",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_epg_channels_epg_source_id_xmltv_channel_id",
+ "unique": true,
+ "columnNames": [
+ "epg_source_id",
+ "xmltv_channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id_xmltv_channel_id` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`)"
+ },
+ {
+ "name": "index_epg_channels_epg_source_id",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"
+ },
+ {
+ "name": "index_epg_channels_normalized_name",
+ "unique": false,
+ "columnNames": [
+ "normalized_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_normalized_name` ON `${TABLE_NAME}` (`normalized_name`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "epg_sources",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "epg_source_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_programmes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `title` TEXT NOT NULL, `subtitle` TEXT, `description` TEXT NOT NULL, `category` TEXT, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `episode_info` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xmltvChannelId",
+ "columnName": "xmltv_channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "startTime",
+ "columnName": "start_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "endTime",
+ "columnName": "end_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "subtitle",
+ "columnName": "subtitle",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "description",
+ "columnName": "description",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lang",
+ "columnName": "lang",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "episodeInfo",
+ "columnName": "episode_info",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id",
+ "xmltv_channel_id",
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`)"
+ },
+ {
+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time",
+ "unique": true,
+ "columnNames": [
+ "epg_source_id",
+ "xmltv_channel_id",
+ "start_time",
+ "end_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`, `end_time`)"
+ },
+ {
+ "name": "index_epg_programmes_epg_source_id",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"
+ },
+ {
+ "name": "index_epg_programmes_start_time",
+ "unique": false,
+ "columnNames": [
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_start_time` ON `${TABLE_NAME}` (`start_time`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "epg_sources",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "epg_source_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channel_epg_mappings",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_channel_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `source_type` TEXT NOT NULL, `epg_source_id` INTEGER, `xmltv_channel_id` TEXT, `match_type` TEXT, `confidence` REAL NOT NULL, `matched_at` INTEGER NOT NULL, `failed_attempts` INTEGER NOT NULL, `source` TEXT, `is_manual_override` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerChannelId",
+ "columnName": "provider_channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "xmltvChannelId",
+ "columnName": "xmltv_channel_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "matchType",
+ "columnName": "match_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "confidence",
+ "columnName": "confidence",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "matchedAt",
+ "columnName": "matched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failedAttempts",
+ "columnName": "failed_attempts",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "isManualOverride",
+ "columnName": "is_manual_override",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channel_epg_mappings_provider_id_provider_channel_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "provider_channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id_provider_channel_id` ON `${TABLE_NAME}` (`provider_id`, `provider_channel_id`)"
+ },
+ {
+ "name": "index_channel_epg_mappings_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "combined_m3u_profiles",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "combined_m3u_profile_members",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `profile_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`profile_id`) REFERENCES `combined_m3u_profiles`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileId",
+ "columnName": "profile_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_combined_m3u_profile_members_profile_id",
+ "unique": false,
+ "columnNames": [
+ "profile_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id` ON `${TABLE_NAME}` (`profile_id`)"
+ },
+ {
+ "name": "index_combined_m3u_profile_members_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_combined_m3u_profile_members_profile_id_provider_id",
+ "unique": true,
+ "columnNames": [
+ "profile_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id_provider_id` ON `${TABLE_NAME}` (`profile_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "combined_m3u_profiles",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "profile_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "recording_schedules",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `requested_start_ms` INTEGER NOT NULL, `requested_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `enabled` INTEGER NOT NULL, `is_manual` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelName",
+ "columnName": "channel_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programTitle",
+ "columnName": "program_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "requestedStartMs",
+ "columnName": "requested_start_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "requestedEndMs",
+ "columnName": "requested_end_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurrence",
+ "columnName": "recurrence",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurringRuleId",
+ "columnName": "recurring_rule_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isManual",
+ "columnName": "is_manual",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_recording_schedules_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_recording_schedules_enabled_requested_start_ms",
+ "unique": false,
+ "columnNames": [
+ "enabled",
+ "requested_start_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_enabled_requested_start_ms` ON `${TABLE_NAME}` (`enabled`, `requested_start_ms`)"
+ },
+ {
+ "name": "index_recording_schedules_recurring_rule_id",
+ "unique": false,
+ "columnNames": [
+ "recurring_rule_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_recurring_rule_id` ON `${TABLE_NAME}` (`recurring_rule_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "recording_runs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `schedule_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `scheduled_start_ms` INTEGER NOT NULL, `scheduled_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `status` TEXT NOT NULL, `source_type` TEXT NOT NULL, `resolved_url` TEXT, `headers_json` TEXT NOT NULL, `user_agent` TEXT, `expiration_time` INTEGER, `provider_label` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `bytes_written` INTEGER NOT NULL, `average_throughput_bps` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `last_progress_at_ms` INTEGER, `failure_category` TEXT NOT NULL, `failure_reason` TEXT, `terminal_at_ms` INTEGER, `started_at_ms` INTEGER, `ended_at_ms` INTEGER, `schedule_enabled` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `alarm_start_at_ms` INTEGER, `alarm_stop_at_ms` INTEGER, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`schedule_id`) REFERENCES `recording_schedules`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "scheduleId",
+ "columnName": "schedule_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelName",
+ "columnName": "channel_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programTitle",
+ "columnName": "program_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "scheduledStartMs",
+ "columnName": "scheduled_start_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "scheduledEndMs",
+ "columnName": "scheduled_end_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurrence",
+ "columnName": "recurrence",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurringRuleId",
+ "columnName": "recurring_rule_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "resolvedUrl",
+ "columnName": "resolved_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "headersJson",
+ "columnName": "headers_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "userAgent",
+ "columnName": "user_agent",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "expirationTime",
+ "columnName": "expiration_time",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "providerLabel",
+ "columnName": "provider_label",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "outputUri",
+ "columnName": "output_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "outputDisplayPath",
+ "columnName": "output_display_path",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bytesWritten",
+ "columnName": "bytes_written",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "averageThroughputBytesPerSecond",
+ "columnName": "average_throughput_bps",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryCount",
+ "columnName": "retry_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastProgressAtMs",
+ "columnName": "last_progress_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "failureCategory",
+ "columnName": "failure_category",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureReason",
+ "columnName": "failure_reason",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "terminalAtMs",
+ "columnName": "terminal_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "startedAtMs",
+ "columnName": "started_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "endedAtMs",
+ "columnName": "ended_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "scheduleEnabled",
+ "columnName": "schedule_enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "alarmStartAtMs",
+ "columnName": "alarm_start_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "alarmStopAtMs",
+ "columnName": "alarm_stop_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_recording_runs_schedule_id",
+ "unique": false,
+ "columnNames": [
+ "schedule_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_schedule_id` ON `${TABLE_NAME}` (`schedule_id`)"
+ },
+ {
+ "name": "index_recording_runs_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_recording_runs_status_scheduled_start_ms",
+ "unique": false,
+ "columnNames": [
+ "status",
+ "scheduled_start_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_status_scheduled_start_ms` ON `${TABLE_NAME}` (`status`, `scheduled_start_ms`)"
+ },
+ {
+ "name": "index_recording_runs_alarm_start_at_ms",
+ "unique": false,
+ "columnNames": [
+ "alarm_start_at_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_start_at_ms` ON `${TABLE_NAME}` (`alarm_start_at_ms`)"
+ },
+ {
+ "name": "index_recording_runs_alarm_stop_at_ms",
+ "unique": false,
+ "columnNames": [
+ "alarm_stop_at_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_stop_at_ms` ON `${TABLE_NAME}` (`alarm_stop_at_ms`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "recording_schedules",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "schedule_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "program_reminders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `channel_name` TEXT NOT NULL, `program_title` TEXT NOT NULL, `program_start_time` INTEGER NOT NULL, `remind_at` INTEGER NOT NULL, `lead_time_minutes` INTEGER NOT NULL, `is_dismissed` INTEGER NOT NULL, `notified_at` INTEGER, `created_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelName",
+ "columnName": "channel_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programTitle",
+ "columnName": "program_title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programStartTime",
+ "columnName": "program_start_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remindAt",
+ "columnName": "remind_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "leadTimeMinutes",
+ "columnName": "lead_time_minutes",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isDismissed",
+ "columnName": "is_dismissed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "notifiedAt",
+ "columnName": "notified_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_program_reminders_provider_id_remind_at",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "remind_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_remind_at` ON `${TABLE_NAME}` (`provider_id`, `remind_at`)"
+ },
+ {
+ "name": "index_program_reminders_is_dismissed_notified_at_remind_at",
+ "unique": false,
+ "columnNames": [
+ "is_dismissed",
+ "notified_at",
+ "remind_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_is_dismissed_notified_at_remind_at` ON `${TABLE_NAME}` (`is_dismissed`, `notified_at`, `remind_at`)"
+ },
+ {
+ "name": "index_program_reminders_provider_id_channel_id_program_start_time",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "program_start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_start_time`)"
+ },
+ {
+ "name": "index_program_reminders_provider_id_channel_id_program_title_program_start_time",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "program_title",
+ "program_start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_title_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_title`, `program_start_time`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "recording_storage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tree_uri` TEXT, `display_name` TEXT, `output_directory` TEXT, `available_bytes` INTEGER, `is_writable` INTEGER NOT NULL, `file_name_pattern` TEXT NOT NULL, `retention_days` INTEGER, `max_simultaneous_recordings` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "treeUri",
+ "columnName": "tree_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "displayName",
+ "columnName": "display_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "outputDirectory",
+ "columnName": "output_directory",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "availableBytes",
+ "columnName": "available_bytes",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "isWritable",
+ "columnName": "is_writable",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fileNamePattern",
+ "columnName": "file_name_pattern",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retentionDays",
+ "columnName": "retention_days",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "maxSimultaneousRecordings",
+ "columnName": "max_simultaneous_recordings",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "playback_compatibility_records",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `device_fingerprint` TEXT NOT NULL, `device_model` TEXT NOT NULL, `android_sdk` INTEGER NOT NULL, `stream_type` TEXT NOT NULL, `video_mime_type` TEXT NOT NULL, `resolution_bucket` TEXT NOT NULL, `decoder_name` TEXT NOT NULL, `surface_type` TEXT NOT NULL, `failure_type` TEXT NOT NULL, `last_failed_at` INTEGER NOT NULL, `last_succeeded_at` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `success_count` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deviceFingerprint",
+ "columnName": "device_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deviceModel",
+ "columnName": "device_model",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "androidSdk",
+ "columnName": "android_sdk",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamType",
+ "columnName": "stream_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "videoMimeType",
+ "columnName": "video_mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "resolutionBucket",
+ "columnName": "resolution_bucket",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "decoderName",
+ "columnName": "decoder_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "surfaceType",
+ "columnName": "surface_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureType",
+ "columnName": "failure_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastFailedAt",
+ "columnName": "last_failed_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSucceededAt",
+ "columnName": "last_succeeded_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureCount",
+ "columnName": "failure_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "successCount",
+ "columnName": "success_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type",
+ "unique": true,
+ "columnNames": [
+ "device_fingerprint",
+ "stream_type",
+ "video_mime_type",
+ "resolution_bucket",
+ "decoder_name",
+ "surface_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`, `decoder_name`, `surface_type`)"
+ },
+ {
+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket",
+ "unique": false,
+ "columnNames": [
+ "device_fingerprint",
+ "stream_type",
+ "video_mime_type",
+ "resolution_bucket"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`)"
+ },
+ {
+ "name": "index_playback_compatibility_records_last_failed_at",
+ "unique": false,
+ "columnNames": [
+ "last_failed_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_failed_at` ON `${TABLE_NAME}` (`last_failed_at`)"
+ },
+ {
+ "name": "index_playback_compatibility_records_last_succeeded_at",
+ "unique": false,
+ "columnNames": [
+ "last_succeeded_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_succeeded_at` ON `${TABLE_NAME}` (`last_succeeded_at`)"
+ }
+ ]
+ },
+ {
+ "tableName": "xtream_content_index",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `remote_id` TEXT NOT NULL, `local_content_id` INTEGER, `name` TEXT NOT NULL, `category_id` INTEGER, `category_name` TEXT, `image_url` TEXT, `container_extension` TEXT, `rating` REAL NOT NULL, `added_at` INTEGER NOT NULL, `remote_updated_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `indexed_at` INTEGER NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `stale_state` TEXT NOT NULL, `error_state` TEXT, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `remote_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remoteId",
+ "columnName": "remote_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "localContentId",
+ "columnName": "local_content_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoryId",
+ "columnName": "category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "addedAt",
+ "columnName": "added_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remoteUpdatedAt",
+ "columnName": "remote_updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAdult",
+ "columnName": "is_adult",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "indexedAt",
+ "columnName": "indexed_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "detailHydratedAt",
+ "columnName": "detail_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "staleState",
+ "columnName": "stale_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "errorState",
+ "columnName": "error_state",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncFingerprint",
+ "columnName": "sync_fingerprint",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "remote_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_xtream_content_index_provider_id_content_type",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"
+ },
+ {
+ "name": "index_xtream_content_index_provider_id_content_type_category_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "category_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_category_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `category_id`)"
+ },
+ {
+ "name": "index_xtream_content_index_provider_id_content_type_name",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_name` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `name`)"
+ },
+ {
+ "name": "index_xtream_content_index_provider_id_content_type_local_content_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "local_content_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_local_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `local_content_id`)"
+ },
+ {
+ "name": "index_xtream_content_index_provider_id_indexed_at",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "indexed_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_indexed_at` ON `${TABLE_NAME}` (`provider_id`, `indexed_at`)"
+ },
+ {
+ "name": "index_xtream_content_index_stale_state",
+ "unique": false,
+ "columnNames": [
+ "stale_state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_stale_state` ON `${TABLE_NAME}` (`stale_state`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "xtream_index_jobs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `section` TEXT NOT NULL, `state` TEXT NOT NULL, `total_categories` INTEGER NOT NULL, `completed_categories` INTEGER NOT NULL, `next_category_index` INTEGER NOT NULL, `failed_categories` INTEGER NOT NULL, `indexed_rows` INTEGER NOT NULL, `skipped_malformed_rows` INTEGER NOT NULL, `deleted_pruned_rows` INTEGER NOT NULL, `priority_category_id` INTEGER, `priority_requested_at` INTEGER NOT NULL, `last_error` TEXT, `last_attempt_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `section`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "section",
+ "columnName": "section",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalCategories",
+ "columnName": "total_categories",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "completedCategories",
+ "columnName": "completed_categories",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "nextCategoryIndex",
+ "columnName": "next_category_index",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failedCategories",
+ "columnName": "failed_categories",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "indexedRows",
+ "columnName": "indexed_rows",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "skippedMalformedRows",
+ "columnName": "skipped_malformed_rows",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deletedPrunedRows",
+ "columnName": "deleted_pruned_rows",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priorityCategoryId",
+ "columnName": "priority_category_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "priorityRequestedAt",
+ "columnName": "priority_requested_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastAttemptAt",
+ "columnName": "last_attempt_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessAt",
+ "columnName": "last_success_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "section"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_xtream_index_jobs_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_xtream_index_jobs_section",
+ "unique": false,
+ "columnNames": [
+ "section"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_section` ON `${TABLE_NAME}` (`section`)"
+ },
+ {
+ "name": "index_xtream_index_jobs_state",
+ "unique": false,
+ "columnNames": [
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_state` ON `${TABLE_NAME}` (`state`)"
+ },
+ {
+ "name": "index_xtream_index_jobs_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "xtream_live_onboarding_state",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `provider_type` TEXT NOT NULL, `content_type` TEXT NOT NULL, `phase` TEXT NOT NULL, `staged_session_id` INTEGER, `import_strategy` TEXT, `next_category_index` INTEGER NOT NULL, `accepted_row_count` INTEGER NOT NULL, `staged_flush_count` INTEGER NOT NULL, `sync_profile_tier` TEXT, `sync_profile_batch_size` INTEGER NOT NULL, `sync_profile_strategy` TEXT, `sync_profile_low_memory` INTEGER NOT NULL, `sync_profile_memory_class_mb` INTEGER NOT NULL, `sync_profile_available_mem_mb` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerType",
+ "columnName": "provider_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "phase",
+ "columnName": "phase",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stagedSessionId",
+ "columnName": "staged_session_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "importStrategy",
+ "columnName": "import_strategy",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "nextCategoryIndex",
+ "columnName": "next_category_index",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "acceptedRowCount",
+ "columnName": "accepted_row_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stagedFlushCount",
+ "columnName": "staged_flush_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileTier",
+ "columnName": "sync_profile_tier",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncProfileBatchSize",
+ "columnName": "sync_profile_batch_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileStrategy",
+ "columnName": "sync_profile_strategy",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncProfileLowMemory",
+ "columnName": "sync_profile_low_memory",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileMemoryClassMb",
+ "columnName": "sync_profile_memory_class_mb",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileAvailableMemMb",
+ "columnName": "sync_profile_available_mem_mb",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "completedAt",
+ "columnName": "completed_at",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_xtream_live_onboarding_state_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_xtream_live_onboarding_state_phase",
+ "unique": false,
+ "columnNames": [
+ "phase"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_phase` ON `${TABLE_NAME}` (`phase`)"
+ },
+ {
+ "name": "index_xtream_live_onboarding_state_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ },
+ {
+ "name": "index_xtream_live_onboarding_state_staged_session_id",
+ "unique": false,
+ "columnNames": [
+ "staged_session_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_staged_session_id` ON `${TABLE_NAME}` (`staged_session_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ }
+ ],
+ "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, 'feb751bea12eb7d3f6c0960db057a565')"
+ ]
+ }
+}
\ 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 11c2e38a..2bc7bcf9 100644
--- a/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt
+++ b/data/src/androidTest/java/com/streamvault/data/local/StreamVaultDatabaseMigrationTest.kt
@@ -268,6 +268,34 @@ class StreamVaultDatabaseMigrationTest {
migratedDb.close()
}
+ @Test
+ fun migrate52To53_addsStalkerHardeningHydrationColumns() {
+ migrationTestHelper.createDatabase("streamvault-52-53-test", 52).close()
+
+ val migratedDb = migrationTestHelper.runMigrationsAndValidate(
+ "streamvault-52-53-test",
+ 53,
+ true,
+ StreamVaultDatabase.MIGRATION_52_53
+ )
+
+ val movieTable = "movie_category_hydration"
+ val seriesTable = "series_category_hydration"
+ listOf(
+ "last_attempted_page",
+ "last_successful_page",
+ "retry_after_ms",
+ "failure_count",
+ "retry_budget_remaining",
+ "last_page_fingerprint"
+ ).forEach { column ->
+ assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('$movieTable') WHERE name = '$column'"))
+ assertEquals(1, countRows(migratedDb, "SELECT COUNT(*) FROM pragma_table_info('$seriesTable') WHERE name = '$column'"))
+ }
+
+ migratedDb.close()
+ }
+
@Test
fun migrate40To41_addsAudioVideoOffsetColumn() {
migrationTestHelper.createDatabase("streamvault-40-41-test", 40).close()
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 c558ecc8..dd7d716c 100644
--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
@@ -49,7 +49,7 @@ import com.streamvault.data.local.entity.*
XtreamIndexJobEntity::class,
XtreamLiveOnboardingStateEntity::class
],
- version = 52,
+ version = 53,
exportSchema = true // ← was false; schema JSON now tracked in version control
)
@TypeConverters(RoomEnumConverters::class)
@@ -2577,5 +2577,23 @@ abstract class StreamVaultDatabase : RoomDatabase() {
validateForeignKeys(database, "providers")
}
}
+
+ val MIGRATION_52_53 = object : Migration(52, 53) {
+ override fun migrate(database: SupportSQLiteDatabase) {
+ addStalkerHardeningColumns(database, "movie_category_hydration")
+ addStalkerHardeningColumns(database, "series_category_hydration")
+ validateForeignKeys(database, "movie_category_hydration")
+ validateForeignKeys(database, "series_category_hydration")
+ }
+ }
+
+ private fun addStalkerHardeningColumns(database: SupportSQLiteDatabase, tableName: String) {
+ database.execSQL("ALTER TABLE $tableName ADD COLUMN last_attempted_page INTEGER NOT NULL DEFAULT 0")
+ database.execSQL("ALTER TABLE $tableName ADD COLUMN last_successful_page INTEGER NOT NULL DEFAULT 0")
+ database.execSQL("ALTER TABLE $tableName ADD COLUMN retry_after_ms INTEGER NOT NULL DEFAULT 0")
+ database.execSQL("ALTER TABLE $tableName ADD COLUMN failure_count INTEGER NOT NULL DEFAULT 0")
+ database.execSQL("ALTER TABLE $tableName ADD COLUMN retry_budget_remaining INTEGER NOT NULL DEFAULT 3")
+ database.execSQL("ALTER TABLE $tableName ADD COLUMN last_page_fingerprint TEXT")
+ }
}
}
diff --git a/data/src/main/java/com/streamvault/data/local/dao/XtreamIndexDaos.kt b/data/src/main/java/com/streamvault/data/local/dao/XtreamIndexDaos.kt
index a563f2ed..aca25924 100644
--- a/data/src/main/java/com/streamvault/data/local/dao/XtreamIndexDaos.kt
+++ b/data/src/main/java/com/streamvault/data/local/dao/XtreamIndexDaos.kt
@@ -92,12 +92,55 @@ abstract class XtreamContentIndexDao {
)
abstract suspend fun markVodAndSeriesRowsStaleForRebuild(providerId: Long): Int
+ @Query(
+ """
+ UPDATE xtream_content_index
+ SET stale_state = 'STALE_REMOTE',
+ error_state = NULL
+ WHERE provider_id = :providerId
+ AND content_type = :contentType
+ """
+ )
+ abstract suspend fun markRowsStaleForProviderAndType(providerId: Long, contentType: String): Int
+
@Query("DELETE FROM xtream_content_index WHERE provider_id = :providerId")
abstract suspend fun deleteByProvider(providerId: Long): Int
@Query("DELETE FROM xtream_content_index WHERE provider_id = :providerId AND content_type = :contentType")
abstract suspend fun deleteByProviderAndType(providerId: Long, contentType: String): Int
+ @Query(
+ """
+ DELETE FROM movies
+ WHERE provider_id = :providerId
+ AND EXISTS (
+ SELECT 1
+ FROM xtream_content_index
+ WHERE xtream_content_index.provider_id = movies.provider_id
+ AND xtream_content_index.content_type = 'MOVIE'
+ AND xtream_content_index.stale_state = 'STALE_REMOTE'
+ AND xtream_content_index.remote_id = CAST(movies.stream_id AS TEXT)
+ )
+ """
+ )
+ protected abstract suspend fun pruneStaleMovieRows(providerId: Long): Int
+
+ @Query(
+ """
+ DELETE FROM series
+ WHERE provider_id = :providerId
+ AND EXISTS (
+ SELECT 1
+ FROM xtream_content_index
+ WHERE xtream_content_index.provider_id = series.provider_id
+ AND xtream_content_index.content_type = 'SERIES'
+ AND xtream_content_index.stale_state = 'STALE_REMOTE'
+ AND xtream_content_index.remote_id = COALESCE(NULLIF(series.provider_series_id, ''), CAST(series.series_id AS TEXT))
+ )
+ """
+ )
+ protected abstract suspend fun pruneStaleSeriesRows(providerId: Long): Int
+
@Query(
"""
DELETE FROM xtream_content_index
@@ -146,6 +189,17 @@ abstract class XtreamContentIndexDao {
@Transaction
open suspend fun pruneOrphanLocalContentRows(): Int =
pruneOrphanLiveRows() + pruneOrphanMovieRows() + pruneOrphanSeriesRows()
+
+ @Transaction
+ open suspend fun pruneStaleLocalContentRows(providerId: Long, contentType: String): Int {
+ val deleted = when (contentType) {
+ "MOVIE" -> pruneStaleMovieRows(providerId)
+ "SERIES" -> pruneStaleSeriesRows(providerId)
+ else -> 0
+ }
+ deleteByProviderAndType(providerId, contentType)
+ return deleted
+ }
}
@Dao
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 8cfdcadb..c2ba55cc 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
@@ -829,9 +829,15 @@ data class MovieCategoryHydrationEntity(
@ColumnInfo(name = "last_status") val lastStatus: String = "IDLE",
@ColumnInfo(name = "last_error") val lastError: String? = null,
@ColumnInfo(name = "last_loaded_page") val lastLoadedPage: Int = 0,
+ @ColumnInfo(name = "last_attempted_page") val lastAttemptedPage: Int = 0,
+ @ColumnInfo(name = "last_successful_page") val lastSuccessfulPage: Int = 0,
@ColumnInfo(name = "total_pages") val totalPages: Int = 0,
@ColumnInfo(name = "is_complete") val isComplete: Boolean = false,
- @ColumnInfo(name = "page_size") val pageSize: Int = 0
+ @ColumnInfo(name = "page_size") val pageSize: Int = 0,
+ @ColumnInfo(name = "retry_after_ms") val retryAfterMs: Long = 0L,
+ @ColumnInfo(name = "failure_count") val failureCount: Int = 0,
+ @ColumnInfo(name = "retry_budget_remaining") val retryBudgetRemaining: Int = 3,
+ @ColumnInfo(name = "last_page_fingerprint") val lastPageFingerprint: String? = null
)
@Entity(
@@ -853,9 +859,15 @@ data class SeriesCategoryHydrationEntity(
@ColumnInfo(name = "last_status") val lastStatus: String = "IDLE",
@ColumnInfo(name = "last_error") val lastError: String? = null,
@ColumnInfo(name = "last_loaded_page") val lastLoadedPage: Int = 0,
+ @ColumnInfo(name = "last_attempted_page") val lastAttemptedPage: Int = 0,
+ @ColumnInfo(name = "last_successful_page") val lastSuccessfulPage: Int = 0,
@ColumnInfo(name = "total_pages") val totalPages: Int = 0,
@ColumnInfo(name = "is_complete") val isComplete: Boolean = false,
- @ColumnInfo(name = "page_size") val pageSize: Int = 0
+ @ColumnInfo(name = "page_size") val pageSize: Int = 0,
+ @ColumnInfo(name = "retry_after_ms") val retryAfterMs: Long = 0L,
+ @ColumnInfo(name = "failure_count") val failureCount: Int = 0,
+ @ColumnInfo(name = "retry_budget_remaining") val retryBudgetRemaining: Int = 3,
+ @ColumnInfo(name = "last_page_fingerprint") val lastPageFingerprint: String? = null
)
// ── External EPG Source ────────────────────────────────────────────
diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt
index cc0bbd7c..8c59cf1d 100644
--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt
+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt
@@ -58,6 +58,14 @@ class StalkerProvider(
private var accountProfileCache: StalkerProviderProfile? = null
private val categoryCache = mutableMapOf<ContentType, List<CategorySeed>>()
+ suspend fun invalidateAuthentication() {
+ authMutex.withLock {
+ sessionCache = null
+ accountProfileCache = null
+ categoryCache.clear()
+ }
+ }
+
override suspend fun authenticate(): Result<Provider> {
return when (val authResult = ensureAuthenticated()) {
is Result.Success -> {
diff --git a/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt
index 409887c6..41bd09be 100644
--- a/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt
+++ b/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt
@@ -10,6 +10,7 @@ import com.streamvault.data.local.dao.MovieDao
import com.streamvault.data.local.dao.PlaybackHistoryDao
import com.streamvault.data.local.dao.ProviderDao
import com.streamvault.data.local.dao.XtreamContentIndexDao
+import com.streamvault.data.local.dao.XtreamIndexJobDao
import com.streamvault.data.local.entity.ProviderEntity
import com.streamvault.data.local.entity.CategoryEntity
import com.streamvault.data.local.entity.MovieBrowseEntity
@@ -83,6 +84,7 @@ class MovieRepositoryImpl @Inject constructor(
private val movieCategoryHydrationDao: MovieCategoryHydrationDao,
private val syncMetadataRepository: SyncMetadataRepository,
private val xtreamContentIndexDao: XtreamContentIndexDao,
+ private val xtreamIndexJobDao: XtreamIndexJobDao,
private val syncManager: SyncManager,
private val transactionRunner: DatabaseTransactionRunner
) : MovieRepository {
@@ -1233,6 +1235,9 @@ class MovieRepositoryImpl @Inject constructor(
return
}
if (provider.type == ProviderType.STALKER_PORTAL) {
+ if (!shouldUseStalkerLazyFallback(providerId, hydration, localCount)) {
+ return
+ }
hydrateStalkerMovieCategoryToCount(
providerId = providerId,
categoryId = categoryId,
@@ -1268,6 +1273,9 @@ class MovieRepositoryImpl @Inject constructor(
val localCount = movieDao.getCountByCategory(providerId, categoryId).first()
val hydration = movieCategoryHydrationDao.get(providerId, categoryId)
if (provider.type == ProviderType.STALKER_PORTAL) {
+ if (!shouldUseStalkerLazyFallback(providerId, hydration, localCount)) {
+ return@launch
+ }
hydrateStalkerMovieCategoryToCount(
providerId = providerId,
categoryId = categoryId,
@@ -1285,6 +1293,22 @@ class MovieRepositoryImpl @Inject constructor(
}
}
+ private suspend fun shouldUseStalkerLazyFallback(
+ providerId: Long,
+ hydration: MovieCategoryHydrationEntity?,
+ localCount: Int
+ ): Boolean {
+ val now = System.currentTimeMillis()
+ if (localCount > 0) return false
+ if (hydration?.isComplete == true) return false
+ if (hydration?.lastStatus in setOf("FAILED_PERMANENT", "FAILED_BUDGET_EXHAUSTED")) return true
+ if (hydration?.retryBudgetRemaining == 0 && hydration.retryAfterMs <= now) return true
+ return when (xtreamIndexJobDao.get(providerId, ContentType.MOVIE.name)?.state) {
+ null, "FAILED_PERMANENT" -> true
+ else -> false
+ }
+ }
+
private suspend fun hydrateStalkerMovieCategoryToCount(
providerId: Long,
categoryId: Long,
@@ -1305,13 +1329,17 @@ class MovieRepositoryImpl @Inject constructor(
if (currentCount == 0 && currentHydration?.isEmptyRetryCoolingDown() == true) return
val isPreviewLoad = requiredCount <= STALKER_PREVIEW_REQUIRED_COUNT_THRESHOLD
- var nextPage = ((currentHydration?.lastLoadedPage ?: 0) + 1).coerceAtLeast(1)
+ var nextPage = when (currentHydration?.lastStatus) {
+ "FAILED_RETRYABLE", "COOLDOWN", "ANOMALY" -> currentHydration?.lastAttemptedPage?.coerceAtLeast(1) ?: 1
+ else -> ((currentHydration?.lastSuccessfulPage ?: currentHydration?.lastLoadedPage ?: 0) + 1).coerceAtLeast(1)
+ }
// The cached totalPages can under-report when the preview hydrate stored
// it from a partial response. Skip the pre-fetch guard on the first
// iteration so we always perform at least one real fetch that refreshes
// totalPages; subsequent iterations use the in-loop updated value.
var firstIteration = true
while (currentCount < requiredCount) {
+ val attemptStartedAt = System.currentTimeMillis()
if (isPreviewLoad && nextPage > STALKER_PREVIEW_MAX_REMOTE_PAGES) break
val totalPages = currentHydration?.totalPages ?: 0
if (!firstIteration && totalPages > 0 && nextPage > totalPages) break
@@ -1327,14 +1355,20 @@ class MovieRepositoryImpl @Inject constructor(
currentHydration = MovieCategoryHydrationEntity(
providerId = providerId,
categoryId = categoryId,
- lastHydratedAt = System.currentTimeMillis(),
+ lastHydratedAt = attemptStartedAt,
itemCount = updatedCount,
lastStatus = "SUCCESS",
lastError = null,
lastLoadedPage = result.data.page,
+ lastAttemptedPage = result.data.page,
+ lastSuccessfulPage = result.data.page,
totalPages = result.data.totalPages,
isComplete = pageComplete,
- pageSize = result.data.pageSize
+ pageSize = result.data.pageSize,
+ retryAfterMs = 0L,
+ failureCount = 0,
+ retryBudgetRemaining = 3,
+ lastPageFingerprint = null
)
movieCategoryHydrationDao.upsert(currentHydration!!)
}
@@ -1342,18 +1376,34 @@ class MovieRepositoryImpl @Inject constructor(
nextPage = result.data.page + 1
}
is Result.Error -> {
+ val priorFailureCount = currentHydration?.failureCount ?: 0
+ val remainingBudget = ((currentHydration?.retryBudgetRemaining ?: 3) - 1).coerceAtLeast(0)
+ val nextStatus = when {
+ remainingBudget <= 0 -> "FAILED_BUDGET_EXHAUSTED"
+ else -> "FAILED_RETRYABLE"
+ }
movieCategoryHydrationDao.upsert(
MovieCategoryHydrationEntity(
providerId = providerId,
categoryId = categoryId,
lastHydratedAt = currentHydration?.lastHydratedAt ?: 0L,
itemCount = currentCount,
- lastStatus = "ERROR",
+ lastStatus = nextStatus,
lastError = result.message,
lastLoadedPage = currentHydration?.lastLoadedPage ?: 0,
+ lastAttemptedPage = nextPage,
+ lastSuccessfulPage = currentHydration?.lastSuccessfulPage ?: currentHydration?.lastLoadedPage ?: 0,
totalPages = currentHydration?.totalPages ?: 0,
isComplete = currentHydration?.isComplete ?: false,
- pageSize = currentHydration?.pageSize ?: 0
+ pageSize = currentHydration?.pageSize ?: 0,
+ retryAfterMs = if (nextStatus == "FAILED_RETRYABLE") {
+ attemptStartedAt + XTREAM_EMPTY_CATEGORY_RETRY_COOLDOWN_MILLIS * (priorFailureCount + 1)
+ } else {
+ 0L
+ },
+ failureCount = priorFailureCount + 1,
+ retryBudgetRemaining = remainingBudget,
+ lastPageFingerprint = currentHydration?.lastPageFingerprint
)
)
break
diff --git a/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt
index d27dabf6..9e71b03d 100644
--- a/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt
+++ b/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt
@@ -59,6 +59,7 @@ class SeriesRepositoryImpl @Inject constructor(
private val preferencesRepository: PreferencesRepository,
private val xtreamStreamUrlResolver: XtreamStreamUrlResolver,
private val xtreamContentIndexDao: XtreamContentIndexDao,
+ private val xtreamIndexJobDao: XtreamIndexJobDao,
private val syncManager: SyncManager,
private val seriesCategoryHydrationDao: SeriesCategoryHydrationDao
) : SeriesRepository {
@@ -1204,6 +1205,9 @@ class SeriesRepositoryImpl @Inject constructor(
return
}
if (provider.type == ProviderType.STALKER_PORTAL) {
+ if (!shouldUseStalkerLazyFallback(providerId, hydration, localCount)) {
+ return
+ }
hydrateStalkerSeriesCategoryToCount(
providerId = providerId,
categoryId = categoryId,
@@ -1235,6 +1239,9 @@ class SeriesRepositoryImpl @Inject constructor(
val hydration = seriesCategoryHydrationDao.get(providerId, categoryId)
if (localCount == 0 && hydration?.isEmptyRetryCoolingDown() == true) return@launch
if (provider.type == ProviderType.STALKER_PORTAL) {
+ if (!shouldUseStalkerLazyFallback(providerId, hydration, localCount)) {
+ return@launch
+ }
hydrateStalkerSeriesCategoryToCount(
providerId = providerId,
categoryId = categoryId,
@@ -1251,6 +1258,22 @@ class SeriesRepositoryImpl @Inject constructor(
}
}
+ private suspend fun shouldUseStalkerLazyFallback(
+ providerId: Long,
+ hydration: SeriesCategoryHydrationEntity?,
+ localCount: Int
+ ): Boolean {
+ val now = System.currentTimeMillis()
+ if (localCount > 0) return false
+ if (hydration?.isComplete == true) return false
+ if (hydration?.lastStatus in setOf("FAILED_PERMANENT", "FAILED_BUDGET_EXHAUSTED")) return true
+ if (hydration?.retryBudgetRemaining == 0 && hydration.retryAfterMs <= now) return true
+ return when (xtreamIndexJobDao.get(providerId, ContentType.SERIES.name)?.state) {
+ null, "FAILED_PERMANENT" -> true
+ else -> false
+ }
+ }
+
private suspend fun hydrateStalkerSeriesCategoryToCount(
providerId: Long,
categoryId: Long,
@@ -1271,13 +1294,17 @@ class SeriesRepositoryImpl @Inject constructor(
if (currentCount == 0 && currentHydration?.isEmptyRetryCoolingDown() == true) return
val isPreviewLoad = requiredCount <= STALKER_PREVIEW_REQUIRED_COUNT_THRESHOLD
- var nextPage = ((currentHydration?.lastLoadedPage ?: 0) + 1).coerceAtLeast(1)
+ var nextPage = when (currentHydration?.lastStatus) {
+ "FAILED_RETRYABLE", "COOLDOWN", "ANOMALY" -> currentHydration?.lastAttemptedPage?.coerceAtLeast(1) ?: 1
+ else -> ((currentHydration?.lastSuccessfulPage ?: currentHydration?.lastLoadedPage ?: 0) + 1).coerceAtLeast(1)
+ }
// The cached totalPages can under-report when the preview hydrate stored
// it from a partial response. Skip the pre-fetch guard on the first
// iteration so we always perform at least one real fetch that refreshes
// totalPages; subsequent iterations use the in-loop updated value.
var firstIteration = true
while (currentCount < requiredCount) {
+ val attemptStartedAt = System.currentTimeMillis()
if (isPreviewLoad && nextPage > STALKER_PREVIEW_MAX_REMOTE_PAGES) break
val totalPages = currentHydration?.totalPages ?: 0
if (!firstIteration && totalPages > 0 && nextPage > totalPages) break
@@ -1291,32 +1318,54 @@ class SeriesRepositoryImpl @Inject constructor(
currentHydration = SeriesCategoryHydrationEntity(
providerId = providerId,
categoryId = categoryId,
- lastHydratedAt = System.currentTimeMillis(),
+ lastHydratedAt = attemptStartedAt,
itemCount = currentCount,
lastStatus = "SUCCESS",
lastError = null,
lastLoadedPage = result.data.page,
+ lastAttemptedPage = result.data.page,
+ lastSuccessfulPage = result.data.page,
totalPages = result.data.totalPages,
isComplete = pageComplete,
- pageSize = result.data.pageSize
+ pageSize = result.data.pageSize,
+ retryAfterMs = 0L,
+ failureCount = 0,
+ retryBudgetRemaining = 3,
+ lastPageFingerprint = null
)
seriesCategoryHydrationDao.upsert(currentHydration!!)
if (pageComplete) break
nextPage = result.data.page + 1
}
is Result.Error -> {
+ val priorFailureCount = currentHydration?.failureCount ?: 0
+ val remainingBudget = ((currentHydration?.retryBudgetRemaining ?: 3) - 1).coerceAtLeast(0)
+ val nextStatus = when {
+ remainingBudget <= 0 -> "FAILED_BUDGET_EXHAUSTED"
+ else -> "FAILED_RETRYABLE"
+ }
seriesCategoryHydrationDao.upsert(
SeriesCategoryHydrationEntity(
providerId = providerId,
categoryId = categoryId,
lastHydratedAt = currentHydration?.lastHydratedAt ?: 0L,
itemCount = currentCount,
- lastStatus = "ERROR",
+ lastStatus = nextStatus,
lastError = result.message,
lastLoadedPage = currentHydration?.lastLoadedPage ?: 0,
+ lastAttemptedPage = nextPage,
+ lastSuccessfulPage = currentHydration?.lastSuccessfulPage ?: currentHydration?.lastLoadedPage ?: 0,
totalPages = currentHydration?.totalPages ?: 0,
isComplete = currentHydration?.isComplete ?: false,
- pageSize = currentHydration?.pageSize ?: 0
+ pageSize = currentHydration?.pageSize ?: 0,
+ retryAfterMs = if (nextStatus == "FAILED_RETRYABLE") {
+ attemptStartedAt + XTREAM_EMPTY_CATEGORY_RETRY_COOLDOWN_MILLIS * (priorFailureCount + 1)
+ } else {
+ 0L
+ },
+ failureCount = priorFailureCount + 1,
+ retryBudgetRemaining = remainingBudget,
+ lastPageFingerprint = currentHydration?.lastPageFingerprint
)
)
break
diff --git a/data/src/main/java/com/streamvault/data/sync/ProviderSyncWorker.kt b/data/src/main/java/com/streamvault/data/sync/ProviderSyncWorker.kt
index 732ac321..641e40e6 100644
--- a/data/src/main/java/com/streamvault/data/sync/ProviderSyncWorker.kt
+++ b/data/src/main/java/com/streamvault/data/sync/ProviderSyncWorker.kt
@@ -131,6 +131,8 @@ class ProviderSyncWorker(
)
} else if (provider.type == ProviderType.XTREAM_CODES) {
syncXtreamProviderIfStale(entryPoint, provider)
+ } else if (provider.type == ProviderType.STALKER_PORTAL) {
+ syncStalkerProviderIfStale(entryPoint, provider)
} else {
entryPoint.syncManager().sync(provider.id, force = false)
}
@@ -166,6 +168,7 @@ class ProviderSyncWorker(
companion object {
private const val TAG = "ProviderSyncWorker"
+ private const val STALE_RUNNING_JOB_MILLIS = 15 * 60 * 1000L
private const val UNIQUE_WORK_NAME = "provider-sync-worker"
private const val UNIQUE_LAUNCH_STALE_WORK_NAME = "provider-sync-launch-stale-check"
private const val UNIQUE_PROVIDER_WORK_PREFIX = "provider-sync-provider-"
@@ -305,9 +308,55 @@ class ProviderSyncWorker(
): Boolean {
val job = entryPoint.xtreamIndexJobDao().get(providerId, section.name) ?: return true
if (job.state in setOf("QUEUED", "PARTIAL", "STALE", "FAILED_RETRYABLE")) return true
+ if (job.state == "RUNNING" && (now - job.updatedAt) < STALE_RUNNING_JOB_MILLIS) return false
return ContentCachePolicy.shouldRefresh(job.lastSuccessAt, ContentCachePolicy.CATALOG_TTL_MILLIS, now)
}
+ private suspend fun syncStalkerProviderIfStale(
+ entryPoint: ProviderSyncWorkerEntryPoint,
+ provider: com.streamvault.data.local.entity.ProviderEntity
+ ): com.streamvault.domain.model.Result<Unit> {
+ val now = System.currentTimeMillis()
+ val metadata = entryPoint.syncMetadataRepository().getMetadata(provider.id)
+ val liveStale = ContentCachePolicy.shouldRefresh(
+ metadata?.lastLiveSuccess ?: 0L,
+ ContentCachePolicy.CATALOG_TTL_MILLIS,
+ now
+ )
+ val epgStale = provider.epgSyncMode != ProviderEpgSyncMode.SKIP &&
+ ContentCachePolicy.shouldRefresh(
+ metadata?.lastEpgSuccess ?: 0L,
+ ContentCachePolicy.EPG_TTL_MILLIS,
+ now
+ )
+ val movieIndexDue = shouldRunIndexJob(entryPoint, provider.id, ContentType.MOVIE, now)
+ val seriesIndexDue = shouldRunIndexJob(entryPoint, provider.id, ContentType.SERIES, now)
+
+ if (!provider.isActive) {
+ return com.streamvault.domain.model.Result.success(Unit)
+ }
+
+ if (liveStale) {
+ when (val liveResult = entryPoint.syncManager().retrySection(provider.id, SyncRepairSection.LIVE)) {
+ is com.streamvault.domain.model.Result.Error -> return liveResult
+ else -> Unit
+ }
+ }
+ if (epgStale) {
+ when (val epgResult = entryPoint.syncManager().syncEpg(provider.id, force = false)) {
+ is com.streamvault.domain.model.Result.Error -> return epgResult
+ else -> Unit
+ }
+ }
+ if (movieIndexDue) {
+ entryPoint.syncManager().scheduleStalkerIndexSync(provider.id, ContentType.MOVIE)
+ }
+ if (seriesIndexDue) {
+ entryPoint.syncManager().scheduleStalkerIndexSync(provider.id, ContentType.SERIES)
+ }
+ return com.streamvault.domain.model.Result.success(Unit)
+ }
+
private suspend fun reconcileTargetedProviderStatus(
entryPoint: ProviderSyncWorkerEntryPoint,
provider: com.streamvault.data.local.entity.ProviderEntity,
diff --git a/data/src/main/java/com/streamvault/data/sync/StalkerIndexWorker.kt b/data/src/main/java/com/streamvault/data/sync/StalkerIndexWorker.kt
new file mode 100644
index 00000000..29cb3262
--- /dev/null
+++ b/data/src/main/java/com/streamvault/data/sync/StalkerIndexWorker.kt
@@ -0,0 +1,150 @@
+package com.streamvault.data.sync
+
+import android.content.Context
+import android.database.sqlite.SQLiteException
+import android.util.Log
+import androidx.work.BackoffPolicy
+import androidx.work.Constraints
+import androidx.work.CoroutineWorker
+import androidx.work.Data
+import androidx.work.ExistingWorkPolicy
+import androidx.work.NetworkType
+import androidx.work.OneTimeWorkRequestBuilder
+import androidx.work.WorkManager
+import androidx.work.WorkRequest
+import androidx.work.WorkerParameters
+import com.streamvault.data.local.dao.ProviderDao
+import com.streamvault.domain.model.ContentType
+import com.streamvault.domain.model.ProviderType
+import dagger.hilt.EntryPoint
+import dagger.hilt.InstallIn
+import dagger.hilt.android.EntryPointAccessors
+import dagger.hilt.components.SingletonComponent
+import java.io.IOException
+import java.util.concurrent.TimeUnit
+
+class StalkerIndexWorker(
+ appContext: Context,
+ workerParams: WorkerParameters
+) : CoroutineWorker(appContext, workerParams) {
+
+ @EntryPoint
+ @InstallIn(SingletonComponent::class)
+ interface StalkerIndexWorkerEntryPoint {
+ fun providerDao(): ProviderDao
+ fun syncManager(): SyncManager
+ }
+
+ override suspend fun doWork(): Result {
+ if (applicationContext.isCurrentlyLowOnMemoryForSync()) {
+ Log.w(TAG, "Deferring Stalker index work: device low on memory")
+ return Result.retry()
+ }
+
+ val force = inputData.getBoolean(KEY_FORCE, false)
+ val requestedProviderId = inputData.getLong(KEY_PROVIDER_ID, INVALID_PROVIDER_ID)
+ val requestedSection = inputData.getString(KEY_SECTION)?.toContentTypeOrNull()
+
+ return try {
+ val entryPoint = EntryPointAccessors.fromApplication(
+ applicationContext,
+ StalkerIndexWorkerEntryPoint::class.java
+ )
+ val providers = if (requestedProviderId > 0L) {
+ entryPoint.providerDao().getById(requestedProviderId)?.let(::listOf).orEmpty()
+ } else {
+ entryPoint.providerDao().getAllSync()
+ .filter { provider -> provider.isActive && provider.type == ProviderType.STALKER_PORTAL }
+ }
+
+ var sawRetryableFailure = false
+ providers
+ .filter { provider -> provider.type == ProviderType.STALKER_PORTAL }
+ .forEach { provider ->
+ when (val result = entryPoint.syncManager().processQueuedStalkerIndexJobs(
+ providerId = provider.id,
+ section = requestedSection,
+ force = force,
+ maxCategoriesPerSection = CATEGORY_SLICE_SIZE
+ )) {
+ is com.streamvault.domain.model.Result.Error -> {
+ Log.w(TAG, "Stalker index worker failed for provider ${provider.id}: ${result.message}")
+ if (shouldRetry(result.exception)) {
+ sawRetryableFailure = true
+ }
+ }
+ else -> Unit
+ }
+ }
+
+ if (sawRetryableFailure) Result.retry() else Result.success()
+ } catch (error: Exception) {
+ Log.e(TAG, "Stalker index worker failed", error)
+ if (shouldRetry(error)) Result.retry() else Result.failure()
+ }
+ }
+
+ private fun shouldRetry(error: Throwable?): Boolean {
+ return when (error) {
+ is IOException -> true
+ is SQLiteException -> error.message.orEmpty().contains("locked", ignoreCase = true) ||
+ error.message.orEmpty().contains("busy", ignoreCase = true)
+ else -> false
+ }
+ }
+
+ companion object {
+ private const val TAG = "StalkerIndexWorker"
+ private const val KEY_PROVIDER_ID = "provider_id"
+ private const val KEY_SECTION = "section"
+ private const val KEY_FORCE = "force"
+ private const val INVALID_PROVIDER_ID = -1L
+ private const val CATEGORY_SLICE_SIZE = 12
+ private const val UNIQUE_WORK_PREFIX = "stalker-index-worker-"
+
+ fun enqueue(
+ context: Context,
+ providerId: Long,
+ section: String? = null,
+ force: Boolean = false,
+ initialDelaySeconds: Long = 0L
+ ) {
+ if (providerId <= 0L) return
+ val request = OneTimeWorkRequestBuilder<StalkerIndexWorker>()
+ .setInputData(
+ Data.Builder()
+ .putLong(KEY_PROVIDER_ID, providerId)
+ .putBoolean(KEY_FORCE, force)
+ .also { builder ->
+ section?.let { builder.putString(KEY_SECTION, it) }
+ }
+ .build()
+ )
+ .setConstraints(defaultConstraints())
+ .setInitialDelay(initialDelaySeconds.coerceAtLeast(0L), TimeUnit.SECONDS)
+ .setBackoffCriteria(
+ BackoffPolicy.EXPONENTIAL,
+ WorkRequest.MIN_BACKOFF_MILLIS,
+ TimeUnit.MILLISECONDS
+ )
+ .build()
+
+ WorkManager.getInstance(context).enqueueUniqueWork(
+ uniqueWorkName(providerId, section),
+ if (force) ExistingWorkPolicy.REPLACE else ExistingWorkPolicy.APPEND_OR_REPLACE,
+ request
+ )
+ }
+
+ private fun defaultConstraints(): Constraints = Constraints.Builder()
+ .setRequiredNetworkType(NetworkType.CONNECTED)
+ .setRequiresBatteryNotLow(true)
+ .build()
+
+ private fun uniqueWorkName(providerId: Long, section: String?): String =
+ "$UNIQUE_WORK_PREFIX$providerId-${section.orEmpty()}"
+
+ private fun String.toContentTypeOrNull(): ContentType? =
+ runCatching { ContentType.valueOf(this) }.getOrNull()
+ }
+}
diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt
index dbb46a50..c8e0ece6 100644
--- a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt
+++ b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt
@@ -6,9 +6,11 @@ import com.streamvault.data.local.DatabaseTransactionRunner
import com.streamvault.data.local.dao.CatalogSyncDao
import com.streamvault.data.local.dao.CategoryDao
import com.streamvault.data.local.dao.ChannelDao
+import com.streamvault.data.local.dao.MovieCategoryHydrationDao
import com.streamvault.data.local.dao.MovieDao
import com.streamvault.data.local.dao.ProgramDao
import com.streamvault.data.local.dao.ProviderDao
+import com.streamvault.data.local.dao.SeriesCategoryHydrationDao
import com.streamvault.data.local.dao.SeriesDao
import com.streamvault.data.local.dao.TmdbIdentityDao
import com.streamvault.data.local.dao.XtreamContentIndexDao
@@ -85,6 +87,11 @@ import javax.inject.Singleton
private const val TAG = "SyncManager"
private const val XTREAM_FALLBACK_STAGE_BATCH_SIZE = 500
+private const val STALKER_INDEX_CATEGORY_SLICE_SIZE = 12
+private const val STALKER_CATEGORY_RETRY_BUDGET = 3
+private const val STALKER_CATEGORY_RETRY_COOLDOWN_MILLIS = 5 * 60 * 1000L
+private const val STALKER_RUNNING_JOB_STALE_MILLIS = 15 * 60 * 1000L
+private const val STALKER_MIN_HEALTHY_EPG_PROGRAMS = 3
private const val LIVE_CATEGORY_SEQUENTIAL_MODE_WARNING =
"Live category sync downgraded to sequential mode after provider stress signals."
private const val XTREAM_RECOVERY_ABORT_WARNING_SUFFIX =
@@ -152,6 +159,8 @@ class SyncManager @Inject constructor(
private val seriesDao: SeriesDao,
private val programDao: ProgramDao,
private val categoryDao: CategoryDao,
+ private val movieCategoryHydrationDao: MovieCategoryHydrationDao,
+ private val seriesCategoryHydrationDao: SeriesCategoryHydrationDao,
private val catalogSyncDao: CatalogSyncDao,
private val tmdbIdentityDao: TmdbIdentityDao,
private val xtreamContentIndexDao: XtreamContentIndexDao,
@@ -315,6 +324,19 @@ class SyncManager @Inject constructor(
}
}
+ fun scheduleStalkerIndexSync(providerId: Long, section: ContentType? = null, force: Boolean = false) {
+ runCatching {
+ StalkerIndexWorker.enqueue(
+ context = applicationContext,
+ providerId = providerId,
+ section = section?.name,
+ force = force
+ )
+ }.onFailure { error ->
+ Log.w(TAG, "Failed to schedule Stalker index work for provider $providerId (${section?.name ?: "all"}): ${sanitizeThrowableMessage(error)}")
+ }
+ }
+
suspend fun prioritizeXtreamIndexCategory(
providerId: Long,
section: ContentType,
@@ -434,7 +456,13 @@ class SyncManager @Inject constructor(
lastSuccessAt: Long? = null,
lastError: String? = null
) {
- if (provider.type != ProviderType.XTREAM_CODES || provider.epgSyncMode == ProviderEpgSyncMode.SKIP) return
+ if (
+ provider.type != ProviderType.XTREAM_CODES &&
+ provider.type != ProviderType.STALKER_PORTAL
+ ) {
+ return
+ }
+ if (provider.epgSyncMode == ProviderEpgSyncMode.SKIP) return
upsertXtreamIndexJob(
providerId = provider.id,
section = "EPG",
@@ -1316,10 +1344,752 @@ class SyncManager @Inject constructor(
private fun shouldRunXtreamSummaryIndex(job: XtreamIndexJobEntity?): Boolean {
if (job == null) return true
+ if (job.state == "RUNNING" && System.currentTimeMillis() - job.updatedAt < STALKER_RUNNING_JOB_STALE_MILLIS) {
+ return false
+ }
if (job.state in setOf("QUEUED", "RUNNING", "PARTIAL", "STALE", "FAILED_RETRYABLE")) return true
return ContentCachePolicy.shouldRefresh(job.lastSuccessAt, ContentCachePolicy.CATALOG_TTL_MILLIS)
}
+ suspend fun processQueuedStalkerIndexJobs(
+ providerId: Long,
+ section: ContentType? = null,
+ force: Boolean = false,
+ maxCategoriesPerSection: Int? = null,
+ onProgress: ((String) -> Unit)? = null
+ ): com.streamvault.domain.model.Result<Unit> = withProviderLock(providerId) lock@{
+ val providerEntity = providerDao.getById(providerId)
+ ?: return@lock com.streamvault.domain.model.Result.error("Provider $providerId not found")
+ if (providerEntity.type != ProviderType.STALKER_PORTAL) {
+ return@lock com.streamvault.domain.model.Result.success(Unit)
+ }
+
+ val provider = providerEntity
+ .copy(password = credentialCrypto.decryptIfNeeded(providerEntity.password))
+ .toDomain()
+ val api = createStalkerSyncProvider(provider)
+ val sections = when (section) {
+ ContentType.MOVIE -> listOf(ContentType.MOVIE)
+ ContentType.SERIES -> listOf(ContentType.SERIES)
+ else -> listOf(ContentType.MOVIE, ContentType.SERIES)
+ }
+
+ val warnings = mutableListOf<String>()
+ var sawRetryableFailure = false
+ val categoryLimit = maxCategoriesPerSection?.coerceAtLeast(1) ?: STALKER_INDEX_CATEGORY_SLICE_SIZE
+ sections.forEach { contentType ->
+ val job = xtreamIndexJobDao.get(providerId, contentType.name)
+ if (!force && !shouldRunXtreamSummaryIndex(job)) {
+ return@forEach
+ }
+ if (job?.state == "RUNNING" && System.currentTimeMillis() - job.updatedAt < STALKER_RUNNING_JOB_STALE_MILLIS) {
+ return@forEach
+ }
+ val failure = runCatching {
+ processStalkerSummaryIndexSection(
+ provider = provider,
+ api = api,
+ contentType = contentType,
+ maxCategories = categoryLimit,
+ onProgress = onProgress
+ )
+ }.exceptionOrNull()
+ if (failure != null) {
+ val failedAt = System.currentTimeMillis()
+ val state = stalkerIndexFailureState(failure)
+ upsertXtreamIndexJob(
+ providerId = providerId,
+ section = contentType.name,
+ state = state,
+ now = failedAt,
+ lastAttemptAt = failedAt,
+ lastError = sanitizeThrowableMessage(failure)
+ )
+ sawRetryableFailure = sawRetryableFailure || state != "FAILED_PERMANENT"
+ warnings += "${contentType.name.lowercase().replaceFirstChar { it.titlecase() }} indexing failed: ${sanitizeThrowableMessage(failure)}"
+ }
+ }
+
+ if (warnings.isNotEmpty()) {
+ val message = warnings.joinToString("; ")
+ val exception = if (sawRetryableFailure) IOException(message) else IllegalStateException(message)
+ com.streamvault.domain.model.Result.error(warnings.first(), exception)
+ } else {
+ com.streamvault.domain.model.Result.success(Unit)
+ }
+ }
+
+ private suspend fun processStalkerSummaryIndexSection(
+ provider: Provider,
+ api: StalkerProvider,
+ contentType: ContentType,
+ maxCategories: Int,
+ onProgress: ((String) -> Unit)?
+ ) {
+ require(contentType == ContentType.MOVIE || contentType == ContentType.SERIES) {
+ "Unsupported Stalker summary index section: $contentType"
+ }
+ val now = System.currentTimeMillis()
+ val categories = categoryDao.getByProviderAndTypeSync(provider.id, contentType.name)
+ val visibleCategories = visibleStalkerIndexCategories(provider.id, contentType, categories, api)
+ if (visibleCategories.isEmpty()) {
+ val deletedRows = xtreamContentIndexDao.pruneStaleLocalContentRows(provider.id, contentType.name)
+ val indexedRows = currentStalkerIndexedRowCount(provider.id, contentType)
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = contentType.name,
+ state = "SUCCESS",
+ now = now,
+ totalCategories = 0,
+ completedCategories = 0,
+ nextCategoryIndex = 0,
+ failedCategories = 0,
+ indexedRows = indexedRows,
+ deletedPrunedRows = deletedRows,
+ clearPriority = true,
+ lastAttemptAt = now,
+ lastSuccessAt = now,
+ lastError = null
+ )
+ updateStalkerSummaryMetadata(provider.id, contentType, indexedRows, "SUCCESS", now)
+ return
+ }
+
+ val initialJob = xtreamIndexJobDao.get(provider.id, contentType.name)
+ val priorityCategoryId = initialJob?.priorityCategoryId
+ val hydrationByCategory = visibleCategories.associate { category ->
+ category.categoryId to getStalkerHydrationSnapshot(provider.id, contentType, category.categoryId)
+ }
+ val completedBefore = hydrationByCategory.values.count { it?.isComplete == true }
+ val failedBefore = hydrationByCategory.values.count { it?.isTerminalFailure == true }
+ val indexedBefore = currentStalkerIndexedRowCount(provider.id, contentType)
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = contentType.name,
+ state = "RUNNING",
+ now = now,
+ totalCategories = visibleCategories.size,
+ completedCategories = completedBefore,
+ failedCategories = failedBefore,
+ indexedRows = indexedBefore,
+ lastAttemptAt = now,
+ lastError = null
+ )
+
+ val pending = buildList {
+ priorityCategoryId
+ ?.takeIf { requestedId -> visibleCategories.any { it.categoryId == requestedId } }
+ ?.let { requestedId ->
+ val hydration = hydrationByCategory[requestedId]
+ if (canAttemptStalkerCategory(hydration, now)) {
+ visibleCategories.firstOrNull { it.categoryId == requestedId }?.let(::add)
+ }
+ }
+ visibleCategories.forEach { category ->
+ if (size >= maxCategories) return@forEach
+ if (any { it.categoryId == category.categoryId }) return@forEach
+ val hydration = hydrationByCategory[category.categoryId]
+ if (!canAttemptStalkerCategory(hydration, now)) return@forEach
+ add(category)
+ }
+ }
+
+ var clearPriority = false
+ var skippedMalformedRows = initialJob?.skippedMalformedRows ?: 0
+ pending.forEach { category ->
+ progress(provider.id, onProgress, "Indexing ${xtreamIndexSectionLabel(contentType)}: ${category.name}")
+ val hydration = getStalkerHydrationSnapshot(provider.id, contentType, category.categoryId)
+ val nextPage = nextStalkerAttemptPage(hydration)
+ markStalkerAttemptStarted(
+ providerId = provider.id,
+ contentType = contentType,
+ categoryId = category.categoryId,
+ hydration = hydration,
+ attemptedPage = nextPage,
+ now = System.currentTimeMillis()
+ )
+ when (val result = fetchStalkerSummaryPageWithRecovery(api, contentType, category.categoryId, nextPage)) {
+ is Result.Success -> {
+ val indexedAt = System.currentTimeMillis()
+ val pageFingerprint = stalkerPageFingerprint(result.data.items, contentType)
+ val anomaly = detectStalkerPageAnomaly(
+ hydration = hydration,
+ requestedPage = nextPage,
+ pagedResult = result.data,
+ pageFingerprint = pageFingerprint
+ )
+ if (anomaly != null) {
+ skippedMalformedRows += result.data.items.size
+ markStalkerAttemptFailed(
+ providerId = provider.id,
+ contentType = contentType,
+ categoryId = category.categoryId,
+ hydration = hydration,
+ attemptedPage = nextPage,
+ now = indexedAt,
+ message = anomaly,
+ retryable = true,
+ pageFingerprint = pageFingerprint
+ )
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = contentType.name,
+ state = "RUNNING",
+ now = indexedAt,
+ skippedMalformedRows = skippedMalformedRows,
+ lastAttemptAt = indexedAt,
+ lastError = anomaly
+ )
+ return@forEach
+ }
+ val dedupedItems = dedupeStalkerPageItems(result.data.items, contentType)
+ skippedMalformedRows += (result.data.items.size - dedupedItems.size).coerceAtLeast(0)
+ when (contentType) {
+ ContentType.MOVIE -> upsertXtreamMovieSummaryBatch(provider.id, dedupedItems.filterIsInstance<Movie>(), indexedAt)
+ ContentType.SERIES -> upsertXtreamSeriesSummaryBatch(provider.id, dedupedItems.filterIsInstance<Series>(), indexedAt)
+ else -> Unit
+ }
+ val categoryCount = currentStalkerCategoryCount(provider.id, contentType, category.categoryId)
+ val pageComplete = result.data.isComplete ||
+ (result.data.items.isEmpty() && result.data.totalPages in 1..nextPage)
+ markStalkerAttemptSucceeded(
+ providerId = provider.id,
+ contentType = contentType,
+ categoryId = category.categoryId,
+ hydration = hydration,
+ attemptedPage = nextPage,
+ now = indexedAt,
+ itemCount = categoryCount,
+ totalPages = result.data.totalPages,
+ pageSize = result.data.pageSize,
+ pageComplete = pageComplete,
+ pageFingerprint = pageFingerprint
+ )
+ }
+ is Result.Error -> {
+ val failedAt = System.currentTimeMillis()
+ val retryable = stalkerIndexFailureState(result.exception ?: IllegalStateException(result.message)) != "FAILED_PERMANENT"
+ markStalkerAttemptFailed(
+ providerId = provider.id,
+ contentType = contentType,
+ categoryId = category.categoryId,
+ hydration = hydration,
+ attemptedPage = nextPage,
+ now = failedAt,
+ message = result.message,
+ retryable = retryable,
+ pageFingerprint = hydration?.lastPageFingerprint
+ )
+ if (!retryable) {
+ throw IllegalStateException(result.message, result.exception)
+ }
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = contentType.name,
+ state = "RUNNING",
+ now = failedAt,
+ skippedMalformedRows = skippedMalformedRows,
+ lastAttemptAt = now,
+ lastError = result.message
+ )
+ }
+ is Result.Loading -> Unit
+ }
+ if (priorityCategoryId == category.categoryId) {
+ clearPriority = true
+ }
+ }
+
+ val refreshedHydration = visibleCategories.associate { category ->
+ category.categoryId to getStalkerHydrationSnapshot(provider.id, contentType, category.categoryId)
+ }
+ val finishedAt = System.currentTimeMillis()
+ val completedCategories = refreshedHydration.values.count { it?.isComplete == true }
+ val failedCategories = refreshedHydration.values.count { it?.isTerminalFailure == true }
+ val hasMoreCategories = refreshedHydration.values.any { hydration ->
+ canAttemptStalkerCategory(hydration, finishedAt)
+ }
+ val indexedRows = currentStalkerIndexedRowCount(provider.id, contentType)
+ val pruneSuppressed = refreshedHydration.values.any { hydration ->
+ hydration?.hasPruneSuppressionRisk == true
+ }
+ val deletedRows = if (!hasMoreCategories && failedCategories == 0 && !pruneSuppressed) {
+ xtreamContentIndexDao.pruneStaleLocalContentRows(provider.id, contentType.name)
+ } else {
+ 0
+ }
+ val finalState = when {
+ hasMoreCategories -> "QUEUED"
+ failedCategories > 0 -> "PARTIAL"
+ pruneSuppressed -> "PARTIAL"
+ else -> "SUCCESS"
+ }
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = contentType.name,
+ state = finalState,
+ now = finishedAt,
+ totalCategories = visibleCategories.size,
+ completedCategories = completedCategories,
+ nextCategoryIndex = completedCategories,
+ failedCategories = failedCategories,
+ indexedRows = indexedRows,
+ skippedMalformedRows = skippedMalformedRows,
+ deletedPrunedRows = deletedRows,
+ clearPriority = clearPriority || finalState == "SUCCESS",
+ lastAttemptAt = now,
+ lastSuccessAt = finishedAt.takeIf { finalState == "SUCCESS" },
+ lastError = refreshedHydration.values.firstOrNull { it?.lastStatus == "ERROR" }?.lastError
+ )
+ updateStalkerSummaryMetadata(provider.id, contentType, indexedRows, finalState, finishedAt)
+ if (hasMoreCategories) {
+ scheduleStalkerIndexSync(provider.id, contentType, force = false)
+ }
+ }
+
+ private data class StalkerHydrationSnapshot(
+ val lastHydratedAt: Long,
+ val itemCount: Int,
+ val lastStatus: String,
+ val lastError: String?,
+ val lastLoadedPage: Int,
+ val lastAttemptedPage: Int,
+ val lastSuccessfulPage: Int,
+ val totalPages: Int,
+ val isComplete: Boolean,
+ val pageSize: Int,
+ val retryAfterMs: Long,
+ val failureCount: Int,
+ val retryBudgetRemaining: Int,
+ val lastPageFingerprint: String?
+ )
+
+ private val StalkerHydrationSnapshot.isTerminalFailure: Boolean
+ get() = lastStatus in setOf("FAILED_PERMANENT", "FAILED_BUDGET_EXHAUSTED")
+
+ private val StalkerHydrationSnapshot.hasPruneSuppressionRisk: Boolean
+ get() = lastStatus in setOf("ANOMALY", "FAILED_RETRYABLE", "COOLDOWN")
+
+ private suspend fun getStalkerHydrationSnapshot(
+ providerId: Long,
+ contentType: ContentType,
+ categoryId: Long
+ ): StalkerHydrationSnapshot? = when (contentType) {
+ ContentType.MOVIE -> movieCategoryHydrationDao.get(providerId, categoryId)?.let { hydration ->
+ StalkerHydrationSnapshot(
+ lastHydratedAt = hydration.lastHydratedAt,
+ itemCount = hydration.itemCount,
+ lastStatus = hydration.lastStatus,
+ lastError = hydration.lastError,
+ lastLoadedPage = hydration.lastLoadedPage,
+ lastAttemptedPage = hydration.lastAttemptedPage,
+ lastSuccessfulPage = hydration.lastSuccessfulPage,
+ totalPages = hydration.totalPages,
+ isComplete = hydration.isComplete,
+ pageSize = hydration.pageSize,
+ retryAfterMs = hydration.retryAfterMs,
+ failureCount = hydration.failureCount,
+ retryBudgetRemaining = hydration.retryBudgetRemaining,
+ lastPageFingerprint = hydration.lastPageFingerprint
+ )
+ }
+ ContentType.SERIES -> seriesCategoryHydrationDao.get(providerId, categoryId)?.let { hydration ->
+ StalkerHydrationSnapshot(
+ lastHydratedAt = hydration.lastHydratedAt,
+ itemCount = hydration.itemCount,
+ lastStatus = hydration.lastStatus,
+ lastError = hydration.lastError,
+ lastLoadedPage = hydration.lastLoadedPage,
+ lastAttemptedPage = hydration.lastAttemptedPage,
+ lastSuccessfulPage = hydration.lastSuccessfulPage,
+ totalPages = hydration.totalPages,
+ isComplete = hydration.isComplete,
+ pageSize = hydration.pageSize,
+ retryAfterMs = hydration.retryAfterMs,
+ failureCount = hydration.failureCount,
+ retryBudgetRemaining = hydration.retryBudgetRemaining,
+ lastPageFingerprint = hydration.lastPageFingerprint
+ )
+ }
+ else -> null
+ }
+
+ private fun canAttemptStalkerCategory(
+ hydration: StalkerHydrationSnapshot?,
+ finishedAt: Long
+ ): Boolean {
+ if (hydration == null) return true
+ if (hydration.isComplete) return false
+ if (hydration.isTerminalFailure) return false
+ if (hydration.retryBudgetRemaining <= 0) return false
+ if (hydration.retryAfterMs > finishedAt) return false
+ return true
+ }
+
+ private fun nextStalkerAttemptPage(hydration: StalkerHydrationSnapshot?): Int {
+ if (hydration == null) return 1
+ if (hydration.lastStatus in setOf("FAILED_RETRYABLE", "COOLDOWN", "ANOMALY")) {
+ return hydration.lastAttemptedPage.coerceAtLeast(1)
+ }
+ return (hydration.lastSuccessfulPage + 1).coerceAtLeast(1)
+ }
+
+ private suspend fun markStalkerAttemptStarted(
+ providerId: Long,
+ contentType: ContentType,
+ categoryId: Long,
+ hydration: StalkerHydrationSnapshot?,
+ attemptedPage: Int,
+ now: Long
+ ) {
+ when (contentType) {
+ ContentType.MOVIE -> movieCategoryHydrationDao.upsert(
+ com.streamvault.data.local.entity.MovieCategoryHydrationEntity(
+ providerId = providerId,
+ categoryId = categoryId,
+ lastHydratedAt = hydration?.lastHydratedAt ?: 0L,
+ itemCount = hydration?.itemCount ?: 0,
+ lastStatus = "RUNNING",
+ lastError = null,
+ lastLoadedPage = hydration?.lastLoadedPage ?: 0,
+ lastAttemptedPage = attemptedPage,
+ lastSuccessfulPage = hydration?.lastSuccessfulPage ?: 0,
+ totalPages = hydration?.totalPages ?: 0,
+ isComplete = hydration?.isComplete ?: false,
+ pageSize = hydration?.pageSize ?: 0,
+ retryAfterMs = 0L,
+ failureCount = hydration?.failureCount ?: 0,
+ retryBudgetRemaining = hydration?.retryBudgetRemaining ?: STALKER_CATEGORY_RETRY_BUDGET,
+ lastPageFingerprint = hydration?.lastPageFingerprint
+ )
+ )
+ ContentType.SERIES -> seriesCategoryHydrationDao.upsert(
+ com.streamvault.data.local.entity.SeriesCategoryHydrationEntity(
+ providerId = providerId,
+ categoryId = categoryId,
+ lastHydratedAt = hydration?.lastHydratedAt ?: 0L,
+ itemCount = hydration?.itemCount ?: 0,
+ lastStatus = "RUNNING",
+ lastError = null,
+ lastLoadedPage = hydration?.lastLoadedPage ?: 0,
+ lastAttemptedPage = attemptedPage,
+ lastSuccessfulPage = hydration?.lastSuccessfulPage ?: 0,
+ totalPages = hydration?.totalPages ?: 0,
+ isComplete = hydration?.isComplete ?: false,
+ pageSize = hydration?.pageSize ?: 0,
+ retryAfterMs = 0L,
+ failureCount = hydration?.failureCount ?: 0,
+ retryBudgetRemaining = hydration?.retryBudgetRemaining ?: STALKER_CATEGORY_RETRY_BUDGET,
+ lastPageFingerprint = hydration?.lastPageFingerprint
+ )
+ )
+ else -> Unit
+ }
+ }
+
+ private suspend fun markStalkerAttemptSucceeded(
+ providerId: Long,
+ contentType: ContentType,
+ categoryId: Long,
+ hydration: StalkerHydrationSnapshot?,
+ attemptedPage: Int,
+ now: Long,
+ itemCount: Int,
+ totalPages: Int,
+ pageSize: Int,
+ pageComplete: Boolean,
+ pageFingerprint: String?
+ ) {
+ when (contentType) {
+ ContentType.MOVIE -> movieCategoryHydrationDao.upsert(
+ com.streamvault.data.local.entity.MovieCategoryHydrationEntity(
+ providerId = providerId,
+ categoryId = categoryId,
+ lastHydratedAt = now,
+ itemCount = itemCount,
+ lastStatus = "SUCCESS",
+ lastError = null,
+ lastLoadedPage = attemptedPage,
+ lastAttemptedPage = attemptedPage,
+ lastSuccessfulPage = attemptedPage,
+ totalPages = totalPages,
+ isComplete = pageComplete,
+ pageSize = pageSize,
+ retryAfterMs = 0L,
+ failureCount = 0,
+ retryBudgetRemaining = STALKER_CATEGORY_RETRY_BUDGET,
+ lastPageFingerprint = pageFingerprint
+ )
+ )
+ ContentType.SERIES -> seriesCategoryHydrationDao.upsert(
+ com.streamvault.data.local.entity.SeriesCategoryHydrationEntity(
+ providerId = providerId,
+ categoryId = categoryId,
+ lastHydratedAt = now,
+ itemCount = itemCount,
+ lastStatus = "SUCCESS",
+ lastError = null,
+ lastLoadedPage = attemptedPage,
+ lastAttemptedPage = attemptedPage,
+ lastSuccessfulPage = attemptedPage,
+ totalPages = totalPages,
+ isComplete = pageComplete,
+ pageSize = pageSize,
+ retryAfterMs = 0L,
+ failureCount = 0,
+ retryBudgetRemaining = STALKER_CATEGORY_RETRY_BUDGET,
+ lastPageFingerprint = pageFingerprint
+ )
+ )
+ else -> Unit
+ }
+ }
+
+ private suspend fun markStalkerAttemptFailed(
+ providerId: Long,
+ contentType: ContentType,
+ categoryId: Long,
+ hydration: StalkerHydrationSnapshot?,
+ attemptedPage: Int,
+ now: Long,
+ message: String,
+ retryable: Boolean,
+ pageFingerprint: String?
+ ) {
+ val priorFailures = hydration?.failureCount ?: 0
+ val remainingBudget = if (retryable) {
+ ((hydration?.retryBudgetRemaining ?: STALKER_CATEGORY_RETRY_BUDGET) - 1).coerceAtLeast(0)
+ } else {
+ 0
+ }
+ val nextStatus = when {
+ !retryable -> "FAILED_PERMANENT"
+ remainingBudget <= 0 -> "FAILED_BUDGET_EXHAUSTED"
+ else -> "FAILED_RETRYABLE"
+ }
+ val retryAfterMs = if (nextStatus == "FAILED_RETRYABLE") {
+ now + STALKER_CATEGORY_RETRY_COOLDOWN_MILLIS * (priorFailures + 1).coerceAtLeast(1)
+ } else {
+ 0L
+ }
+ when (contentType) {
+ ContentType.MOVIE -> movieCategoryHydrationDao.upsert(
+ com.streamvault.data.local.entity.MovieCategoryHydrationEntity(
+ providerId = providerId,
+ categoryId = categoryId,
+ lastHydratedAt = hydration?.lastHydratedAt ?: 0L,
+ itemCount = hydration?.itemCount ?: 0,
+ lastStatus = nextStatus,
+ lastError = message,
+ lastLoadedPage = hydration?.lastLoadedPage ?: 0,
+ lastAttemptedPage = attemptedPage,
+ lastSuccessfulPage = hydration?.lastSuccessfulPage ?: 0,
+ totalPages = hydration?.totalPages ?: 0,
+ isComplete = hydration?.isComplete ?: false,
+ pageSize = hydration?.pageSize ?: 0,
+ retryAfterMs = retryAfterMs,
+ failureCount = priorFailures + 1,
+ retryBudgetRemaining = remainingBudget,
+ lastPageFingerprint = pageFingerprint
+ )
+ )
+ ContentType.SERIES -> seriesCategoryHydrationDao.upsert(
+ com.streamvault.data.local.entity.SeriesCategoryHydrationEntity(
+ providerId = providerId,
+ categoryId = categoryId,
+ lastHydratedAt = hydration?.lastHydratedAt ?: 0L,
+ itemCount = hydration?.itemCount ?: 0,
+ lastStatus = nextStatus,
+ lastError = message,
+ lastLoadedPage = hydration?.lastLoadedPage ?: 0,
+ lastAttemptedPage = attemptedPage,
+ lastSuccessfulPage = hydration?.lastSuccessfulPage ?: 0,
+ totalPages = hydration?.totalPages ?: 0,
+ isComplete = hydration?.isComplete ?: false,
+ pageSize = hydration?.pageSize ?: 0,
+ retryAfterMs = retryAfterMs,
+ failureCount = priorFailures + 1,
+ retryBudgetRemaining = remainingBudget,
+ lastPageFingerprint = pageFingerprint
+ )
+ )
+ else -> Unit
+ }
+ }
+
+ private suspend fun fetchStalkerSummaryPageWithRecovery(
+ api: StalkerProvider,
+ contentType: ContentType,
+ categoryId: Long,
+ page: Int
+ ): Result<com.streamvault.data.remote.stalker.StalkerPagedResult<out Any>> {
+ val initial = fetchStalkerSummaryPage(api, contentType, categoryId, page)
+ if (initial is Result.Error && isLikelyStalkerAuthFailure(initial.message, initial.exception)) {
+ Log.w(
+ TAG,
+ "Retrying Stalker ${contentType.name} page $page after auth refresh for category $categoryId"
+ )
+ api.invalidateAuthentication()
+ return fetchStalkerSummaryPage(api, contentType, categoryId, page)
+ }
+ return initial
+ }
+
+ private fun detectStalkerPageAnomaly(
+ hydration: StalkerHydrationSnapshot?,
+ requestedPage: Int,
+ pagedResult: com.streamvault.data.remote.stalker.StalkerPagedResult<out Any>,
+ pageFingerprint: String?
+ ): String? {
+ if (pagedResult.page != requestedPage) {
+ return "Portal returned page ${pagedResult.page} while page $requestedPage was requested."
+ }
+ if (hydration != null && hydration.totalPages > 0 && pagedResult.totalPages > 0) {
+ if (pagedResult.totalPages < hydration.lastSuccessfulPage) {
+ return "Portal page count regressed below the last successful page."
+ }
+ if (
+ hydration.lastAttemptedPage == requestedPage &&
+ hydration.lastPageFingerprint != null &&
+ hydration.lastPageFingerprint == pageFingerprint &&
+ hydration.lastStatus in setOf("FAILED_RETRYABLE", "RUNNING", "ANOMALY")
+ ) {
+ return "Portal repeated the same page payload for page $requestedPage."
+ }
+ }
+ if (pagedResult.items.isEmpty() && pagedResult.totalPages > requestedPage) {
+ return "Portal returned an empty mid-catalog page for page $requestedPage."
+ }
+ return null
+ }
+
+ private fun stalkerPageFingerprint(
+ items: List<out Any>,
+ contentType: ContentType
+ ): String? {
+ if (items.isEmpty()) return "empty"
+ val seeds = when (contentType) {
+ ContentType.MOVIE -> items.filterIsInstance<Movie>().map { movie ->
+ "${movie.streamId}:${movie.categoryId}:${movie.addedAt}"
+ }
+ ContentType.SERIES -> items.filterIsInstance<Series>().map { series ->
+ "${series.providerSeriesId ?: series.seriesId}:${series.categoryId}:${series.lastModified}"
+ }
+ else -> emptyList()
+ }
+ if (seeds.isEmpty()) return null
+ return sha1Hex(seeds.joinToString("|"))
+ }
+
+ private fun dedupeStalkerPageItems(
+ items: List<out Any>,
+ contentType: ContentType
+ ): List<out Any> = when (contentType) {
+ ContentType.MOVIE -> items.filterIsInstance<Movie>().distinctBy(Movie::streamId)
+ ContentType.SERIES -> items.filterIsInstance<Series>().distinctBy { it.providerSeriesId ?: it.seriesId.toString() }
+ else -> items
+ }
+
+ private fun isLikelyStalkerAuthFailure(message: String, exception: Throwable?): Boolean {
+ val normalizedMessage = message.lowercase()
+ val exceptionMessage = exception?.message?.lowercase().orEmpty()
+ return normalizedMessage.contains("http 401") ||
+ normalizedMessage.contains("http 403") ||
+ normalizedMessage.contains("token") ||
+ normalizedMessage.contains("authorization") ||
+ exceptionMessage.contains("http 401") ||
+ exceptionMessage.contains("http 403") ||
+ exceptionMessage.contains("token") ||
+ exceptionMessage.contains("authorization")
+ }
+
+ private fun sha1Hex(value: String): String {
+ val bytes = MessageDigest.getInstance("SHA-1").digest(value.toByteArray(Charsets.UTF_8))
+ return buildString(bytes.size * 2) {
+ bytes.forEach { byte -> append("%02x".format(byte)) }
+ }
+ }
+
+ private fun stalkerIndexFailureState(error: Throwable): String {
+ if (isLikelyStalkerAuthFailure(sanitizeThrowableMessage(error), error)) {
+ return "FAILED_PERMANENT"
+ }
+ val message = sanitizeThrowableMessage(error).lowercase()
+ if (message.contains("not accessible") || message.contains("no accessible catalog")) {
+ return "FAILED_PERMANENT"
+ }
+ return "FAILED_RETRYABLE"
+ }
+
+ private suspend fun fetchStalkerSummaryPage(
+ api: StalkerProvider,
+ contentType: ContentType,
+ categoryId: Long,
+ page: Int
+ ): Result<com.streamvault.data.remote.stalker.StalkerPagedResult<out Any>> = when (contentType) {
+ ContentType.MOVIE -> api.getVodStreamsPage(categoryId, page)
+ ContentType.SERIES -> api.getSeriesListPage(categoryId, page)
+ else -> Result.error("Unsupported Stalker summary page section: $contentType")
+ }
+
+ private suspend fun visibleStalkerIndexCategories(
+ providerId: Long,
+ contentType: ContentType,
+ categories: List<CategoryEntity>,
+ api: StalkerProvider
+ ): List<CategoryEntity> {
+ val hiddenCategoryIds = preferencesRepository.getHiddenCategoryIds(providerId, contentType).first()
+ val visible = categories.filterNot { category -> category.categoryId in hiddenCategoryIds }
+ if (visible.isEmpty()) return emptyList()
+ val normalCategories = visible.filterNot { category -> api.isWildcardCategory(contentType, category.categoryId) }
+ return if (normalCategories.isNotEmpty()) normalCategories else visible
+ }
+
+ private suspend fun currentStalkerIndexedRowCount(providerId: Long, contentType: ContentType): Int =
+ when (contentType) {
+ ContentType.MOVIE -> movieDao.getCount(providerId).first()
+ ContentType.SERIES -> seriesDao.getCount(providerId).first()
+ else -> 0
+ }
+
+ private suspend fun currentStalkerCategoryCount(providerId: Long, contentType: ContentType, categoryId: Long): Int =
+ when (contentType) {
+ ContentType.MOVIE -> movieDao.getCountByCategory(providerId, categoryId).first()
+ ContentType.SERIES -> seriesDao.getCountByCategory(providerId, categoryId).first()
+ else -> 0
+ }
+
+ private suspend fun updateStalkerSummaryMetadata(
+ providerId: Long,
+ contentType: ContentType,
+ indexedRows: Int,
+ finalState: String,
+ now: Long
+ ) {
+ val metadata = syncMetadataRepository.getMetadata(providerId) ?: SyncMetadata(providerId)
+ when (contentType) {
+ ContentType.MOVIE -> syncMetadataRepository.updateMetadata(
+ metadata.copy(
+ lastMovieSync = now,
+ lastMovieAttempt = now,
+ lastMovieSuccess = if (finalState == "SUCCESS") now else metadata.lastMovieSuccess,
+ lastMoviePartial = if (finalState != "SUCCESS") now else metadata.lastMoviePartial,
+ movieCount = if (finalState == "SUCCESS") indexedRows else metadata.movieCount.coerceAtLeast(indexedRows),
+ movieCatalogStale = finalState != "SUCCESS",
+ movieSyncMode = VodSyncMode.PAGED
+ )
+ )
+ ContentType.SERIES -> syncMetadataRepository.updateMetadata(
+ metadata.copy(
+ lastSeriesSync = now,
+ lastSeriesSuccess = if (finalState == "SUCCESS") now else metadata.lastSeriesSuccess,
+ seriesCount = if (finalState == "SUCCESS") indexedRows else metadata.seriesCount.coerceAtLeast(indexedRows)
+ )
+ )
+ else -> Unit
+ }
+ }
+
private suspend fun processXtreamSummaryIndexSection(
provider: Provider,
api: XtreamProvider,
@@ -2032,16 +2802,85 @@ class SyncManager @Inject constructor(
}
if (shouldSyncEpgUpfront(provider)) {
- warnings += syncProviderEpg(
+ updateXtreamEpgJobState(
+ provider = provider,
+ state = "RUNNING",
+ now = now,
+ lastAttemptAt = now,
+ lastError = null
+ )
+ val epgResult = syncProviderEpg(
provider = provider,
metadata = metadata,
now = now,
force = force,
onProgress = onProgress
- ).warnings
+ )
+ val finishedAt = System.currentTimeMillis()
+ updateXtreamEpgJobState(
+ provider = provider,
+ state = when {
+ epgResult.warnings.isEmpty() -> "SUCCESS"
+ epgResult.hasRetryableFailure -> "FAILED_RETRYABLE"
+ else -> "PARTIAL"
+ },
+ now = finishedAt,
+ indexedRows = programDao.countByProvider(provider.id),
+ lastAttemptAt = now,
+ lastSuccessAt = finishedAt.takeIf { epgResult.warnings.isEmpty() },
+ lastError = epgResult.warnings.takeIf { it.isNotEmpty() }?.joinToString("; ")
+ )
+ warnings += epgResult.warnings
+ } else if (provider.epgSyncMode != ProviderEpgSyncMode.SKIP) {
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = "EPG",
+ state = "QUEUED",
+ now = now,
+ totalCategories = 1,
+ completedCategories = 0,
+ nextCategoryIndex = 0,
+ failedCategories = 0,
+ lastAttemptAt = now,
+ lastError = null
+ )
+ scheduleBackgroundEpgSync(provider.id)
}
- return if (warnings.isEmpty()) SyncOutcome() else SyncOutcome(partial = true, warnings = warnings)
+ return if (warnings.isEmpty()) SyncOutcome() else SyncOutcome(partial = true, warnings = warnings.distinct())
+ }
+
+ private suspend fun queueStalkerIndexSection(
+ providerId: Long,
+ contentType: ContentType,
+ totalCategories: Int,
+ now: Long
+ ) {
+ require(contentType == ContentType.MOVIE || contentType == ContentType.SERIES) {
+ "Unsupported Stalker index section: $contentType"
+ }
+ when (contentType) {
+ ContentType.MOVIE -> movieCategoryHydrationDao.deleteByProvider(providerId)
+ ContentType.SERIES -> seriesCategoryHydrationDao.deleteByProvider(providerId)
+ else -> Unit
+ }
+ xtreamContentIndexDao.markRowsStaleForProviderAndType(providerId, contentType.name)
+ upsertXtreamIndexJob(
+ providerId = providerId,
+ section = contentType.name,
+ state = "QUEUED",
+ now = now,
+ totalCategories = totalCategories,
+ completedCategories = 0,
+ nextCategoryIndex = 0,
+ failedCategories = 0,
+ indexedRows = 0,
+ skippedMalformedRows = 0,
+ deletedPrunedRows = 0,
+ clearPriority = true,
+ lastAttemptAt = now,
+ lastError = null
+ )
}
private suspend fun syncStalker(
@@ -2061,20 +2900,44 @@ class SyncManager @Inject constructor(
val now = System.currentTimeMillis()
if (force || ContentCachePolicy.shouldRefresh(metadata.lastLiveSuccess, ContentCachePolicy.CATALOG_TTL_MILLIS, now)) {
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = ContentType.LIVE.name,
+ state = "RUNNING",
+ now = now,
+ lastAttemptAt = now,
+ lastError = null
+ )
progress(provider.id, onProgress, "Downloading Live TV...")
val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()
val liveCatalogResult = syncStalkerLiveCatalogStaged(api, provider, hiddenLiveCategoryIds, onProgress)
+ val liveCategoryCount = categoryDao.getByProviderAndTypeSync(provider.id, ContentType.LIVE.name).size
+ val liveFinishedAt = System.currentTimeMillis()
metadata = metadata.copy(
lastLiveSync = now,
lastLiveSuccess = now,
liveCount = liveCatalogResult.acceptedCount
)
syncMetadataRepository.updateMetadata(metadata)
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = ContentType.LIVE.name,
+ state = "SUCCESS",
+ now = liveFinishedAt,
+ totalCategories = liveCategoryCount,
+ completedCategories = liveCategoryCount,
+ nextCategoryIndex = liveCategoryCount,
+ failedCategories = 0,
+ indexedRows = liveCatalogResult.acceptedCount,
+ lastAttemptAt = now,
+ lastSuccessAt = liveFinishedAt,
+ lastError = null
+ )
warnings += liveCatalogResult.warnings
}
if (force || ContentCachePolicy.shouldRefresh(metadata.lastMovieSuccess, ContentCachePolicy.CATALOG_TTL_MILLIS, now)) {
- progress(provider.id, onProgress, "Downloading Movies...")
+ progress(provider.id, onProgress, "Preparing Movies...")
val categories = requireResult(api.getVodCategories(), "Failed to load movie categories")
// Stalker uses lazy-by-category VoD loading — only categories are persisted up
// front. Using replaceMovieCatalog with an empty sequence would run full stale
@@ -2094,20 +2957,26 @@ class SyncManager @Inject constructor(
)
}
)
+ queueStalkerIndexSection(
+ providerId = provider.id,
+ contentType = ContentType.MOVIE,
+ totalCategories = categories.size,
+ now = now
+ )
metadata = metadata.copy(
lastMovieSync = now,
lastMovieAttempt = now,
- lastMovieSuccess = now,
- movieCount = 0,
- movieSyncMode = VodSyncMode.LAZY_BY_CATEGORY,
+ movieCount = movieDao.getCount(provider.id).first(),
+ movieSyncMode = VodSyncMode.PAGED,
movieWarningsCount = 0,
movieCatalogStale = true
)
syncMetadataRepository.updateMetadata(metadata)
+ scheduleStalkerIndexSync(provider.id, ContentType.MOVIE, force = force)
}
if (force || ContentCachePolicy.shouldRefresh(metadata.lastSeriesSuccess, ContentCachePolicy.CATALOG_TTL_MILLIS, now)) {
- progress(provider.id, onProgress, "Downloading Series...")
+ progress(provider.id, onProgress, "Preparing Series...")
val categories = requireResult(api.getSeriesCategories(), "Failed to load series categories")
// Same rationale as movies: use replaceCategories to avoid destroying any
// already-hydrated series rows when running a category-only Stalker sync.
@@ -2125,12 +2994,18 @@ class SyncManager @Inject constructor(
)
}
)
+ queueStalkerIndexSection(
+ providerId = provider.id,
+ contentType = ContentType.SERIES,
+ totalCategories = categories.size,
+ now = now
+ )
metadata = metadata.copy(
lastSeriesSync = now,
- lastSeriesSuccess = now,
- seriesCount = 0
+ seriesCount = seriesDao.getCount(provider.id).first()
)
syncMetadataRepository.updateMetadata(metadata)
+ scheduleStalkerIndexSync(provider.id, ContentType.SERIES, force = force)
}
if (shouldSyncEpgUpfront(provider)) {
@@ -2440,6 +3315,7 @@ class SyncManager @Inject constructor(
return listOf("Stalker portal guide sync skipped because no valid guide channel IDs were available.")
}
+ val previousProgramCount = programDao.countByProvider(provider.id)
val api = createStalkerSyncProvider(provider)
val aliasToChannelKey = buildMap {
guideRequests.forEach { request ->
@@ -2448,19 +3324,27 @@ class SyncManager @Inject constructor(
}
val failedChannels = mutableListOf<String>()
val insertBuffer = ArrayList<com.streamvault.data.local.entity.ProgramEntity>(STALKER_GUIDE_PROGRAM_BATCH_SIZE)
- var replacedExistingGuide = false
+ val replacedChannelKeys = linkedSetOf<String>()
val bulkCoveredChannelKeys = linkedSetOf<String>()
+ var importedProgramCount = 0
suspend fun flushPrograms() {
if (insertBuffer.isEmpty()) return
val chunk = insertBuffer.toList()
insertBuffer.clear()
transactionRunner.inTransaction {
- if (!replacedExistingGuide) {
- programDao.deleteByProvider(provider.id)
- replacedExistingGuide = true
+ chunk
+ .map { it.channelId }
+ .distinct()
+ .forEach { channelId ->
+ if (replacedChannelKeys.add(channelId)) {
+ programDao.deleteForChannel(provider.id, channelId)
+ }
+ }
+ if (chunk.isNotEmpty()) {
+ programDao.insertAll(chunk)
+ importedProgramCount += chunk.size
}
- programDao.insertAll(chunk)
}
}
@@ -2546,23 +3430,19 @@ class SyncManager @Inject constructor(
flushPrograms()
- if (!replacedExistingGuide && failedChannels.isNotEmpty()) {
+ if (replacedChannelKeys.isEmpty() && failedChannels.isNotEmpty()) {
return listOf(
"Stalker portal guide sync failed for all ${failedChannels.size} channels; keeping existing guide data."
)
}
- if (!replacedExistingGuide) {
- transactionRunner.inTransaction {
- programDao.deleteByProvider(provider.id)
- }
- }
-
val epgCount = programDao.countByProvider(provider.id)
+ val guideLooksHealthy = epgCount >= STALKER_MIN_HEALTHY_EPG_PROGRAMS || previousProgramCount == 0
+ val existingMetadata = syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id)
syncMetadataRepository.updateMetadata(
- (syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id)).copy(
+ existingMetadata.copy(
lastEpgSync = now,
- lastEpgSuccess = now,
+ lastEpgSuccess = if (guideLooksHealthy) now else existingMetadata.lastEpgSuccess,
epgCount = epgCount
)
)
@@ -2576,6 +3456,11 @@ class SyncManager @Inject constructor(
"Stalker portal guide imported $epgCount programs, but ${failedChannels.size} channels failed (${summarizeChannelNames(failedChannels)})."
)
}
+ if (!guideLooksHealthy && previousProgramCount >= STALKER_MIN_HEALTHY_EPG_PROGRAMS) {
+ warnings.add(
+ "Stalker portal guide import looked incomplete ($importedProgramCount programs across ${replacedChannelKeys.size} channels); preserved untouched prior guide data for the rest."
+ )
+ }
return warnings
}
@@ -2753,16 +3638,40 @@ class SyncManager @Inject constructor(
}
ProviderType.STALKER_PORTAL -> {
progress(provider.id, onProgress, "Retrying Live TV...")
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = ContentType.LIVE.name,
+ state = "RUNNING",
+ now = now,
+ lastAttemptAt = now,
+ lastError = null
+ )
val api = createStalkerSyncProvider(provider)
val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()
val liveCatalogResult = syncStalkerLiveCatalogStaged(api, provider, hiddenLiveCategoryIds, onProgress)
+ val liveCategoryCount = categoryDao.getByProviderAndTypeSync(provider.id, ContentType.LIVE.name).size
+ val liveFinishedAt = System.currentTimeMillis()
val metadata = (syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id))
.copy(
lastLiveSync = now,
lastLiveSuccess = now,
liveCount = liveCatalogResult.acceptedCount
- )
+ )
syncMetadataRepository.updateMetadata(metadata)
+ upsertXtreamIndexJob(
+ providerId = provider.id,
+ section = ContentType.LIVE.name,
+ state = "SUCCESS",
+ now = liveFinishedAt,
+ totalCategories = liveCategoryCount,
+ completedCategories = liveCategoryCount,
+ nextCategoryIndex = liveCategoryCount,
+ failedCategories = 0,
+ indexedRows = liveCatalogResult.acceptedCount,
+ lastAttemptAt = now,
+ lastSuccessAt = liveFinishedAt,
+ lastError = null
+ )
sectionWarnings += liveCatalogResult.warnings
}
}
@@ -2834,12 +3743,12 @@ class SyncManager @Inject constructor(
syncMetadataRepository.updateMetadata(metadata)
}
ProviderType.STALKER_PORTAL -> {
- progress(provider.id, onProgress, "Retrying Movies...")
+ progress(provider.id, onProgress, "Queueing Movies index...")
val api = createStalkerSyncProvider(provider)
val categories = requireResult(api.getVodCategories(), "Failed to load movie categories")
- val movies = loadStalkerMoviesByCategory(api, categories, onProgress)
- val acceptedCount = syncCatalogStore.replaceMovieCatalog(
+ syncCatalogStore.replaceCategories(
providerId = provider.id,
+ type = "MOVIE",
categories = categories.map { category ->
CategoryEntity(
providerId = provider.id,
@@ -2849,20 +3758,25 @@ class SyncManager @Inject constructor(
type = ContentType.MOVIE,
isAdult = category.isAdult
)
- },
- movies = movies.asSequence().map { it.toEntity() }
+ }
+ )
+ queueStalkerIndexSection(
+ providerId = provider.id,
+ contentType = ContentType.MOVIE,
+ totalCategories = categories.size,
+ now = now
)
val metadata = (syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id))
.copy(
lastMovieSync = now,
lastMovieAttempt = now,
- lastMovieSuccess = now,
- movieCount = acceptedCount,
- movieSyncMode = VodSyncMode.FULL,
+ movieCount = movieDao.getCount(provider.id).first(),
+ movieSyncMode = VodSyncMode.PAGED,
movieWarningsCount = 0,
- movieCatalogStale = false
+ movieCatalogStale = true
)
syncMetadataRepository.updateMetadata(metadata)
+ scheduleStalkerIndexSync(provider.id, ContentType.MOVIE, force = true)
}
}
return if (sectionWarnings.isEmpty()) SyncOutcome() else SyncOutcome(partial = true, warnings = sectionWarnings)
@@ -2911,12 +3825,12 @@ class SyncManager @Inject constructor(
Log.i(TAG, "Queued Xtream series index for provider ${provider.id}: $categoryCount categories.")
}
ProviderType.STALKER_PORTAL -> {
- progress(provider.id, onProgress, "Retrying Series...")
+ progress(provider.id, onProgress, "Queueing Series index...")
val api = createStalkerSyncProvider(provider)
val categories = requireResult(api.getSeriesCategories(), "Failed to load series categories")
- val series = loadStalkerSeriesByCategory(api, categories, onProgress)
- val acceptedCount = syncCatalogStore.replaceSeriesCatalog(
+ syncCatalogStore.replaceCategories(
providerId = provider.id,
+ type = "SERIES",
categories = categories.map { category ->
CategoryEntity(
providerId = provider.id,
@@ -2926,17 +3840,22 @@ class SyncManager @Inject constructor(
type = ContentType.SERIES,
isAdult = category.isAdult
)
- },
- series = series.asSequence().map { it.toEntity() }
+ }
)
val now = System.currentTimeMillis()
+ queueStalkerIndexSection(
+ providerId = provider.id,
+ contentType = ContentType.SERIES,
+ totalCategories = categories.size,
+ now = now
+ )
val metadata = (syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id))
.copy(
lastSeriesSync = now,
- lastSeriesSuccess = now,
- seriesCount = acceptedCount
+ seriesCount = seriesDao.getCount(provider.id).first()
)
syncMetadataRepository.updateMetadata(metadata)
+ scheduleStalkerIndexSync(provider.id, ContentType.SERIES, force = true)
}
ProviderType.M3U -> {
throw IllegalStateException("Series retry is unavailable for this provider")
diff --git a/data/src/test/java/com/streamvault/data/repository/MovieRepositoryImplTest.kt b/data/src/test/java/com/streamvault/data/repository/MovieRepositoryImplTest.kt
index 1b9032ef..34c55886 100644
--- a/data/src/test/java/com/streamvault/data/repository/MovieRepositoryImplTest.kt
+++ b/data/src/test/java/com/streamvault/data/repository/MovieRepositoryImplTest.kt
@@ -9,6 +9,7 @@ import com.streamvault.data.local.dao.MovieDao
import com.streamvault.data.local.dao.PlaybackHistoryDao
import com.streamvault.data.local.dao.ProviderDao
import com.streamvault.data.local.dao.XtreamContentIndexDao
+import com.streamvault.data.local.dao.XtreamIndexJobDao
import com.streamvault.data.local.DatabaseTransactionRunner
import com.streamvault.data.local.entity.FavoriteEntity
import com.streamvault.data.local.entity.MovieBrowseEntity
@@ -73,6 +74,7 @@ class MovieRepositoryImplTest {
private val movieCategoryHydrationDao: MovieCategoryHydrationDao = mock()
private val syncMetadataRepository: SyncMetadataRepository = mock()
private val xtreamContentIndexDao: XtreamContentIndexDao = mock()
+ private val xtreamIndexJobDao: XtreamIndexJobDao = mock()
private val syncManager: SyncManager = mock()
private val credentialCrypto = object : CredentialCrypto {
override fun encryptIfNeeded(value: String): String = value
@@ -611,6 +613,7 @@ class MovieRepositoryImplTest {
movieCategoryHydrationDao = movieCategoryHydrationDao,
syncMetadataRepository = syncMetadataRepository,
xtreamContentIndexDao = xtreamContentIndexDao,
+ xtreamIndexJobDao = xtreamIndexJobDao,
syncManager = syncManager,
transactionRunner = transactionRunner
)
diff --git a/data/src/test/java/com/streamvault/data/repository/SeriesRepositoryImplTest.kt b/data/src/test/java/com/streamvault/data/repository/SeriesRepositoryImplTest.kt
index fbd5ca24..6966fcbc 100644
--- a/data/src/test/java/com/streamvault/data/repository/SeriesRepositoryImplTest.kt
+++ b/data/src/test/java/com/streamvault/data/repository/SeriesRepositoryImplTest.kt
@@ -10,6 +10,7 @@ import com.streamvault.data.local.dao.ProviderDao
import com.streamvault.data.local.dao.SeriesDao
import com.streamvault.data.local.dao.SeriesCategoryHydrationDao
import com.streamvault.data.local.dao.XtreamContentIndexDao
+import com.streamvault.data.local.dao.XtreamIndexJobDao
import com.streamvault.data.local.entity.EpisodeBrowseEntity
import com.streamvault.data.local.entity.EpisodeEntity
import com.streamvault.data.local.entity.SeriesEntity
@@ -75,6 +76,7 @@ class SeriesRepositoryImplTest {
private val xtreamStreamUrlResolver: XtreamStreamUrlResolver = mock()
private val seriesCategoryHydrationDao: SeriesCategoryHydrationDao = mock()
private val xtreamContentIndexDao: XtreamContentIndexDao = mock()
+ private val xtreamIndexJobDao: XtreamIndexJobDao = mock()
private val syncManager: SyncManager = mock()
private val credentialCrypto = object : CredentialCrypto {
override fun encryptIfNeeded(value: String): String = value
@@ -614,6 +616,7 @@ class SeriesRepositoryImplTest {
preferencesRepository = preferencesRepository,
xtreamStreamUrlResolver = xtreamStreamUrlResolver,
xtreamContentIndexDao = xtreamContentIndexDao,
+ xtreamIndexJobDao = xtreamIndexJobDao,
syncManager = syncManager,
seriesCategoryHydrationDao = seriesCategoryHydrationDao
)
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 678b420b..1d05d86b 100644
--- a/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt
+++ b/data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt
@@ -10,9 +10,11 @@ import com.streamvault.data.local.dao.CatalogSyncDao
import com.streamvault.data.local.dao.ChannelStageCategorySummary
import com.streamvault.data.local.dao.CategoryDao
import com.streamvault.data.local.dao.ChannelDao
+import com.streamvault.data.local.dao.MovieCategoryHydrationDao
import com.streamvault.data.local.dao.MovieDao
import com.streamvault.data.local.dao.ProgramDao
import com.streamvault.data.local.dao.ProviderDao
+import com.streamvault.data.local.dao.SeriesCategoryHydrationDao
import com.streamvault.data.local.dao.SeriesDao
import com.streamvault.data.local.dao.TmdbIdentityDao
import com.streamvault.data.local.dao.XtreamContentIndexDao
@@ -207,6 +209,8 @@ class SyncManagerTest {
private val xtreamContentIndexDao: XtreamContentIndexDao = mock()
private val xtreamIndexJobDao: XtreamIndexJobDao = mock()
private val xtreamLiveOnboardingDao: XtreamLiveOnboardingDao = mock()
+ private val movieCategoryHydrationDao: MovieCategoryHydrationDao = mock()
+ private val seriesCategoryHydrationDao: SeriesCategoryHydrationDao = mock()
private val epgRepo: EpgRepository = mock()
private val epgSourceRepo: EpgSourceRepository = mock()
private val preferencesRepo: PreferencesRepository = mock()
@@ -269,8 +273,12 @@ class SyncManagerTest {
runBlocking {
org.mockito.kotlin.whenever(categoryDao.getByProviderAndTypeSync(any(), any())).thenReturn(emptyList())
org.mockito.kotlin.whenever(channelDao.getByProviderSync(any())).thenReturn(emptyList())
+ org.mockito.kotlin.whenever(movieDao.getCount(any())).thenReturn(flowOf(0))
+ org.mockito.kotlin.whenever(movieDao.getCountByCategory(any(), any())).thenReturn(flowOf(0))
org.mockito.kotlin.whenever(movieDao.getByProviderSync(any())).thenReturn(emptyList())
org.mockito.kotlin.whenever(movieDao.getTmdbIdsByProvider(any())).thenReturn(emptyList())
+ org.mockito.kotlin.whenever(seriesDao.getCount(any())).thenReturn(flowOf(0))
+ org.mockito.kotlin.whenever(seriesDao.getCountByCategory(any(), any())).thenReturn(flowOf(0))
org.mockito.kotlin.whenever(seriesDao.getByProviderSync(any())).thenReturn(emptyList())
org.mockito.kotlin.whenever(seriesDao.getTmdbIdsByProvider(any())).thenReturn(emptyList())
org.mockito.kotlin.whenever(catalogSyncDao.getCategoryStages(any(), any(), any())).thenReturn(emptyList())
@@ -317,6 +325,8 @@ class SyncManagerTest {
seriesDao = seriesDao,
programDao = programDao,
categoryDao = categoryDao,
+ movieCategoryHydrationDao = movieCategoryHydrationDao,
+ seriesCategoryHydrationDao = seriesCategoryHydrationDao,
catalogSyncDao = catalogSyncDao,
tmdbIdentityDao = tmdbIdentityDao,
xtreamContentIndexDao = xtreamContentIndexDao,
@@ -1251,9 +1261,21 @@ class SyncManagerTest {
assertThat(result).isInstanceOf(Result.Success::class.java)
val metadata = syncMetadataRepo.getMetadata(1L)
- assertThat(metadata?.movieSyncMode).isEqualTo(com.streamvault.domain.model.VodSyncMode.LAZY_BY_CATEGORY)
+ assertThat(metadata?.movieSyncMode).isEqualTo(com.streamvault.domain.model.VodSyncMode.PAGED)
assertThat(metadata?.movieCount).isEqualTo(0)
assertThat(metadata?.seriesCount).isEqualTo(0)
+ val queuedJobCaptor = argumentCaptor<XtreamIndexJobEntity>()
+ verify(xtreamIndexJobDao, atLeastOnce()).upsert(queuedJobCaptor.capture())
+ assertThat(queuedJobCaptor.allValues.any { job ->
+ job.providerId == 1L &&
+ job.section == ContentType.MOVIE.name &&
+ job.state == "QUEUED"
+ }).isTrue()
+ assertThat(queuedJobCaptor.allValues.any { job ->
+ job.providerId == 1L &&
+ job.section == ContentType.SERIES.name &&
+ job.state == "QUEUED"
+ }).isTrue()
verify(stalkerApiService).getVodCategories(any(), any())
verify(stalkerApiService).getSeriesCategories(any(), any())
verify(stalkerApiService).streamLiveStreams(any(), any(), any())