StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Add stalker improvements
David Nashashcb02f1b5367b
diff --git a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt b/app/src/main/java/com/streamvault/app/di/DatabaseModule.ktindex c3285a66..3b9e7e53 100644--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt@@ -93,7 +93,9 @@ object DatabaseModule {StreamVaultDatabase.MIGRATION_51_52,StreamVaultDatabase.MIGRATION_52_53,StreamVaultDatabase.MIGRATION_53_54,- StreamVaultDatabase.MIGRATION_54_55+ StreamVaultDatabase.MIGRATION_54_55,+ StreamVaultDatabase.MIGRATION_55_56,+ StreamVaultDatabase.MIGRATION_56_57)// 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/player/PlayerPlaybackProbeSupport.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupport.ktindex d480f3b4..404601ff 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupport.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupport.kt@@ -1,5 +1,9 @@package com.streamvault.app.ui.screens.player+import com.streamvault.domain.model.ProviderType+import java.net.URI+import java.util.Locale+internal data class PlaybackProbeFailure(val message: String,val recoveryType: PlayerRecoveryType@@ -33,3 +37,21 @@ internal fun resolvePlaybackProbeFailure(responseCode: Int): PlaybackProbeFailurelse -> null}++internal fun shouldSkipPlaybackProbe(+ providerType: ProviderType,+ url: String+): Boolean {+ if (providerType != ProviderType.STALKER_PORTAL) {+ return false+ }+ val normalizedPath = runCatching {+ URI(url).path?.lowercase(Locale.ROOT).orEmpty()+ }.getOrDefault("")+ val normalizedQuery = runCatching {+ URI(url).query?.lowercase(Locale.ROOT).orEmpty()+ }.getOrDefault("")+ return normalizedPath.endsWith("/play/live.php") ||+ normalizedPath.endsWith("/play/movie.php") ||+ "play_token=" in normalizedQuery+}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex d2f18ba2..c1b3d968 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.screens.playerimport android.os.SystemClock+import android.util.Logimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScopeimport com.streamvault.app.cast.CastConnectionState@@ -100,6 +101,7 @@ class PlayerViewModel @Inject constructor(private val okHttpClient: OkHttpClient,) : ViewModel() {companion object {+ private const val TAG = "PlayerViewModel"private const val MAX_PROGRAM_HISTORY_ITEMS = 18private const val MAX_UPCOMING_PROGRAM_ITEMS = 24private const val PLAYER_EPG_REFRESH_INTERVAL_MS = 30_000L@@ -1166,7 +1168,26 @@ class PlayerViewModel @Inject constructor(private suspend fun probePlaybackUrl(streamInfo: com.streamvault.domain.model.StreamInfo): PlaybackProbeFailure? {val url = streamInfo.url- if (!shouldProbePlaybackUrl(url)) return null+ val providerId = currentProviderId.takeIf { it > 0L } ?: return null+ val provider = providerRepository.getProvider(providerId) ?: return null+ if (!shouldProbePlaybackUrl(url, provider)) return null+ if (shouldSkipPlaybackProbe(provider.type, url)) {+ Log.i(+ TAG,+ "Skipping playback probe provider=${provider.type.name} host=${runCatching { java.net.URI(url).host }.getOrNull().orEmpty()} " ++ "path=${runCatching { java.net.URI(url).path }.getOrNull().orEmpty()} reason=single-use-temp-link"+ )+ return null+ }++ Log.d(+ TAG,+ "Playback probe request provider=${provider.type.name} host=${runCatching { java.net.URI(url).host }.getOrNull().orEmpty()} " ++ "path=${runCatching { java.net.URI(url).path }.getOrNull().orEmpty()} range=true " ++ "ua=${!streamInfo.userAgent.isNullOrBlank()} referer=${streamInfo.headers.containsKey("Referer")} " ++ "cookie=${streamInfo.headers.containsKey("Cookie")} auth=${streamInfo.headers.containsKey("Authorization")} " ++ "xua=${streamInfo.headers.containsKey("X-User-Agent")}"+ )return runCatching {withContext(Dispatchers.IO) {@@ -1188,10 +1209,11 @@ class PlayerViewModel @Inject constructor(}.getOrNull()}- private suspend fun shouldProbePlaybackUrl(url: String): Boolean {+ private fun shouldProbePlaybackUrl(+ url: String,+ provider: com.streamvault.domain.model.Provider+ ): Boolean {if (!url.startsWith("http://") && !url.startsWith("https://")) return false- val providerId = currentProviderId.takeIf { it > 0L } ?: return false- val provider = providerRepository.getProvider(providerId) ?: return falseval cacheKey = resolvePlaybackProbeCacheKey(currentStreamUrl = currentStreamUrl,url = urldiff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.ktindex 154252db..bd69ab82 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt@@ -763,9 +763,18 @@ class ProviderSetupViewModel @Inject constructor(result.message.contains("stricter MAG emulation", ignoreCase = true) ->"Portal requires stricter MAG emulation - keep the MAC and advanced device identity fields aligned with the working device"+ result.message.contains("legacy MAG recipe", ignoreCase = true) ->+ "Portal matched a legacy MAG recipe and was retried automatically, but playback still failed"++ result.message.contains("rediscovery attempted", ignoreCase = true) ->+ "The saved Stalker portal recipe failed, and the app already retried discovery automatically"+result.message.contains("unsupported portal profile", ignoreCase = true) ->"Portal authenticated, but this Stalker profile is not supported yet"+ result.message.contains("no working recipe succeeded", ignoreCase = true) ->+ "Portal family was detected, but none of the known Stalker recipes worked for this connection"+failure.hasCause<CredentialDecryptionException>() ->failure.findCause<CredentialDecryptionException>()?.message?: CredentialDecryptionException.MESSAGEdiff --git a/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupportTest.kt b/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupportTest.ktindex 12374ea9..aadb2b71 100644--- a/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupportTest.kt+++ b/app/src/test/java/com/streamvault/app/ui/screens/player/PlayerPlaybackProbeSupportTest.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.screens.playerimport com.google.common.truth.Truth.assertThat+import com.streamvault.domain.model.ProviderTypeimport org.junit.Testclass PlayerPlaybackProbeSupportTest {@@ -13,4 +14,24 @@ class PlayerPlaybackProbeSupportTest {assertThat(failure?.recoveryType).isEqualTo(PlayerRecoveryType.SOURCE)assertThat(failure?.message).contains("empty temporary link")}++ @Test+ fun `stalker temp-link playback probe is skipped`() {+ val skipped = shouldSkipPlaybackProbe(+ providerType = ProviderType.STALKER_PORTAL,+ url = "http://fdox.org:8080/play/live.php?mac=00:1A:79:BA:73:FA&stream=228556&extension=ts&play_token=abc123"+ )++ assertThat(skipped).isTrue()+ }++ @Test+ fun `non stalker playback probe is not skipped`() {+ val skipped = shouldSkipPlaybackProbe(+ providerType = ProviderType.XTREAM_CODES,+ url = "http://fdox.org:8080/play/live.php?stream=228556"+ )++ assertThat(skipped).isFalse()+ }}diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/56.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/56.jsonnew file mode 100644index 00000000..17653564--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/56.json@@ -0,0 +1,5158 @@+{+ "formatVersion": 1,+ "database": {+ "version": 56,+ "identityHash": "029600eb5e91fa0afefd95811b871f31",+ "entities": [+ {+ "tableName": "providers",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `server_url` TEXT NOT NULL, `username` TEXT NOT NULL, `password` TEXT NOT NULL, `m3u_url` TEXT NOT NULL, `epg_url` TEXT NOT NULL, `http_user_agent` TEXT NOT NULL, `http_headers` TEXT NOT NULL, `stalker_mac_address` TEXT NOT NULL, `stalker_device_profile` TEXT NOT NULL, `stalker_device_timezone` TEXT NOT NULL, `stalker_device_locale` TEXT NOT NULL, `stalker_serial_number` TEXT NOT NULL, `stalker_device_id` TEXT NOT NULL, `stalker_device_id2` TEXT NOT NULL, `stalker_signature` TEXT NOT NULL, `stalker_auth_mode` TEXT NOT NULL, `stalker_portal_profile` TEXT NOT NULL, `stalker_portal_fingerprint` TEXT NOT NULL, `stalker_mag_preset` TEXT NOT NULL, `stalker_last_bootstrap_recipe` TEXT NOT NULL, `stalker_last_playback_mode` TEXT, `stalker_credentials_required` INTEGER NOT NULL, `stalker_mac_required` INTEGER NOT NULL, `stalker_uses_temp_links` INTEGER NOT NULL, `stalker_module_restricted` INTEGER NOT NULL, `stalker_strict_fingerprint_required` INTEGER NOT NULL, `stalker_recipe_fallback_used` INTEGER NOT NULL, `stalker_recipe_rediscovery_attempts` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `epg_sync_mode` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `xtream_live_sync_mode` TEXT NOT NULL, `m3u_vod_classification_enabled` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "serverUrl",+ "columnName": "server_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "username",+ "columnName": "username",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "password",+ "columnName": "password",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uUrl",+ "columnName": "m3u_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgUrl",+ "columnName": "epg_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "httpUserAgent",+ "columnName": "http_user_agent",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "httpHeaders",+ "columnName": "http_headers",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMacAddress",+ "columnName": "stalker_mac_address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceProfile",+ "columnName": "stalker_device_profile",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceTimezone",+ "columnName": "stalker_device_timezone",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceLocale",+ "columnName": "stalker_device_locale",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerSerialNumber",+ "columnName": "stalker_serial_number",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceId",+ "columnName": "stalker_device_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceId2",+ "columnName": "stalker_device_id2",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerSignature",+ "columnName": "stalker_signature",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerAuthMode",+ "columnName": "stalker_auth_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPortalProfile",+ "columnName": "stalker_portal_profile",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPortalFingerprint",+ "columnName": "stalker_portal_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMagPreset",+ "columnName": "stalker_mag_preset",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerLastBootstrapRecipe",+ "columnName": "stalker_last_bootstrap_recipe",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerLastPlaybackMode",+ "columnName": "stalker_last_playback_mode",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "stalkerCredentialsRequired",+ "columnName": "stalker_credentials_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMacRequired",+ "columnName": "stalker_mac_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerUsesTemporaryLinks",+ "columnName": "stalker_uses_temp_links",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerModuleRestricted",+ "columnName": "stalker_module_restricted",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerStrictFingerprintRequired",+ "columnName": "stalker_strict_fingerprint_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerRecipeFallbackUsed",+ "columnName": "stalker_recipe_fallback_used",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerRecipeRediscoveryAttempts",+ "columnName": "stalker_recipe_rediscovery_attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isActive",+ "columnName": "is_active",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "maxConnections",+ "columnName": "max_connections",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "expirationDate",+ "columnName": "expiration_date",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "apiVersion",+ "columnName": "api_version",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "allowedOutputFormatsJson",+ "columnName": "allowed_output_formats_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSyncMode",+ "columnName": "epg_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "xtreamFastSyncEnabled",+ "columnName": "xtream_fast_sync_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xtreamLiveSyncMode",+ "columnName": "xtream_live_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uVodClassificationEnabled",+ "columnName": "m3u_vod_classification_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncedAt",+ "columnName": "last_synced_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_providers_server_url_username_stalker_mac_address",+ "unique": true,+ "columnNames": [+ "server_url",+ "username",+ "stalker_mac_address"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username_stalker_mac_address` ON `${TABLE_NAME}` (`server_url`, `username`, `stalker_mac_address`)"+ }+ ]+ },+ {+ "tableName": "channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "qualityOptionsJson",+ "columnName": "quality_options_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channels_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_channels_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_channels_logical_group_id",+ "unique": false,+ "columnNames": [+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id_logical_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_preferences",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `audio_video_offset_ms` INTEGER, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`channel_id`) REFERENCES `channels`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "aspectRatio",+ "columnName": "aspect_ratio",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "audioVideoOffsetMs",+ "columnName": "audio_video_offset_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_preferences_channel_id",+ "unique": true,+ "columnNames": [+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_preferences_channel_id` ON `${TABLE_NAME}` (`channel_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "channels",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "channel_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channels_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`channels`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "channels",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_UPDATE BEFORE UPDATE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_DELETE BEFORE DELETE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_UPDATE AFTER UPDATE ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_INSERT AFTER INSERT ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "movies",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_movies_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movies_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_movies_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_movies_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_movies_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_added_at_release_date_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "added_at",+ "release_date",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_added_at_release_date_name_id` ON `${TABLE_NAME}` (`provider_id`, `added_at`, `release_date`, `name`, `id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movies_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`movies`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "movies",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_UPDATE BEFORE UPDATE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_DELETE BEFORE DELETE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_UPDATE AFTER UPDATE ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_INSERT AFTER INSERT ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "series",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_series_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_series_provider_id_series_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_series_provider_id_series_id` ON `${TABLE_NAME}` (`provider_id`, `series_id`)"+ },+ {+ "name": "index_series_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_last_modified_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "last_modified",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_last_modified_name_id` ON `${TABLE_NAME}` (`provider_id`, `last_modified`, `name`, `id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "series",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "episodes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "episodeId",+ "columnName": "episode_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "coverUrl",+ "columnName": "cover_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_episodes_series_id",+ "unique": false,+ "columnNames": [+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"+ },+ {+ "name": "index_episodes_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_episodes_provider_id_episode_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "episode_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "series",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "series_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "categories",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_categories_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_categories_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ },+ {+ "name": "index_categories_provider_id_category_id_type",+ "unique": true,+ "columnNames": [+ "provider_id",+ "category_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channel_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movie_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `provider_series_key` TEXT NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `provider_series_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerSeriesKey",+ "columnName": "provider_series_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "provider_series_key"+ ]+ },+ "indices": [+ {+ "name": "index_series_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "category_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "category_id",+ "type"+ ]+ },+ "indices": [+ {+ "name": "index_category_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_category_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ },+ {+ "name": "index_category_import_stage_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "programs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "hasArchive",+ "columnName": "has_archive",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_programs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_programs_provider_id_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_end_time_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "end_time",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_end_time_channel_id` ON `${TABLE_NAME}` (`provider_id`, `end_time`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_start_time_end_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_programs_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_start_time` ON `${TABLE_NAME}` (`start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`, `end_time`)"+ }+ ]+ },+ {+ "tableName": "favorites",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `group_key` INTEGER NOT NULL, `added_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`group_id`) REFERENCES `virtual_groups`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "groupId",+ "columnName": "group_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "groupKey",+ "columnName": "group_key",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_favorites_provider_id_content_id_content_type_group_key",+ "unique": true,+ "columnNames": [+ "provider_id",+ "content_id",+ "content_type",+ "group_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_provider_id_content_id_content_type_group_key` ON `${TABLE_NAME}` (`provider_id`, `content_id`, `content_type`, `group_key`)"+ },+ {+ "name": "index_favorites_provider_id_content_type_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_provider_id_content_type_group_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `group_id`)"+ },+ {+ "name": "index_favorites_group_id_position",+ "unique": false,+ "columnNames": [+ "group_id",+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_group_id_position` ON `${TABLE_NAME}` (`group_id`, `position`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "virtual_groups",+ "onDelete": "SET NULL",+ "onUpdate": "NO ACTION",+ "columns": [+ "group_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "virtual_groups",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconEmoji",+ "columnName": "icon_emoji",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_virtual_groups_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_virtual_groups_position",+ "unique": false,+ "columnNames": [+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_position` ON `${TABLE_NAME}` (`position`)"+ },+ {+ "name": "index_virtual_groups_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_content_type` ON `${TABLE_NAME}` (`content_type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "playback_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `poster_url` TEXT, `stream_url` TEXT NOT NULL, `resume_position_ms` INTEGER NOT NULL, `total_duration_ms` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `watched_status` TEXT NOT NULL, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resumePositionMs",+ "columnName": "resume_position_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalDurationMs",+ "columnName": "total_duration_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchedStatus",+ "columnName": "watched_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_history_content_id_content_type_provider_id",+ "unique": true,+ "columnNames": [+ "content_id",+ "content_type",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_history_content_id_content_type_provider_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `provider_id`)"+ },+ {+ "name": "index_playback_history_last_watched_at",+ "unique": false,+ "columnNames": [+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_last_watched_at` ON `${TABLE_NAME}` (`last_watched_at`)"+ },+ {+ "name": "index_playback_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `content_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_last_watched_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_last_watched_at` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `last_watched_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "tmdb_identity",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tmdb_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `canonical_provider_id` INTEGER NOT NULL, `first_seen_at` INTEGER NOT NULL, PRIMARY KEY(`tmdb_id`, `content_type`), FOREIGN KEY(`canonical_provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "canonicalProviderId",+ "columnName": "canonical_provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "firstSeenAt",+ "columnName": "first_seen_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "tmdb_id",+ "content_type"+ ]+ },+ "indices": [+ {+ "name": "index_tmdb_identity_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_content_type` ON `${TABLE_NAME}` (`content_type`)"+ },+ {+ "name": "index_tmdb_identity_canonical_provider_id",+ "unique": false,+ "columnNames": [+ "canonical_provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_canonical_provider_id` ON `${TABLE_NAME}` (`canonical_provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "canonical_provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "search_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `content_scope` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `used_at` INTEGER NOT NULL, `use_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "query",+ "columnName": "query",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentScope",+ "columnName": "content_scope",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "usedAt",+ "columnName": "used_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "useCount",+ "columnName": "use_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_search_history_content_scope_provider_id_used_at",+ "unique": false,+ "columnNames": [+ "content_scope",+ "provider_id",+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_content_scope_provider_id_used_at` ON `${TABLE_NAME}` (`content_scope`, `provider_id`, `used_at`)"+ },+ {+ "name": "index_search_history_used_at",+ "unique": false,+ "columnNames": [+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_used_at` ON `${TABLE_NAME}` (`used_at`)"+ },+ {+ "name": "index_search_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_search_history_query_content_scope_provider_id",+ "unique": true,+ "columnNames": [+ "query",+ "content_scope",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_search_history_query_content_scope_provider_id` ON `${TABLE_NAME}` (`query`, `content_scope`, `provider_id`)"+ }+ ]+ },+ {+ "tableName": "sync_metadata",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_live_success` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_series_success` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_epg_success` INTEGER NOT NULL, `last_movie_attempt` INTEGER NOT NULL, `last_movie_success` INTEGER NOT NULL, `last_movie_partial` INTEGER NOT NULL, `live_count` INTEGER NOT NULL, `movie_count` INTEGER NOT NULL, `series_count` INTEGER NOT NULL, `epg_count` INTEGER NOT NULL, `last_sync_status` TEXT NOT NULL, `movie_sync_mode` TEXT NOT NULL, `movie_warnings_count` INTEGER NOT NULL, `movie_catalog_stale` INTEGER NOT NULL, `live_avoid_full_until` INTEGER NOT NULL, `movie_avoid_full_until` INTEGER NOT NULL, `series_avoid_full_until` INTEGER NOT NULL, `live_sequential_failures_remembered` INTEGER NOT NULL, `live_healthy_sync_streak` INTEGER NOT NULL, `movie_parallel_failures_remembered` INTEGER NOT NULL, `movie_healthy_sync_streak` INTEGER NOT NULL, `series_sequential_failures_remembered` INTEGER NOT NULL, `series_healthy_sync_streak` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSync",+ "columnName": "last_live_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSuccess",+ "columnName": "last_live_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSync",+ "columnName": "last_movie_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSync",+ "columnName": "last_series_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSuccess",+ "columnName": "last_series_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSync",+ "columnName": "last_epg_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSuccess",+ "columnName": "last_epg_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieAttempt",+ "columnName": "last_movie_attempt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSuccess",+ "columnName": "last_movie_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMoviePartial",+ "columnName": "last_movie_partial",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveCount",+ "columnName": "live_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCount",+ "columnName": "movie_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesCount",+ "columnName": "series_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgCount",+ "columnName": "epg_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncStatus",+ "columnName": "last_sync_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieSyncMode",+ "columnName": "movie_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieWarningsCount",+ "columnName": "movie_warnings_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCatalogStale",+ "columnName": "movie_catalog_stale",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveAvoidFullUntil",+ "columnName": "live_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieAvoidFullUntil",+ "columnName": "movie_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesAvoidFullUntil",+ "columnName": "series_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveSequentialFailuresRemembered",+ "columnName": "live_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveHealthySyncStreak",+ "columnName": "live_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieParallelFailuresRemembered",+ "columnName": "movie_parallel_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieHealthySyncStreak",+ "columnName": "movie_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesSequentialFailuresRemembered",+ "columnName": "series_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesHealthySyncStreak",+ "columnName": "series_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `etag` TEXT, `last_modified_header` TEXT)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "url",+ "columnName": "url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastRefreshAt",+ "columnName": "last_refresh_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "etag",+ "columnName": "etag",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModifiedHeader",+ "columnName": "last_modified_header",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_sources_url",+ "unique": true,+ "columnNames": [+ "url"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_sources_url` ON `${TABLE_NAME}` (`url`)"+ }+ ]+ },+ {+ "tableName": "provider_epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `epg_source_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_epg_sources_provider_id_epg_source_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_epg_sources_provider_id_epg_source_id` ON `${TABLE_NAME}` (`provider_id`, `epg_source_id`)"+ },+ {+ "name": "index_provider_epg_sources_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_epg_sources_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `display_name` TEXT NOT NULL, `normalized_name` TEXT NOT NULL, `icon_url` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "normalizedName",+ "columnName": "normalized_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconUrl",+ "columnName": "icon_url",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_channels_epg_source_id_xmltv_channel_id",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id_xmltv_channel_id` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`)"+ },+ {+ "name": "index_epg_channels_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_channels_normalized_name",+ "unique": false,+ "columnNames": [+ "normalized_name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_normalized_name` ON `${TABLE_NAME}` (`normalized_name`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_programmes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `title` TEXT NOT NULL, `subtitle` TEXT, `description` TEXT NOT NULL, `category` TEXT, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `episode_info` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "subtitle",+ "columnName": "subtitle",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeInfo",+ "columnName": "episode_info",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_programmes_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_start_time` ON `${TABLE_NAME}` (`start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_epg_mappings",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_channel_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `source_type` TEXT NOT NULL, `epg_source_id` INTEGER, `xmltv_channel_id` TEXT, `match_type` TEXT, `confidence` REAL NOT NULL, `matched_at` INTEGER NOT NULL, `failed_attempts` INTEGER NOT NULL, `source` TEXT, `is_manual_override` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerChannelId",+ "columnName": "provider_channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "matchType",+ "columnName": "match_type",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "confidence",+ "columnName": "confidence",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "matchedAt",+ "columnName": "matched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedAttempts",+ "columnName": "failed_attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "source",+ "columnName": "source",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isManualOverride",+ "columnName": "is_manual_override",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_epg_mappings_provider_id_provider_channel_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "provider_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id_provider_channel_id` ON `${TABLE_NAME}` (`provider_id`, `provider_channel_id`)"+ },+ {+ "name": "index_channel_epg_mappings_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "combined_m3u_profiles",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "combined_m3u_profile_members",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `profile_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`profile_id`) REFERENCES `combined_m3u_profiles`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "profileId",+ "columnName": "profile_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_combined_m3u_profile_members_profile_id",+ "unique": false,+ "columnNames": [+ "profile_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id` ON `${TABLE_NAME}` (`profile_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_profile_id_provider_id",+ "unique": true,+ "columnNames": [+ "profile_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id_provider_id` ON `${TABLE_NAME}` (`profile_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "combined_m3u_profiles",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "profile_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_schedules",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `requested_start_ms` INTEGER NOT NULL, `requested_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `enabled` INTEGER NOT NULL, `is_manual` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "requestedStartMs",+ "columnName": "requested_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "requestedEndMs",+ "columnName": "requested_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isManual",+ "columnName": "is_manual",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_schedules_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_schedules_enabled_requested_start_ms",+ "unique": false,+ "columnNames": [+ "enabled",+ "requested_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_enabled_requested_start_ms` ON `${TABLE_NAME}` (`enabled`, `requested_start_ms`)"+ },+ {+ "name": "index_recording_schedules_recurring_rule_id",+ "unique": false,+ "columnNames": [+ "recurring_rule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_recurring_rule_id` ON `${TABLE_NAME}` (`recurring_rule_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_runs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `schedule_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `scheduled_start_ms` INTEGER NOT NULL, `scheduled_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `status` TEXT NOT NULL, `source_type` TEXT NOT NULL, `resolved_url` TEXT, `headers_json` TEXT NOT NULL, `user_agent` TEXT, `expiration_time` INTEGER, `provider_label` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `bytes_written` INTEGER NOT NULL, `average_throughput_bps` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `last_progress_at_ms` INTEGER, `failure_category` TEXT NOT NULL, `failure_reason` TEXT, `terminal_at_ms` INTEGER, `started_at_ms` INTEGER, `ended_at_ms` INTEGER, `schedule_enabled` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `alarm_start_at_ms` INTEGER, `alarm_stop_at_ms` INTEGER, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`schedule_id`) REFERENCES `recording_schedules`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "scheduleId",+ "columnName": "schedule_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "scheduledStartMs",+ "columnName": "scheduled_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "scheduledEndMs",+ "columnName": "scheduled_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolvedUrl",+ "columnName": "resolved_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "headersJson",+ "columnName": "headers_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "userAgent",+ "columnName": "user_agent",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "expirationTime",+ "columnName": "expiration_time",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "providerLabel",+ "columnName": "provider_label",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputUri",+ "columnName": "output_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDisplayPath",+ "columnName": "output_display_path",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bytesWritten",+ "columnName": "bytes_written",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "averageThroughputBytesPerSecond",+ "columnName": "average_throughput_bps",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryCount",+ "columnName": "retry_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastProgressAtMs",+ "columnName": "last_progress_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "failureCategory",+ "columnName": "failure_category",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureReason",+ "columnName": "failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "terminalAtMs",+ "columnName": "terminal_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "startedAtMs",+ "columnName": "started_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "endedAtMs",+ "columnName": "ended_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "scheduleEnabled",+ "columnName": "schedule_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "alarmStartAtMs",+ "columnName": "alarm_start_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "alarmStopAtMs",+ "columnName": "alarm_stop_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_runs_schedule_id",+ "unique": false,+ "columnNames": [+ "schedule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_schedule_id` ON `${TABLE_NAME}` (`schedule_id`)"+ },+ {+ "name": "index_recording_runs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_runs_status_scheduled_start_ms",+ "unique": false,+ "columnNames": [+ "status",+ "scheduled_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_status_scheduled_start_ms` ON `${TABLE_NAME}` (`status`, `scheduled_start_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_start_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_start_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_start_at_ms` ON `${TABLE_NAME}` (`alarm_start_at_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_stop_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_stop_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_stop_at_ms` ON `${TABLE_NAME}` (`alarm_stop_at_ms`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "recording_schedules",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "schedule_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "program_reminders",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `channel_name` TEXT NOT NULL, `program_title` TEXT NOT NULL, `program_start_time` INTEGER NOT NULL, `remind_at` INTEGER NOT NULL, `lead_time_minutes` INTEGER NOT NULL, `is_dismissed` INTEGER NOT NULL, `notified_at` INTEGER, `created_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programStartTime",+ "columnName": "program_start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remindAt",+ "columnName": "remind_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "leadTimeMinutes",+ "columnName": "lead_time_minutes",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isDismissed",+ "columnName": "is_dismissed",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "notifiedAt",+ "columnName": "notified_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_program_reminders_provider_id_remind_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_remind_at` ON `${TABLE_NAME}` (`provider_id`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_is_dismissed_notified_at_remind_at",+ "unique": false,+ "columnNames": [+ "is_dismissed",+ "notified_at",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_is_dismissed_notified_at_remind_at` ON `${TABLE_NAME}` (`is_dismissed`, `notified_at`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_start_time`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_title_program_start_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_title",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_title_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_title`, `program_start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_storage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tree_uri` TEXT, `display_name` TEXT, `output_directory` TEXT, `available_bytes` INTEGER, `is_writable` INTEGER NOT NULL, `file_name_pattern` TEXT NOT NULL, `retention_days` INTEGER, `max_simultaneous_recordings` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "treeUri",+ "columnName": "tree_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDirectory",+ "columnName": "output_directory",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "availableBytes",+ "columnName": "available_bytes",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "isWritable",+ "columnName": "is_writable",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "fileNamePattern",+ "columnName": "file_name_pattern",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "retentionDays",+ "columnName": "retention_days",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "maxSimultaneousRecordings",+ "columnName": "max_simultaneous_recordings",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "playback_compatibility_records",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `device_fingerprint` TEXT NOT NULL, `device_model` TEXT NOT NULL, `android_sdk` INTEGER NOT NULL, `stream_type` TEXT NOT NULL, `video_mime_type` TEXT NOT NULL, `resolution_bucket` TEXT NOT NULL, `decoder_name` TEXT NOT NULL, `surface_type` TEXT NOT NULL, `failure_type` TEXT NOT NULL, `last_failed_at` INTEGER NOT NULL, `last_succeeded_at` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `success_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deviceFingerprint",+ "columnName": "device_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceModel",+ "columnName": "device_model",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "androidSdk",+ "columnName": "android_sdk",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamType",+ "columnName": "stream_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "videoMimeType",+ "columnName": "video_mime_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolutionBucket",+ "columnName": "resolution_bucket",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "decoderName",+ "columnName": "decoder_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "surfaceType",+ "columnName": "surface_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureType",+ "columnName": "failure_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastFailedAt",+ "columnName": "last_failed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSucceededAt",+ "columnName": "last_succeeded_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "successCount",+ "columnName": "success_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type",+ "unique": true,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket",+ "decoder_name",+ "surface_type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`, `decoder_name`, `surface_type`)"+ },+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket",+ "unique": false,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`)"+ },+ {+ "name": "index_playback_compatibility_records_last_failed_at",+ "unique": false,+ "columnNames": [+ "last_failed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_failed_at` ON `${TABLE_NAME}` (`last_failed_at`)"+ },+ {+ "name": "index_playback_compatibility_records_last_succeeded_at",+ "unique": false,+ "columnNames": [+ "last_succeeded_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_succeeded_at` ON `${TABLE_NAME}` (`last_succeeded_at`)"+ }+ ]+ },+ {+ "tableName": "xtream_content_index",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `remote_id` TEXT NOT NULL, `local_content_id` INTEGER, `name` TEXT NOT NULL, `category_id` INTEGER, `category_name` TEXT, `image_url` TEXT, `container_extension` TEXT, `rating` REAL NOT NULL, `added_at` INTEGER NOT NULL, `remote_updated_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `indexed_at` INTEGER NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `stale_state` TEXT NOT NULL, `error_state` TEXT, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `remote_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "remoteId",+ "columnName": "remote_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "localContentId",+ "columnName": "local_content_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteUpdatedAt",+ "columnName": "remote_updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedAt",+ "columnName": "indexed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "staleState",+ "columnName": "stale_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorState",+ "columnName": "error_state",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "remote_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_content_index_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_category_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `category_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_name",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_name` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `name`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_local_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "local_content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_local_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `local_content_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_indexed_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "indexed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_indexed_at` ON `${TABLE_NAME}` (`provider_id`, `indexed_at`)"+ },+ {+ "name": "index_xtream_content_index_stale_state",+ "unique": false,+ "columnNames": [+ "stale_state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_stale_state` ON `${TABLE_NAME}` (`stale_state`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_index_jobs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `section` TEXT NOT NULL, `state` TEXT NOT NULL, `total_categories` INTEGER NOT NULL, `completed_categories` INTEGER NOT NULL, `next_category_index` INTEGER NOT NULL, `failed_categories` INTEGER NOT NULL, `indexed_rows` INTEGER NOT NULL, `skipped_malformed_rows` INTEGER NOT NULL, `deleted_pruned_rows` INTEGER NOT NULL, `priority_category_id` INTEGER, `priority_requested_at` INTEGER NOT NULL, `last_error` TEXT, `last_attempt_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `section`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "section",+ "columnName": "section",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "totalCategories",+ "columnName": "total_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedCategories",+ "columnName": "completed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedCategories",+ "columnName": "failed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedRows",+ "columnName": "indexed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "skippedMalformedRows",+ "columnName": "skipped_malformed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deletedPrunedRows",+ "columnName": "deleted_pruned_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priorityCategoryId",+ "columnName": "priority_category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "priorityRequestedAt",+ "columnName": "priority_requested_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastAttemptAt",+ "columnName": "last_attempt_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "section"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_index_jobs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_index_jobs_section",+ "unique": false,+ "columnNames": [+ "section"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_section` ON `${TABLE_NAME}` (`section`)"+ },+ {+ "name": "index_xtream_index_jobs_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_xtream_index_jobs_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_live_onboarding_state",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `provider_type` TEXT NOT NULL, `content_type` TEXT NOT NULL, `phase` TEXT NOT NULL, `staged_session_id` INTEGER, `import_strategy` TEXT, `next_category_index` INTEGER NOT NULL, `accepted_row_count` INTEGER NOT NULL, `staged_flush_count` INTEGER NOT NULL, `sync_profile_tier` TEXT, `sync_profile_batch_size` INTEGER NOT NULL, `sync_profile_strategy` TEXT, `sync_profile_low_memory` INTEGER NOT NULL, `sync_profile_memory_class_mb` INTEGER NOT NULL, `sync_profile_available_mem_mb` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerType",+ "columnName": "provider_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phase",+ "columnName": "phase",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stagedSessionId",+ "columnName": "staged_session_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "importStrategy",+ "columnName": "import_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "acceptedRowCount",+ "columnName": "accepted_row_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stagedFlushCount",+ "columnName": "staged_flush_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileTier",+ "columnName": "sync_profile_tier",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileBatchSize",+ "columnName": "sync_profile_batch_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileStrategy",+ "columnName": "sync_profile_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileLowMemory",+ "columnName": "sync_profile_low_memory",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileMemoryClassMb",+ "columnName": "sync_profile_memory_class_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileAvailableMemMb",+ "columnName": "sync_profile_available_mem_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_live_onboarding_state_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_phase",+ "unique": false,+ "columnNames": [+ "phase"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_phase` ON `${TABLE_NAME}` (`phase`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_staged_session_id",+ "unique": false,+ "columnNames": [+ "staged_session_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_staged_session_id` ON `${TABLE_NAME}` (`staged_session_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ }+ ],+ "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, '029600eb5e91fa0afefd95811b871f31')"+ ]+ }+}\ No newline at end of filediff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/57.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/57.jsonnew file mode 100644index 00000000..cb0d53de--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/57.json@@ -0,0 +1,5176 @@+{+ "formatVersion": 1,+ "database": {+ "version": 57,+ "identityHash": "263f5af1a5bc644164116fd9e1079dc9",+ "entities": [+ {+ "tableName": "providers",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `server_url` TEXT NOT NULL, `username` TEXT NOT NULL, `password` TEXT NOT NULL, `m3u_url` TEXT NOT NULL, `epg_url` TEXT NOT NULL, `http_user_agent` TEXT NOT NULL, `http_headers` TEXT NOT NULL, `stalker_mac_address` TEXT NOT NULL, `stalker_device_profile` TEXT NOT NULL, `stalker_device_timezone` TEXT NOT NULL, `stalker_device_locale` TEXT NOT NULL, `stalker_serial_number` TEXT NOT NULL, `stalker_device_id` TEXT NOT NULL, `stalker_device_id2` TEXT NOT NULL, `stalker_signature` TEXT NOT NULL, `stalker_auth_mode` TEXT NOT NULL, `stalker_portal_profile` TEXT NOT NULL, `stalker_portal_fingerprint` TEXT NOT NULL, `stalker_mag_preset` TEXT NOT NULL, `stalker_last_bootstrap_recipe` TEXT NOT NULL, `stalker_endpoint_preference` TEXT NOT NULL, `stalker_cookie_mode` TEXT NOT NULL, `stalker_playback_backend_hint` TEXT NOT NULL, `stalker_last_playback_mode` TEXT, `stalker_credentials_required` INTEGER NOT NULL, `stalker_mac_required` INTEGER NOT NULL, `stalker_uses_temp_links` INTEGER NOT NULL, `stalker_module_restricted` INTEGER NOT NULL, `stalker_strict_fingerprint_required` INTEGER NOT NULL, `stalker_recipe_fallback_used` INTEGER NOT NULL, `stalker_recipe_rediscovery_attempts` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `epg_sync_mode` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `xtream_live_sync_mode` TEXT NOT NULL, `m3u_vod_classification_enabled` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "serverUrl",+ "columnName": "server_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "username",+ "columnName": "username",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "password",+ "columnName": "password",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uUrl",+ "columnName": "m3u_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgUrl",+ "columnName": "epg_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "httpUserAgent",+ "columnName": "http_user_agent",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "httpHeaders",+ "columnName": "http_headers",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMacAddress",+ "columnName": "stalker_mac_address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceProfile",+ "columnName": "stalker_device_profile",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceTimezone",+ "columnName": "stalker_device_timezone",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceLocale",+ "columnName": "stalker_device_locale",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerSerialNumber",+ "columnName": "stalker_serial_number",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceId",+ "columnName": "stalker_device_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerDeviceId2",+ "columnName": "stalker_device_id2",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerSignature",+ "columnName": "stalker_signature",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerAuthMode",+ "columnName": "stalker_auth_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPortalProfile",+ "columnName": "stalker_portal_profile",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPortalFingerprint",+ "columnName": "stalker_portal_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMagPreset",+ "columnName": "stalker_mag_preset",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerLastBootstrapRecipe",+ "columnName": "stalker_last_bootstrap_recipe",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerEndpointPreference",+ "columnName": "stalker_endpoint_preference",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerCookieMode",+ "columnName": "stalker_cookie_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerPlaybackBackendHint",+ "columnName": "stalker_playback_backend_hint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stalkerLastPlaybackMode",+ "columnName": "stalker_last_playback_mode",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "stalkerCredentialsRequired",+ "columnName": "stalker_credentials_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerMacRequired",+ "columnName": "stalker_mac_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerUsesTemporaryLinks",+ "columnName": "stalker_uses_temp_links",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerModuleRestricted",+ "columnName": "stalker_module_restricted",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerStrictFingerprintRequired",+ "columnName": "stalker_strict_fingerprint_required",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerRecipeFallbackUsed",+ "columnName": "stalker_recipe_fallback_used",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stalkerRecipeRediscoveryAttempts",+ "columnName": "stalker_recipe_rediscovery_attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isActive",+ "columnName": "is_active",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "maxConnections",+ "columnName": "max_connections",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "expirationDate",+ "columnName": "expiration_date",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "apiVersion",+ "columnName": "api_version",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "allowedOutputFormatsJson",+ "columnName": "allowed_output_formats_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSyncMode",+ "columnName": "epg_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "xtreamFastSyncEnabled",+ "columnName": "xtream_fast_sync_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xtreamLiveSyncMode",+ "columnName": "xtream_live_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uVodClassificationEnabled",+ "columnName": "m3u_vod_classification_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncedAt",+ "columnName": "last_synced_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_providers_server_url_username_stalker_mac_address",+ "unique": true,+ "columnNames": [+ "server_url",+ "username",+ "stalker_mac_address"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username_stalker_mac_address` ON `${TABLE_NAME}` (`server_url`, `username`, `stalker_mac_address`)"+ }+ ]+ },+ {+ "tableName": "channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "qualityOptionsJson",+ "columnName": "quality_options_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channels_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_channels_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_channels_logical_group_id",+ "unique": false,+ "columnNames": [+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id_logical_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_preferences",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `audio_video_offset_ms` INTEGER, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`channel_id`) REFERENCES `channels`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "aspectRatio",+ "columnName": "aspect_ratio",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "audioVideoOffsetMs",+ "columnName": "audio_video_offset_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_preferences_channel_id",+ "unique": true,+ "columnNames": [+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_preferences_channel_id` ON `${TABLE_NAME}` (`channel_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "channels",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "channel_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channels_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`channels`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "channels",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_UPDATE BEFORE UPDATE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_BEFORE_DELETE BEFORE DELETE ON `channels` BEGIN DELETE FROM `channels_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_UPDATE AFTER UPDATE ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_channels_fts_AFTER_INSERT AFTER INSERT ON `channels` BEGIN INSERT INTO `channels_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "movies",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_movies_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movies_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_movies_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_movies_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_movies_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_movies_provider_id_added_at_release_date_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "added_at",+ "release_date",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movies_provider_id_added_at_release_date_name_id` ON `${TABLE_NAME}` (`provider_id`, `added_at`, `release_date`, `name`, `id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movies_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`movies`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "movies",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_UPDATE BEFORE UPDATE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_BEFORE_DELETE BEFORE DELETE ON `movies` BEGIN DELETE FROM `movies_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_UPDATE AFTER UPDATE ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_movies_fts_AFTER_INSERT AFTER INSERT ON `movies` BEGIN INSERT INTO `movies_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "series",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `cache_state` TEXT NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `remote_stale_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "cacheState",+ "columnName": "cache_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteStaleAt",+ "columnName": "remote_stale_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_series_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_series_provider_id_series_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_series_provider_id_series_id` ON `${TABLE_NAME}` (`provider_id`, `series_id`)"+ },+ {+ "name": "index_series_provider_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_category_id_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_category_id_name_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_rating_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "rating",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_rating_name_id` ON `${TABLE_NAME}` (`provider_id`, `rating`, `name`, `id`)"+ },+ {+ "name": "index_series_provider_id_last_modified_name_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "last_modified",+ "name",+ "id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_provider_id_last_modified_name_id` ON `${TABLE_NAME}` (`provider_id`, `last_modified`, `name`, `id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "series",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "episodes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "episodeId",+ "columnName": "episode_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "coverUrl",+ "columnName": "cover_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_episodes_series_id",+ "unique": false,+ "columnNames": [+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"+ },+ {+ "name": "index_episodes_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_episodes_provider_id_episode_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "episode_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "series",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "series_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "categories",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_categories_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_categories_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ },+ {+ "name": "index_categories_provider_id_category_id_type",+ "unique": true,+ "columnNames": [+ "provider_id",+ "category_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channel_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, `added_at` INTEGER NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "year",+ "columnName": "year",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_movie_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `series_id` INTEGER NOT NULL, `provider_series_id` TEXT, `provider_series_key` TEXT NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `rating` REAL NOT NULL, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `episode_run_time` TEXT, `last_modified` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `provider_series_key`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerSeriesId",+ "columnName": "provider_series_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerSeriesKey",+ "columnName": "provider_series_key",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "backdropUrl",+ "columnName": "backdrop_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cast",+ "columnName": "cast",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "director",+ "columnName": "director",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "youtubeTrailer",+ "columnName": "youtube_trailer",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeRunTime",+ "columnName": "episode_run_time",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModified",+ "columnName": "last_modified",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "provider_series_key"+ ]+ },+ "indices": [+ {+ "name": "index_series_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "category_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "category_id",+ "type"+ ]+ },+ "indices": [+ {+ "name": "index_category_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_category_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ },+ {+ "name": "index_category_import_stage_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "programs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "hasArchive",+ "columnName": "has_archive",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_programs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_programs_provider_id_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_end_time_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "end_time",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_end_time_channel_id` ON `${TABLE_NAME}` (`provider_id`, `end_time`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_start_time_end_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_programs_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_start_time` ON `${TABLE_NAME}` (`start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`)"+ },+ {+ "name": "index_programs_provider_id_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `start_time`, `end_time`)"+ }+ ]+ },+ {+ "tableName": "favorites",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `group_key` INTEGER NOT NULL, `added_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`group_id`) REFERENCES `virtual_groups`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "groupId",+ "columnName": "group_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "groupKey",+ "columnName": "group_key",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_favorites_provider_id_content_id_content_type_group_key",+ "unique": true,+ "columnNames": [+ "provider_id",+ "content_id",+ "content_type",+ "group_key"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_provider_id_content_id_content_type_group_key` ON `${TABLE_NAME}` (`provider_id`, `content_id`, `content_type`, `group_key`)"+ },+ {+ "name": "index_favorites_provider_id_content_type_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_provider_id_content_type_group_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `group_id`)"+ },+ {+ "name": "index_favorites_group_id_position",+ "unique": false,+ "columnNames": [+ "group_id",+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_group_id_position` ON `${TABLE_NAME}` (`group_id`, `position`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "virtual_groups",+ "onDelete": "SET NULL",+ "onUpdate": "NO ACTION",+ "columns": [+ "group_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "virtual_groups",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconEmoji",+ "columnName": "icon_emoji",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "position",+ "columnName": "position",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_virtual_groups_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_virtual_groups_position",+ "unique": false,+ "columnNames": [+ "position"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_position` ON `${TABLE_NAME}` (`position`)"+ },+ {+ "name": "index_virtual_groups_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_virtual_groups_content_type` ON `${TABLE_NAME}` (`content_type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "playback_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `poster_url` TEXT, `stream_url` TEXT NOT NULL, `resume_position_ms` INTEGER NOT NULL, `total_duration_ms` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `watch_count` INTEGER NOT NULL, `watched_status` TEXT NOT NULL, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentId",+ "columnName": "content_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "posterUrl",+ "columnName": "poster_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resumePositionMs",+ "columnName": "resume_position_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalDurationMs",+ "columnName": "total_duration_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchCount",+ "columnName": "watch_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchedStatus",+ "columnName": "watched_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_history_content_id_content_type_provider_id",+ "unique": true,+ "columnNames": [+ "content_id",+ "content_type",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_history_content_id_content_type_provider_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `provider_id`)"+ },+ {+ "name": "index_playback_history_last_watched_at",+ "unique": false,+ "columnNames": [+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_last_watched_at` ON `${TABLE_NAME}` (`last_watched_at`)"+ },+ {+ "name": "index_playback_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `content_id`)"+ },+ {+ "name": "index_playback_history_provider_id_content_type_last_watched_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "last_watched_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_history_provider_id_content_type_last_watched_at` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `last_watched_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "tmdb_identity",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tmdb_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `canonical_provider_id` INTEGER NOT NULL, `first_seen_at` INTEGER NOT NULL, PRIMARY KEY(`tmdb_id`, `content_type`), FOREIGN KEY(`canonical_provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "tmdbId",+ "columnName": "tmdb_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "canonicalProviderId",+ "columnName": "canonical_provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "firstSeenAt",+ "columnName": "first_seen_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "tmdb_id",+ "content_type"+ ]+ },+ "indices": [+ {+ "name": "index_tmdb_identity_content_type",+ "unique": false,+ "columnNames": [+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_content_type` ON `${TABLE_NAME}` (`content_type`)"+ },+ {+ "name": "index_tmdb_identity_canonical_provider_id",+ "unique": false,+ "columnNames": [+ "canonical_provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_tmdb_identity_canonical_provider_id` ON `${TABLE_NAME}` (`canonical_provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "canonical_provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "search_history",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `content_scope` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `used_at` INTEGER NOT NULL, `use_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "query",+ "columnName": "query",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentScope",+ "columnName": "content_scope",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "usedAt",+ "columnName": "used_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "useCount",+ "columnName": "use_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_search_history_content_scope_provider_id_used_at",+ "unique": false,+ "columnNames": [+ "content_scope",+ "provider_id",+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_content_scope_provider_id_used_at` ON `${TABLE_NAME}` (`content_scope`, `provider_id`, `used_at`)"+ },+ {+ "name": "index_search_history_used_at",+ "unique": false,+ "columnNames": [+ "used_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_used_at` ON `${TABLE_NAME}` (`used_at`)"+ },+ {+ "name": "index_search_history_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_search_history_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_search_history_query_content_scope_provider_id",+ "unique": true,+ "columnNames": [+ "query",+ "content_scope",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_search_history_query_content_scope_provider_id` ON `${TABLE_NAME}` (`query`, `content_scope`, `provider_id`)"+ }+ ]+ },+ {+ "tableName": "sync_metadata",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_live_success` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_series_success` INTEGER NOT NULL, `last_epg_sync` INTEGER NOT NULL, `last_epg_success` INTEGER NOT NULL, `last_movie_attempt` INTEGER NOT NULL, `last_movie_success` INTEGER NOT NULL, `last_movie_partial` INTEGER NOT NULL, `live_count` INTEGER NOT NULL, `movie_count` INTEGER NOT NULL, `series_count` INTEGER NOT NULL, `epg_count` INTEGER NOT NULL, `last_sync_status` TEXT NOT NULL, `movie_sync_mode` TEXT NOT NULL, `movie_warnings_count` INTEGER NOT NULL, `movie_catalog_stale` INTEGER NOT NULL, `live_avoid_full_until` INTEGER NOT NULL, `movie_avoid_full_until` INTEGER NOT NULL, `series_avoid_full_until` INTEGER NOT NULL, `live_sequential_failures_remembered` INTEGER NOT NULL, `live_healthy_sync_streak` INTEGER NOT NULL, `movie_parallel_failures_remembered` INTEGER NOT NULL, `movie_healthy_sync_streak` INTEGER NOT NULL, `series_sequential_failures_remembered` INTEGER NOT NULL, `series_healthy_sync_streak` INTEGER NOT NULL, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSync",+ "columnName": "last_live_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastLiveSuccess",+ "columnName": "last_live_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSync",+ "columnName": "last_movie_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSync",+ "columnName": "last_series_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSuccess",+ "columnName": "last_series_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSync",+ "columnName": "last_epg_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSuccess",+ "columnName": "last_epg_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieAttempt",+ "columnName": "last_movie_attempt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMovieSuccess",+ "columnName": "last_movie_success",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMoviePartial",+ "columnName": "last_movie_partial",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveCount",+ "columnName": "live_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCount",+ "columnName": "movie_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesCount",+ "columnName": "series_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgCount",+ "columnName": "epg_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncStatus",+ "columnName": "last_sync_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieSyncMode",+ "columnName": "movie_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "movieWarningsCount",+ "columnName": "movie_warnings_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieCatalogStale",+ "columnName": "movie_catalog_stale",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveAvoidFullUntil",+ "columnName": "live_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieAvoidFullUntil",+ "columnName": "movie_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesAvoidFullUntil",+ "columnName": "series_avoid_full_until",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveSequentialFailuresRemembered",+ "columnName": "live_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "liveHealthySyncStreak",+ "columnName": "live_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieParallelFailuresRemembered",+ "columnName": "movie_parallel_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "movieHealthySyncStreak",+ "columnName": "movie_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesSequentialFailuresRemembered",+ "columnName": "series_sequential_failures_remembered",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seriesHealthySyncStreak",+ "columnName": "series_healthy_sync_streak",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_movie_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_movie_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_category_hydration",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `page_size` INTEGER NOT NULL, `retry_after_ms` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `retry_budget_remaining` INTEGER NOT NULL, `last_page_fingerprint` TEXT, PRIMARY KEY(`provider_id`, `category_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastHydratedAt",+ "columnName": "last_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "itemCount",+ "columnName": "item_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastStatus",+ "columnName": "last_status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastLoadedPage",+ "columnName": "last_loaded_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptedPage",+ "columnName": "last_attempted_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessfulPage",+ "columnName": "last_successful_page",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "totalPages",+ "columnName": "total_pages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isComplete",+ "columnName": "is_complete",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pageSize",+ "columnName": "page_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryAfterMs",+ "columnName": "retry_after_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryBudgetRemaining",+ "columnName": "retry_budget_remaining",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastPageFingerprint",+ "columnName": "last_page_fingerprint",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `etag` TEXT, `last_modified_header` TEXT)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "url",+ "columnName": "url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastRefreshAt",+ "columnName": "last_refresh_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "etag",+ "columnName": "etag",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastModifiedHeader",+ "columnName": "last_modified_header",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_sources_url",+ "unique": true,+ "columnNames": [+ "url"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_sources_url` ON `${TABLE_NAME}` (`url`)"+ }+ ]+ },+ {+ "tableName": "provider_epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `epg_source_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_provider_epg_sources_provider_id_epg_source_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_epg_sources_provider_id_epg_source_id` ON `${TABLE_NAME}` (`provider_id`, `epg_source_id`)"+ },+ {+ "name": "index_provider_epg_sources_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_epg_sources_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `display_name` TEXT NOT NULL, `normalized_name` TEXT NOT NULL, `icon_url` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "normalizedName",+ "columnName": "normalized_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "iconUrl",+ "columnName": "icon_url",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_channels_epg_source_id_xmltv_channel_id",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id_xmltv_channel_id` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`)"+ },+ {+ "name": "index_epg_channels_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_channels_normalized_name",+ "unique": false,+ "columnNames": [+ "normalized_name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_normalized_name` ON `${TABLE_NAME}` (`normalized_name`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_programmes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `title` TEXT NOT NULL, `subtitle` TEXT, `description` TEXT NOT NULL, `category` TEXT, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `episode_info` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "subtitle",+ "columnName": "subtitle",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "episodeInfo",+ "columnName": "episode_info",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time",+ "unique": false,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time",+ "unique": true,+ "columnNames": [+ "epg_source_id",+ "xmltv_channel_id",+ "start_time",+ "end_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`, `end_time`)"+ },+ {+ "name": "index_epg_programmes_epg_source_id",+ "unique": false,+ "columnNames": [+ "epg_source_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"+ },+ {+ "name": "index_epg_programmes_start_time",+ "unique": false,+ "columnNames": [+ "start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_start_time` ON `${TABLE_NAME}` (`start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "epg_sources",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "epg_source_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_epg_mappings",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_channel_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `source_type` TEXT NOT NULL, `epg_source_id` INTEGER, `xmltv_channel_id` TEXT, `match_type` TEXT, `confidence` REAL NOT NULL, `matched_at` INTEGER NOT NULL, `failed_attempts` INTEGER NOT NULL, `source` TEXT, `is_manual_override` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerChannelId",+ "columnName": "provider_channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSourceId",+ "columnName": "epg_source_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "xmltvChannelId",+ "columnName": "xmltv_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "matchType",+ "columnName": "match_type",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "confidence",+ "columnName": "confidence",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "matchedAt",+ "columnName": "matched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedAttempts",+ "columnName": "failed_attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "source",+ "columnName": "source",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isManualOverride",+ "columnName": "is_manual_override",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_epg_mappings_provider_id_provider_channel_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "provider_channel_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id_provider_channel_id` ON `${TABLE_NAME}` (`provider_id`, `provider_channel_id`)"+ },+ {+ "name": "index_channel_epg_mappings_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "combined_m3u_profiles",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "combined_m3u_profile_members",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `profile_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`profile_id`) REFERENCES `combined_m3u_profiles`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "profileId",+ "columnName": "profile_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_combined_m3u_profile_members_profile_id",+ "unique": false,+ "columnNames": [+ "profile_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id` ON `${TABLE_NAME}` (`profile_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_combined_m3u_profile_members_profile_id_provider_id",+ "unique": true,+ "columnNames": [+ "profile_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id_provider_id` ON `${TABLE_NAME}` (`profile_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "combined_m3u_profiles",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "profile_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_schedules",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `requested_start_ms` INTEGER NOT NULL, `requested_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `enabled` INTEGER NOT NULL, `is_manual` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "requestedStartMs",+ "columnName": "requested_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "requestedEndMs",+ "columnName": "requested_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "enabled",+ "columnName": "enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isManual",+ "columnName": "is_manual",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_schedules_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_schedules_enabled_requested_start_ms",+ "unique": false,+ "columnNames": [+ "enabled",+ "requested_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_enabled_requested_start_ms` ON `${TABLE_NAME}` (`enabled`, `requested_start_ms`)"+ },+ {+ "name": "index_recording_schedules_recurring_rule_id",+ "unique": false,+ "columnNames": [+ "recurring_rule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_recurring_rule_id` ON `${TABLE_NAME}` (`recurring_rule_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_runs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `schedule_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `scheduled_start_ms` INTEGER NOT NULL, `scheduled_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `status` TEXT NOT NULL, `source_type` TEXT NOT NULL, `resolved_url` TEXT, `headers_json` TEXT NOT NULL, `user_agent` TEXT, `expiration_time` INTEGER, `provider_label` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `bytes_written` INTEGER NOT NULL, `average_throughput_bps` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `last_progress_at_ms` INTEGER, `failure_category` TEXT NOT NULL, `failure_reason` TEXT, `terminal_at_ms` INTEGER, `started_at_ms` INTEGER, `ended_at_ms` INTEGER, `schedule_enabled` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `alarm_start_at_ms` INTEGER, `alarm_stop_at_ms` INTEGER, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`schedule_id`) REFERENCES `recording_schedules`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "scheduleId",+ "columnName": "schedule_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "scheduledStartMs",+ "columnName": "scheduled_start_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "scheduledEndMs",+ "columnName": "scheduled_end_ms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "recurrence",+ "columnName": "recurrence",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "recurringRuleId",+ "columnName": "recurring_rule_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sourceType",+ "columnName": "source_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolvedUrl",+ "columnName": "resolved_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "headersJson",+ "columnName": "headers_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "userAgent",+ "columnName": "user_agent",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "expirationTime",+ "columnName": "expiration_time",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "providerLabel",+ "columnName": "provider_label",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputUri",+ "columnName": "output_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDisplayPath",+ "columnName": "output_display_path",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bytesWritten",+ "columnName": "bytes_written",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "averageThroughputBytesPerSecond",+ "columnName": "average_throughput_bps",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "retryCount",+ "columnName": "retry_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastProgressAtMs",+ "columnName": "last_progress_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "failureCategory",+ "columnName": "failure_category",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureReason",+ "columnName": "failure_reason",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "terminalAtMs",+ "columnName": "terminal_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "startedAtMs",+ "columnName": "started_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "endedAtMs",+ "columnName": "ended_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "scheduleEnabled",+ "columnName": "schedule_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priority",+ "columnName": "priority",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "alarmStartAtMs",+ "columnName": "alarm_start_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "alarmStopAtMs",+ "columnName": "alarm_stop_at_ms",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_recording_runs_schedule_id",+ "unique": false,+ "columnNames": [+ "schedule_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_schedule_id` ON `${TABLE_NAME}` (`schedule_id`)"+ },+ {+ "name": "index_recording_runs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_recording_runs_status_scheduled_start_ms",+ "unique": false,+ "columnNames": [+ "status",+ "scheduled_start_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_status_scheduled_start_ms` ON `${TABLE_NAME}` (`status`, `scheduled_start_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_start_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_start_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_start_at_ms` ON `${TABLE_NAME}` (`alarm_start_at_ms`)"+ },+ {+ "name": "index_recording_runs_alarm_stop_at_ms",+ "unique": false,+ "columnNames": [+ "alarm_stop_at_ms"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_stop_at_ms` ON `${TABLE_NAME}` (`alarm_stop_at_ms`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "recording_schedules",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "schedule_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "program_reminders",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `channel_name` TEXT NOT NULL, `program_title` TEXT NOT NULL, `program_start_time` INTEGER NOT NULL, `remind_at` INTEGER NOT NULL, `lead_time_minutes` INTEGER NOT NULL, `is_dismissed` INTEGER NOT NULL, `notified_at` INTEGER, `created_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "channelName",+ "columnName": "channel_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programTitle",+ "columnName": "program_title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "programStartTime",+ "columnName": "program_start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remindAt",+ "columnName": "remind_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "leadTimeMinutes",+ "columnName": "lead_time_minutes",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isDismissed",+ "columnName": "is_dismissed",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "notifiedAt",+ "columnName": "notified_at",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_program_reminders_provider_id_remind_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_remind_at` ON `${TABLE_NAME}` (`provider_id`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_is_dismissed_notified_at_remind_at",+ "unique": false,+ "columnNames": [+ "is_dismissed",+ "notified_at",+ "remind_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_is_dismissed_notified_at_remind_at` ON `${TABLE_NAME}` (`is_dismissed`, `notified_at`, `remind_at`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_start_time",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_start_time`)"+ },+ {+ "name": "index_program_reminders_provider_id_channel_id_program_title_program_start_time",+ "unique": true,+ "columnNames": [+ "provider_id",+ "channel_id",+ "program_title",+ "program_start_time"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_title_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_title`, `program_start_time`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "recording_storage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tree_uri` TEXT, `display_name` TEXT, `output_directory` TEXT, `available_bytes` INTEGER, `is_writable` INTEGER NOT NULL, `file_name_pattern` TEXT NOT NULL, `retention_days` INTEGER, `max_simultaneous_recordings` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "treeUri",+ "columnName": "tree_uri",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "displayName",+ "columnName": "display_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "outputDirectory",+ "columnName": "output_directory",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "availableBytes",+ "columnName": "available_bytes",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "isWritable",+ "columnName": "is_writable",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "fileNamePattern",+ "columnName": "file_name_pattern",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "retentionDays",+ "columnName": "retention_days",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "maxSimultaneousRecordings",+ "columnName": "max_simultaneous_recordings",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "playback_compatibility_records",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `device_fingerprint` TEXT NOT NULL, `device_model` TEXT NOT NULL, `android_sdk` INTEGER NOT NULL, `stream_type` TEXT NOT NULL, `video_mime_type` TEXT NOT NULL, `resolution_bucket` TEXT NOT NULL, `decoder_name` TEXT NOT NULL, `surface_type` TEXT NOT NULL, `failure_type` TEXT NOT NULL, `last_failed_at` INTEGER NOT NULL, `last_succeeded_at` INTEGER NOT NULL, `failure_count` INTEGER NOT NULL, `success_count` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deviceFingerprint",+ "columnName": "device_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceModel",+ "columnName": "device_model",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "androidSdk",+ "columnName": "android_sdk",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamType",+ "columnName": "stream_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "videoMimeType",+ "columnName": "video_mime_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "resolutionBucket",+ "columnName": "resolution_bucket",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "decoderName",+ "columnName": "decoder_name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "surfaceType",+ "columnName": "surface_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureType",+ "columnName": "failure_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastFailedAt",+ "columnName": "last_failed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSucceededAt",+ "columnName": "last_succeeded_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failureCount",+ "columnName": "failure_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "successCount",+ "columnName": "success_count",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type",+ "unique": true,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket",+ "decoder_name",+ "surface_type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket_decoder_name_surface_type` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`, `decoder_name`, `surface_type`)"+ },+ {+ "name": "index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket",+ "unique": false,+ "columnNames": [+ "device_fingerprint",+ "stream_type",+ "video_mime_type",+ "resolution_bucket"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_device_fingerprint_stream_type_video_mime_type_resolution_bucket` ON `${TABLE_NAME}` (`device_fingerprint`, `stream_type`, `video_mime_type`, `resolution_bucket`)"+ },+ {+ "name": "index_playback_compatibility_records_last_failed_at",+ "unique": false,+ "columnNames": [+ "last_failed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_failed_at` ON `${TABLE_NAME}` (`last_failed_at`)"+ },+ {+ "name": "index_playback_compatibility_records_last_succeeded_at",+ "unique": false,+ "columnNames": [+ "last_succeeded_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playback_compatibility_records_last_succeeded_at` ON `${TABLE_NAME}` (`last_succeeded_at`)"+ }+ ]+ },+ {+ "tableName": "xtream_content_index",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `remote_id` TEXT NOT NULL, `local_content_id` INTEGER, `name` TEXT NOT NULL, `category_id` INTEGER, `category_name` TEXT, `image_url` TEXT, `container_extension` TEXT, `rating` REAL NOT NULL, `added_at` INTEGER NOT NULL, `remote_updated_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `indexed_at` INTEGER NOT NULL, `detail_hydrated_at` INTEGER NOT NULL, `stale_state` TEXT NOT NULL, `error_state` TEXT, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `remote_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "remoteId",+ "columnName": "remote_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "localContentId",+ "columnName": "local_content_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "remoteUpdatedAt",+ "columnName": "remote_updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedAt",+ "columnName": "indexed_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "detailHydratedAt",+ "columnName": "detail_hydrated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "staleState",+ "columnName": "stale_state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorState",+ "columnName": "error_state",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "remote_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_content_index_provider_id_content_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type` ON `${TABLE_NAME}` (`provider_id`, `content_type`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_category_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `category_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_name",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "name"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_name` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `name`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_content_type_local_content_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "content_type",+ "local_content_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_content_type_local_content_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `local_content_id`)"+ },+ {+ "name": "index_xtream_content_index_provider_id_indexed_at",+ "unique": false,+ "columnNames": [+ "provider_id",+ "indexed_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_provider_id_indexed_at` ON `${TABLE_NAME}` (`provider_id`, `indexed_at`)"+ },+ {+ "name": "index_xtream_content_index_stale_state",+ "unique": false,+ "columnNames": [+ "stale_state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_content_index_stale_state` ON `${TABLE_NAME}` (`stale_state`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_index_jobs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `section` TEXT NOT NULL, `state` TEXT NOT NULL, `total_categories` INTEGER NOT NULL, `completed_categories` INTEGER NOT NULL, `next_category_index` INTEGER NOT NULL, `failed_categories` INTEGER NOT NULL, `indexed_rows` INTEGER NOT NULL, `skipped_malformed_rows` INTEGER NOT NULL, `deleted_pruned_rows` INTEGER NOT NULL, `priority_category_id` INTEGER, `priority_requested_at` INTEGER NOT NULL, `last_error` TEXT, `last_attempt_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `section`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "section",+ "columnName": "section",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "state",+ "columnName": "state",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "totalCategories",+ "columnName": "total_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedCategories",+ "columnName": "completed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "failedCategories",+ "columnName": "failed_categories",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "indexedRows",+ "columnName": "indexed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "skippedMalformedRows",+ "columnName": "skipped_malformed_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "deletedPrunedRows",+ "columnName": "deleted_pruned_rows",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "priorityCategoryId",+ "columnName": "priority_category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "priorityRequestedAt",+ "columnName": "priority_requested_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "lastAttemptAt",+ "columnName": "last_attempt_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSuccessAt",+ "columnName": "last_success_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "section"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_index_jobs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_index_jobs_section",+ "unique": false,+ "columnNames": [+ "section"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_section` ON `${TABLE_NAME}` (`section`)"+ },+ {+ "name": "index_xtream_index_jobs_state",+ "unique": false,+ "columnNames": [+ "state"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_state` ON `${TABLE_NAME}` (`state`)"+ },+ {+ "name": "index_xtream_index_jobs_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "xtream_live_onboarding_state",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `provider_type` TEXT NOT NULL, `content_type` TEXT NOT NULL, `phase` TEXT NOT NULL, `staged_session_id` INTEGER, `import_strategy` TEXT, `next_category_index` INTEGER NOT NULL, `accepted_row_count` INTEGER NOT NULL, `staged_flush_count` INTEGER NOT NULL, `sync_profile_tier` TEXT, `sync_profile_batch_size` INTEGER NOT NULL, `sync_profile_strategy` TEXT, `sync_profile_low_memory` INTEGER NOT NULL, `sync_profile_memory_class_mb` INTEGER NOT NULL, `sync_profile_available_mem_mb` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerType",+ "columnName": "provider_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "contentType",+ "columnName": "content_type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phase",+ "columnName": "phase",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "stagedSessionId",+ "columnName": "staged_session_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "importStrategy",+ "columnName": "import_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "nextCategoryIndex",+ "columnName": "next_category_index",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "acceptedRowCount",+ "columnName": "accepted_row_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "stagedFlushCount",+ "columnName": "staged_flush_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileTier",+ "columnName": "sync_profile_tier",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileBatchSize",+ "columnName": "sync_profile_batch_size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileStrategy",+ "columnName": "sync_profile_strategy",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncProfileLowMemory",+ "columnName": "sync_profile_low_memory",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileMemoryClassMb",+ "columnName": "sync_profile_memory_class_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncProfileAvailableMemMb",+ "columnName": "sync_profile_available_mem_mb",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "last_error",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updated_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "completedAt",+ "columnName": "completed_at",+ "affinity": "INTEGER"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id"+ ]+ },+ "indices": [+ {+ "name": "index_xtream_live_onboarding_state_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_phase",+ "unique": false,+ "columnNames": [+ "phase"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_phase` ON `${TABLE_NAME}` (`phase`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_updated_at",+ "unique": false,+ "columnNames": [+ "updated_at"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_updated_at` ON `${TABLE_NAME}` (`updated_at`)"+ },+ {+ "name": "index_xtream_live_onboarding_state_staged_session_id",+ "unique": false,+ "columnNames": [+ "staged_session_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_staged_session_id` ON `${TABLE_NAME}` (`staged_session_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ }+ ],+ "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, '263f5af1a5bc644164116fd9e1079dc9')"+ ]+ }+}\ No newline at end of filediff --git a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.ktindex 3cd76d56..8b94cc4e 100644--- a/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt+++ b/data/src/main/java/com/streamvault/data/local/RoomEnumConverters.kt@@ -7,6 +7,12 @@ import com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.ProviderXtreamLiveSyncModeimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.StalkerPortalProfileimport java.util.logging.Logger@@ -56,6 +62,48 @@ class RoomEnumConverters {fun toStalkerPortalProfile(value: String?): StalkerPortalProfile? =enumValueOrDefault(value, StalkerPortalProfile.MAG_BASIC)+ @TypeConverter+ fun fromStalkerPortalFingerprint(value: StalkerPortalFingerprint?): String? = value?.name++ @TypeConverter+ fun toStalkerPortalFingerprint(value: String?): StalkerPortalFingerprint? =+ enumValueOrDefault(value, StalkerPortalFingerprint.BASIC_MAC)++ @TypeConverter+ fun fromStalkerMagPreset(value: StalkerMagPreset?): String? = value?.name++ @TypeConverter+ fun toStalkerMagPreset(value: String?): StalkerMagPreset? =+ enumValueOrDefault(value, StalkerMagPreset.GENERIC_SAFE)++ @TypeConverter+ fun fromStalkerBootstrapRecipe(value: StalkerBootstrapRecipe?): String? = value?.name++ @TypeConverter+ fun toStalkerBootstrapRecipe(value: String?): StalkerBootstrapRecipe? =+ enumValueOrDefault(value, StalkerBootstrapRecipe.GENERIC_SAFE)++ @TypeConverter+ fun fromStalkerEndpointPreference(value: StalkerEndpointPreference?): String? = value?.name++ @TypeConverter+ fun toStalkerEndpointPreference(value: String?): StalkerEndpointPreference? =+ enumValueOrDefault(value, StalkerEndpointPreference.AUTO)++ @TypeConverter+ fun fromStalkerCookieMode(value: StalkerCookieMode?): String? = value?.name++ @TypeConverter+ fun toStalkerCookieMode(value: String?): StalkerCookieMode? =+ enumValueOrDefault(value, StalkerCookieMode.NONE)++ @TypeConverter+ fun fromStalkerPlaybackBackendHint(value: StalkerPlaybackBackendHint?): String? = value?.name++ @TypeConverter+ fun toStalkerPlaybackBackendHint(value: String?): StalkerPlaybackBackendHint? =+ enumValueOrDefault(value, StalkerPlaybackBackendHint.AUTO)+@TypeConverterfun fromContentType(value: ContentType?): String? = value?.namediff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.ktindex 6aabdcba..807a30d5 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 = 55,+ version = 57,exportSchema = true // ← was false; schema JSON now tracked in version control)@TypeConverters(RoomEnumConverters::class)@@ -2578,6 +2578,45 @@ abstract class StreamVaultDatabase : RoomDatabase() {}}+ val MIGRATION_55_56 = object : Migration(55, 56) {+ override fun migrate(database: SupportSQLiteDatabase) {+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_portal_fingerprint TEXT NOT NULL DEFAULT 'BASIC_MAC'"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_mag_preset TEXT NOT NULL DEFAULT 'GENERIC_SAFE'"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_last_bootstrap_recipe TEXT NOT NULL DEFAULT 'GENERIC_SAFE'"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_strict_fingerprint_required INTEGER NOT NULL DEFAULT 0"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_recipe_fallback_used INTEGER NOT NULL DEFAULT 0"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_recipe_rediscovery_attempts INTEGER NOT NULL DEFAULT 0"+ )+ validateForeignKeys(database, "providers")+ }+ }++ val MIGRATION_56_57 = object : Migration(56, 57) {+ override fun migrate(database: SupportSQLiteDatabase) {+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_endpoint_preference TEXT NOT NULL DEFAULT 'AUTO'"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_cookie_mode TEXT NOT NULL DEFAULT 'NONE'"+ )+ database.execSQL(+ "ALTER TABLE providers ADD COLUMN stalker_playback_backend_hint TEXT NOT NULL DEFAULT 'AUTO'"+ )+ validateForeignKeys(database, "providers")+ }+ }+val MIGRATION_52_53 = object : Migration(52, 53) {override fun migrate(database: SupportSQLiteDatabase) {addStalkerHardeningColumns(database, "movie_category_hydration")diff --git a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt b/data/src/main/java/com/streamvault/data/local/entity/Entities.ktindex 06dce474..3c7be61c 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@@ -11,6 +11,12 @@ import com.streamvault.domain.model.ProviderEpgSyncModeimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.StalkerPortalProfileimport com.streamvault.domain.model.ProviderXtreamLiveSyncMode@@ -40,11 +46,20 @@ data class ProviderEntity(@ColumnInfo(name = "stalker_signature") val stalkerSignature: String = "",@ColumnInfo(name = "stalker_auth_mode") val stalkerAuthMode: StalkerAuthMode = StalkerAuthMode.AUTO,@ColumnInfo(name = "stalker_portal_profile") val stalkerPortalProfile: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,+ @ColumnInfo(name = "stalker_portal_fingerprint") val stalkerPortalFingerprint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ @ColumnInfo(name = "stalker_mag_preset") val stalkerMagPreset: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ @ColumnInfo(name = "stalker_last_bootstrap_recipe") val stalkerLastBootstrapRecipe: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ @ColumnInfo(name = "stalker_endpoint_preference") val stalkerEndpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ @ColumnInfo(name = "stalker_cookie_mode") val stalkerCookieMode: StalkerCookieMode = StalkerCookieMode.NONE,+ @ColumnInfo(name = "stalker_playback_backend_hint") val stalkerPlaybackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,@ColumnInfo(name = "stalker_last_playback_mode") val stalkerLastPlaybackMode: String? = null,@ColumnInfo(name = "stalker_credentials_required") val stalkerCredentialsRequired: Boolean = false,@ColumnInfo(name = "stalker_mac_required") val stalkerMacRequired: Boolean = true,@ColumnInfo(name = "stalker_uses_temp_links") val stalkerUsesTemporaryLinks: Boolean = false,@ColumnInfo(name = "stalker_module_restricted") val stalkerModuleRestricted: Boolean = false,+ @ColumnInfo(name = "stalker_strict_fingerprint_required") val stalkerStrictFingerprintRequired: Boolean = false,+ @ColumnInfo(name = "stalker_recipe_fallback_used") val stalkerRecipeFallbackUsed: Boolean = false,+ @ColumnInfo(name = "stalker_recipe_rediscovery_attempts") val stalkerRecipeRediscoveryAttempts: Int = 0,@ColumnInfo(name = "is_active") val isActive: Boolean = true,@ColumnInfo(name = "max_connections") val maxConnections: Int = 1,@ColumnInfo(name = "expiration_date") val expirationDate: Long? = null,diff --git a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.ktindex d8935f54..26e339e2 100644--- a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt+++ b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt@@ -36,11 +36,20 @@ fun ProviderEntity.toDomain() = Provider(stalkerSignature = stalkerSignature,stalkerAuthMode = stalkerAuthMode,stalkerPortalProfile = stalkerPortalProfile,+ stalkerPortalFingerprint = stalkerPortalFingerprint,+ stalkerMagPreset = stalkerMagPreset,+ stalkerLastBootstrapRecipe = stalkerLastBootstrapRecipe,+ stalkerEndpointPreference = stalkerEndpointPreference,+ stalkerCookieMode = stalkerCookieMode,+ stalkerPlaybackBackendHint = stalkerPlaybackBackendHint,stalkerLastPlaybackMode = stalkerLastPlaybackMode,stalkerCredentialsRequired = stalkerCredentialsRequired,stalkerMacRequired = stalkerMacRequired,stalkerUsesTemporaryLinks = stalkerUsesTemporaryLinks,stalkerModuleRestricted = stalkerModuleRestricted,+ stalkerStrictFingerprintRequired = stalkerStrictFingerprintRequired,+ stalkerRecipeFallbackUsed = stalkerRecipeFallbackUsed,+ stalkerRecipeRediscoveryAttempts = stalkerRecipeRediscoveryAttempts,isActive = isActive,maxConnections = maxConnections,expirationDate = expirationDate,@@ -76,11 +85,20 @@ fun Provider.toEntity() = ProviderEntity(stalkerSignature = stalkerSignature,stalkerAuthMode = stalkerAuthMode,stalkerPortalProfile = stalkerPortalProfile,+ stalkerPortalFingerprint = stalkerPortalFingerprint,+ stalkerMagPreset = stalkerMagPreset,+ stalkerLastBootstrapRecipe = stalkerLastBootstrapRecipe,+ stalkerEndpointPreference = stalkerEndpointPreference,+ stalkerCookieMode = stalkerCookieMode,+ stalkerPlaybackBackendHint = stalkerPlaybackBackendHint,stalkerLastPlaybackMode = stalkerLastPlaybackMode,stalkerCredentialsRequired = stalkerCredentialsRequired,stalkerMacRequired = stalkerMacRequired,stalkerUsesTemporaryLinks = stalkerUsesTemporaryLinks,stalkerModuleRestricted = stalkerModuleRestricted,+ stalkerStrictFingerprintRequired = stalkerStrictFingerprintRequired,+ stalkerRecipeFallbackUsed = stalkerRecipeFallbackUsed,+ stalkerRecipeRediscoveryAttempts = stalkerRecipeRediscoveryAttempts,isActive = isActive,maxConnections = maxConnections,expirationDate = expirationDate,diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.kt b/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.ktindex 793e93ac..9624e555 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiService.kt@@ -7,6 +7,12 @@ import com.google.gson.stream.JsonReaderimport com.google.gson.stream.JsonTokenimport com.streamvault.domain.model.Resultimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.StalkerPortalProfileimport com.streamvault.domain.util.StreamEntryUrlPolicyimport java.io.ByteArrayOutputStream@@ -66,160 +72,293 @@ class OkHttpStalkerApiService @Inject constructor(var lastError: Throwable? = nullval authModes = candidateAuthModes(profile)for (effectiveAuthMode in authModes) {- val attemptProfile = profile.copy(authMode = effectiveAuthMode)- for (loadUrl in StalkerUrlFactory.loadUrlCandidates(profile.portalUrl)) {- cookieJar.clear()- val referer = StalkerUrlFactory.portalReferer(loadUrl)- val evidence = mutableListOf<String>()- val handshakePayload = runCatching {- requestJson(- url = loadUrl,- profile = attemptProfile,- referer = referer,- query = mapOf(- "type" to "stb",- "action" to "handshake",- "token" to "",- "JsHttpRequest" to "1-xml"- )- )- }.getOrElse { error ->- lastError = error- continue- }- evidence += "handshake"- val token = handshakePayload.findString("token")- ?.takeIf { it.isNotBlank() }- ?: run {- lastError = IOException("Portal handshake did not return a token.")- continue- }-- if (effectiveAuthMode.requiresCredentials()) {- if (attemptProfile.username.isBlank()) {- lastError = IOException("Portal requires account credentials for this connection.")- continue- }- val authPayload = runCatching {- requestCredentialAuth(+ for (attempt in candidateAuthAttempts(profile, effectiveAuthMode)) {+ val recipeIndex = attempt.recipeIndex+ val recipe = attempt.recipe+ val loadUrl = attempt.loadUrl+ cookieJar.clear()+ val referer = StalkerUrlFactory.portalReferer(loadUrl)+ val evidence = mutableListOf<String>()+ val recipeEvidence = mutableListOf("recipe:${recipe.recipe.name}", "preset:${recipe.magPreset.name}")+ val attemptProfile = profile.withRecipe(recipe, effectiveAuthMode)+ val handshakePayload = runCatching {+ requestJson(url = loadUrl,profile = attemptProfile,referer = referer,- token = token+ query = mapOf(+ "type" to "stb",+ "action" to "handshake",+ "token" to "",+ "JsHttpRequest" to "1-xml"+ ))}.getOrElse { error ->lastError = errorcontinue}- evidence += "do_auth"- authPayload.ensureNoPortalError()- }+ evidence += "handshake"+ val token = handshakePayload.findString("token")+ ?.takeIf { it.isNotBlank() }+ ?: run {+ lastError = IOException("Portal handshake did not return a token.")+ continue+ }- var session = StalkerSession(- loadUrl = loadUrl,- portalReferer = referer,- token = token- )- val profilePayload = runCatching {- requestJson(- url = loadUrl,- profile = attemptProfile,- referer = referer,- token = token,- query = buildProfileQuery(attemptProfile)+ if (recipe.authMode.requiresCredentials()) {+ if (attemptProfile.username.isBlank()) {+ lastError = IOException("Portal requires account credentials for this connection.")+ continue+ }+ val authPayload = runCatching {+ requestCredentialAuth(+ url = loadUrl,+ profile = attemptProfile,+ referer = referer,+ token = token+ )+ }.getOrElse { error ->+ lastError = error+ continue+ }+ evidence += "do_auth"+ authPayload.ensureNoPortalError()+ }++ var session = StalkerSession(+ loadUrl = loadUrl,+ portalReferer = referer,+ token = token)- }.getOrElse { error ->- lastError = error- continue- }- evidence += "get_profile"-- var providerProfile = profilePayload.toProviderProfile()- var bootstrapStrategy = when (effectiveAuthMode) {- StalkerAuthMode.MAC_ONLY -> StalkerBootstrapStrategy.MAC_ONLY- StalkerAuthMode.CREDENTIALS_ONLY,- StalkerAuthMode.MAC_PLUS_CREDENTIALS -> StalkerBootstrapStrategy.MAC_WITH_ACCOUNT_INFO- StalkerAuthMode.AUTO -> StalkerBootstrapStrategy.AUTO- }- if (providerProfile.shouldRequestAccountInfo()) {- runCatching {- requestJson(- url = loadUrl,- profile = attemptProfile,- referer = referer,- token = token,- query = mapOf(- "type" to "account_info",- "action" to "get_main_info",- "JsHttpRequest" to "1-xml"+ if (recipe.preferLocalizationBeforeProfile) {+ runCatching {+ requestJson(+ url = loadUrl,+ profile = attemptProfile,+ referer = referer,+ token = token,+ query = mapOf(+ "type" to "stb",+ "action" to "get_localization",+ "JsHttpRequest" to "1-xml"+ ))- )- }.getOrNull()?.let { accountInfoPayload ->- providerProfile = providerProfile.merge(accountInfoPayload.toProviderProfile())- bootstrapStrategy = StalkerBootstrapStrategy.MAC_WITH_ACCOUNT_INFO- evidence += "get_account_info"+ }.getOrNull()?.let {+ evidence += "get_localization"+ }}- }- if (providerProfile.shouldRequestModules()) {- runCatching {+ val profilePayload = runCatching {requestJson(url = loadUrl,profile = attemptProfile,referer = referer,token = token,- query = mapOf(- "type" to "stb",- "action" to "get_modules",- "JsHttpRequest" to "1-xml"- )+ query = buildProfileQuery(attemptProfile))- }.getOrNull()?.let { modulesPayload ->- val modules = modulesPayload.toModuleNames()- if (modules.isNotEmpty()) {- bootstrapStrategy = StalkerBootstrapStrategy.MAC_WITH_MODULES- evidence += "get_modules"+ }.getOrElse { error ->+ lastError = error+ continue+ }+ evidence += "get_profile"++ var providerProfile = profilePayload.toProviderProfile()+ var bootstrapStrategy = when (recipe.recipe) {+ StalkerBootstrapRecipe.GENERIC_SAFE -> StalkerBootstrapStrategy.AUTO+ StalkerBootstrapRecipe.LEGACY_MAG -> StalkerBootstrapStrategy.MAC_ONLY+ StalkerBootstrapRecipe.STRICT_MAG,+ StalkerBootstrapRecipe.PORTAL_PREFERRED,+ StalkerBootstrapRecipe.LOCALIZATION_STRICT,+ StalkerBootstrapRecipe.AUTH_ONLY,+ StalkerBootstrapRecipe.AUTH_STRICT_MAG -> StalkerBootstrapStrategy.MAC_WITH_ACCOUNT_INFO+ StalkerBootstrapRecipe.MODULE_GATED -> StalkerBootstrapStrategy.MAC_WITH_MODULES+ }+ if (recipe.requestAccountInfo || providerProfile.shouldRequestAccountInfo()) {+ runCatching {+ requestJson(+ url = loadUrl,+ profile = attemptProfile,+ referer = referer,+ token = token,+ query = mapOf(+ "type" to "account_info",+ "action" to "get_main_info",+ "JsHttpRequest" to "1-xml"+ )+ )+ }.getOrNull()?.let { accountInfoPayload ->+ providerProfile = providerProfile.merge(accountInfoPayload.toProviderProfile())+ bootstrapStrategy = StalkerBootstrapStrategy.MAC_WITH_ACCOUNT_INFO+ evidence += "get_account_info"+ }+ }+ if (recipe.requestLocalization && "get_localization" !in evidence) {+ runCatching {+ requestJson(+ url = loadUrl,+ profile = attemptProfile,+ referer = referer,+ token = token,+ query = mapOf(+ "type" to "stb",+ "action" to "get_localization",+ "JsHttpRequest" to "1-xml"+ )+ )+ }.getOrNull()?.let {+ evidence += "get_localization"+ }+ }+ if (recipe.requestModules || providerProfile.shouldRequestModules()) {+ runCatching {+ requestJson(+ url = loadUrl,+ profile = attemptProfile,+ referer = referer,+ token = token,+ query = mapOf(+ "type" to "stb",+ "action" to "get_modules",+ "JsHttpRequest" to "1-xml"+ )+ )+ }.getOrNull()?.let { modulesPayload ->+ val modules = modulesPayload.toModuleNames()+ if (modules.isNotEmpty()) {+ bootstrapStrategy = StalkerBootstrapStrategy.MAC_WITH_MODULES+ evidence += "get_modules"+ }+ providerProfile = providerProfile.copy(moduleNames = modules)+ }+ }+ if ((recipe.strictIdentityRequired || recipe.playbackBackendHint == StalkerPlaybackBackendHint.TEMP_LINK_STRICT) &&+ "get_events" !in evidence+ ) {+ runCatching {+ requestJson(+ url = loadUrl,+ profile = attemptProfile,+ referer = referer,+ token = token,+ query = mapOf(+ "type" to "stb",+ "action" to "get_events",+ "JsHttpRequest" to "1-xml"+ )+ )+ }.getOrNull()?.let {+ evidence += "get_events"}- providerProfile = providerProfile.copy(moduleNames = modules)}- }- val ambiguousState = providerProfile.isAmbiguousAccountState()- val portalProfile = resolvePortalProfile(- authMode = effectiveAuthMode,- providerProfile = providerProfile,- requestedProfile = attemptProfile- )- val credentialRequired = portalProfile == StalkerPortalProfile.AUTH_REQUIRED ||- portalProfile == StalkerPortalProfile.AUTH_PLUS_MAG- val macRequired = portalProfile != StalkerPortalProfile.AUTH_REQUIRED- if (effectiveAuthMode == StalkerAuthMode.MAC_ONLY && credentialRequired) {- lastError = IOException("Portal requires account credentials for this connection.")- continue- }- providerProfile = providerProfile.copy(- bootstrapStrategy = bootstrapStrategy,- effectiveAuthMode = effectiveAuthMode,- portalProfile = portalProfile,- credentialRequired = credentialRequired,- macRequired = macRequired,- bootstrapEvidence = evidence.toList(),- portalCapabilities = providerProfile.portalCapabilities.copy(+ val fingerprint = detectPortalFingerprint(+ profile = providerProfile,+ effectiveAuthMode = effectiveAuthMode,+ selectedPreset = recipe.magPreset,+ selectedRecipe = recipe.recipe+ )+ val portalProfile = profileForFingerprint(fingerprint)+ val ambiguousState = providerProfile.isAmbiguousAccountState()+ val credentialRequired = portalProfile == StalkerPortalProfile.AUTH_REQUIRED ||+ portalProfile == StalkerPortalProfile.AUTH_PLUS_MAG+ val macRequired = portalProfile != StalkerPortalProfile.AUTH_REQUIRED+ if (effectiveAuthMode == StalkerAuthMode.MAC_ONLY &&+ attemptProfile.username.isNotBlank() &&+ ambiguousState+ ) {+ lastError = IOException("Portal partially accepted MAC identity; retrying credential-backed auth.")+ continue+ }+ if (effectiveAuthMode == StalkerAuthMode.MAC_ONLY && credentialRequired) {+ lastError = IOException("Portal requires account credentials for this connection.")+ continue+ }+ val fallbackRecipeUsed = recipeIndex > 0+ val rediscoveryAttempted = fallbackRecipeUsed || profile.bootstrapRecipe != StalkerBootstrapRecipe.GENERIC_SAFE+ if (fallbackRecipeUsed) {+ recipeEvidence += "fallback_recipe"+ }+ if (rediscoveryAttempted) {+ recipeEvidence += "rediscovery_attempted"+ }+ val fingerprintEvidence = StalkerFingerprintEvidence(+ endpointPreference = endpointPreferenceFor(loadUrl),+ cookieMode = resolveCookieMode(+ base = attemptProfile.cookieMode,+ serverCookieHeader = cookieJar.cookieHeaderFor(loadUrl),+ recipe = recipe+ ),+ playbackBackendHint = attemptProfile.playbackBackendHint,+ localizationRequired = "get_localization" in evidence,+ modulesRequired = "get_modules" in evidence,+ alternateEndpointAccepted = loadUrl != StalkerUrlFactory.loadUrlCandidates(profile.portalUrl).firstOrNull(),+ genericPresetRejected = fallbackRecipeUsed && recipe.magPreset != StalkerMagPreset.GENERIC_SAFE,+ strictPresetAccepted = recipe.magPreset != StalkerMagPreset.GENERIC_SAFE,+ archiveViaCreateLink = recipe.playbackBackendHint != StalkerPlaybackBackendHint.DIRECT ||+ providerProfile.portalCapabilities.archiveAvailable ||+ providerProfile.portalCapabilities.allowLocalTimeshift ||+ providerProfile.portalCapabilities.allowLocalPvr ||+ providerProfile.portalCapabilities.allowRemotePvr,+ archiveViaDirectUrl = recipe.playbackBackendHint == StalkerPlaybackBackendHint.DIRECT,+ archiveRequiresBootstrapPrep = "get_localization" in evidence || "get_modules" in evidence,+ archiveRequiresStrictCookies = resolveCookieMode(+ base = attemptProfile.cookieMode,+ serverCookieHeader = cookieJar.cookieHeaderFor(loadUrl),+ recipe = recipe+ ) in setOf(StalkerCookieMode.PLAYBACK, StalkerCookieMode.BOTH),+ archiveEndpointPreference = endpointPreferenceFor(loadUrl)+ )+ providerProfile = providerProfile.copy(bootstrapStrategy = bootstrapStrategy,- moduleRestricted = providerProfile.moduleNames.isNotEmpty(),- ambiguousAccountState = ambiguousState- ),- ambiguousState = ambiguousState- )- session = session.copy(- serverCookieHeader = cookieJar.cookieHeaderFor(loadUrl),- effectiveAuthMode = effectiveAuthMode,- portalProfile = portalProfile,- bootstrapEvidence = evidence.toList()- )- return Result.success(session to providerProfile)+ effectiveAuthMode = effectiveAuthMode,+ portalProfile = portalProfile,+ portalFingerprint = fingerprint,+ magPreset = recipe.magPreset,+ bootstrapRecipe = recipe.recipe,+ fingerprintEvidence = fingerprintEvidence,+ credentialRequired = credentialRequired,+ macRequired = macRequired,+ bootstrapEvidence = evidence.toList(),+ recipeEvidence = recipeEvidence.toList(),+ strictFingerprintRequired = recipe.strictIdentityRequired,+ fallbackRecipeUsed = fallbackRecipeUsed,+ rediscoveryAttempted = rediscoveryAttempted,+ portalCapabilities = providerProfile.portalCapabilities.copy(+ bootstrapStrategy = bootstrapStrategy,+ moduleRestricted = providerProfile.moduleNames.isNotEmpty(),+ ambiguousAccountState = ambiguousState+ ),+ ambiguousState = ambiguousState+ )+ session = session.copy(+ serverCookieHeader = cookieJar.cookieHeaderFor(loadUrl),+ effectiveAuthMode = effectiveAuthMode,+ portalProfile = portalProfile,+ portalFingerprint = fingerprint,+ magPreset = recipe.magPreset,+ bootstrapRecipe = recipe.recipe,+ fingerprintEvidence = fingerprintEvidence,+ bootstrapEvidence = evidence.toList(),+ recipeEvidence = recipeEvidence.toList(),+ rediscoveryAttempted = rediscoveryAttempted+ )+ Log.i(+ TAG,+ "Stalker auth success host=${runCatching { URI(loadUrl).host }.getOrNull().orEmpty()} " ++ "auth=${effectiveAuthMode.name} recipe=${recipe.recipe.name} preset=${recipe.magPreset.name} " ++ "profile=${attemptProfile.deviceProfile} endpoint=${endpointPreferenceFor(loadUrl).name} " ++ "cookie=${fingerprintEvidence.cookieMode.name} backend=${fingerprintEvidence.playbackBackendHint.name} " ++ "bootstrap=${evidence.joinToString(",")}"+ )+ return Result.success(session to providerProfile)}}+ Log.w(+ TAG,+ "Stalker auth failed host=${runCatching { URI(profile.portalUrl).host }.getOrNull().orEmpty()} " ++ "hintRecipe=${profile.bootstrapRecipe.name} hintPreset=${profile.magPreset.name} " ++ "hintFingerprint=${profile.portalFingerprint.name} error=${lastError?.message.orEmpty()}"+ )return Result.error(lastError?.message ?: "Failed to connect to portal.",lastError@@ -607,10 +746,13 @@ class OkHttpStalkerApiService @Inject constructor(profile: StalkerDeviceProfile,kind: StalkerStreamKind,cmd: String,- seriesNumber: Int?+ seriesNumber: Int?,+ archiveStartSeconds: Long?,+ archiveEndSeconds: Long?): Result<String> = runApiCall("Failed to resolve playback link") {val type = when (kind) {- StalkerStreamKind.LIVE -> "itv"+ StalkerStreamKind.LIVE,+ StalkerStreamKind.ARCHIVE -> "itv"StalkerStreamKind.MOVIE, StalkerStreamKind.EPISODE -> "vod"}val seriesSelector = if (kind == StalkerStreamKind.EPISODE) {@@ -639,14 +781,26 @@ class OkHttpStalkerApiService @Inject constructor(?.trim()?.takeIf { it.isNotBlank() }?.let { resolved ->- if (!StreamEntryUrlPolicy.isAllowed(resolved)) {+ val playbackUrl = if (kind == StalkerStreamKind.ARCHIVE) {+ appendArchiveWindow(+ url = resolved,+ startSeconds = archiveStartSeconds,+ endSeconds = archiveEndSeconds+ ) ?: resolved+ } else {+ resolved+ }+ if (!StreamEntryUrlPolicy.isAllowed(playbackUrl)) {throw IOException("Portal returned an unsupported playback URL scheme for create_link.")}- resolved+ playbackUrl}?: throw IOException("Portal did not return a playable URL.")}+ override fun currentCookieHeader(session: StalkerSession): String =+ cookieJar.cookieHeaderFor(session.loadUrl).ifBlank { session.serverCookieHeader }+private suspend fun fetchPagedItems(session: StalkerSession,profile: StalkerDeviceProfile,@@ -1239,29 +1393,34 @@ class OkHttpStalkerApiService @Inject constructor(private fun buildProfileQuery(profile: StalkerDeviceProfile): Map<String, String> {val timestamp = (System.currentTimeMillis() / 1000L).toString()+ val preset = stalkerMagPresetSpec(profile.magPreset)+ val metrics = buildMetricsJson(profile, preset)return mapOf("type" to "stb","action" to "get_profile","JsHttpRequest" to "1-xml","hd" to "1",- "ver" to DEFAULT_VERSION_STRING,- "num_banks" to "2",+ "ver" to preset.versionString,"sn" to profile.serialNumber,"stb_type" to profile.deviceProfile,"client_type" to "STB",- "image_version" to "218",+ "image_version" to preset.imageVersion,"video_out" to "hdmi","device_id" to profile.deviceId,"device_id2" to profile.deviceId2,"signature" to profile.signature,"auth_second_step" to "1",- "hw_version" to "1.7-BD-00",+ "hw_version" to preset.hwVersion,"not_valid_token" to "0",- "metrics" to "{}",- "hw_version_2" to profile.deviceProfile,+ "metrics" to metrics,+ "hw_version_2" to preset.hwVersion,"timestamp" to timestamp,- "api_signature" to "262",- "prehash" to "0"+ "api_signature" to preset.apiSignature,+ "prehash" to if (preset.requireStrictIdentity) "1" else "0",+ "num_banks" to "2",+ "player_version" to preset.imageVersion,+ "stb_lang" to profile.locale.ifBlank { preset.localization.substringBefore('.') },+ "locale" to preset.localization)}@@ -1324,6 +1483,27 @@ class OkHttpStalkerApiService @Inject constructor(}}+ private fun buildMetricsJson(+ profile: StalkerDeviceProfile,+ preset: StalkerMagPresetSpec+ ): String {+ if (preset.metricsJson != "{}") {+ return preset.metricsJson+ }+ return buildString {+ append('{')+ append("\"mac\":\"").append(profile.macAddress).append("\",")+ append("\"sn\":\"").append(profile.serialNumber).append("\",")+ append("\"model\":\"").append(profile.deviceProfile).append("\",")+ append("\"type\":\"STB\",")+ append("\"uid\":\"").append(profile.deviceId.take(16)).append("\",")+ append("\"random\":\"").append(profile.deviceId2.take(16)).append("\",")+ append("\"signature\":\"").append(profile.signature.take(16)).append("\",")+ append("\"video_out\":\"hdmi\"")+ append('}')+ }+ }+private fun captureResponseCookies(response: Response) {val cookies = Cookie.parseAll(response.request.url, response.headers)if (cookies.isNotEmpty()) {@@ -1983,8 +2163,8 @@ class OkHttpStalkerApiService @Inject constructor(StalkerAuthMode.AUTO -> buildList {val hasMac = profile.macAddress.isNotBlank()val hasCredentials = profile.username.isNotBlank()- if (hasMac) add(StalkerAuthMode.MAC_ONLY)if (hasMac && hasCredentials) add(StalkerAuthMode.MAC_PLUS_CREDENTIALS)+ if (hasMac) add(StalkerAuthMode.MAC_ONLY)if (hasCredentials) add(StalkerAuthMode.CREDENTIALS_ONLY)if (isEmpty()) add(StalkerAuthMode.MAC_ONLY)}@@ -1992,6 +2172,132 @@ class OkHttpStalkerApiService @Inject constructor(}.distinct()}+ private fun candidateRecipes(+ profile: StalkerDeviceProfile,+ effectiveAuthMode: StalkerAuthMode+ ): List<StalkerRecipeSpec> {+ val defaultRecipe = defaultRecipeFor(+ authMode = effectiveAuthMode,+ fingerprintHint = profile.portalFingerprint,+ presetHint = profile.magPreset+ ).copy(+ recipe = profile.bootstrapRecipe.takeUnless { it == StalkerBootstrapRecipe.GENERIC_SAFE }+ ?: defaultRecipeFor(+ authMode = effectiveAuthMode,+ fingerprintHint = profile.portalFingerprint,+ presetHint = profile.magPreset+ ).recipe,+ magPreset = profile.magPreset.takeUnless { it == StalkerMagPreset.GENERIC_SAFE }+ ?: defaultRecipeFor(+ authMode = effectiveAuthMode,+ fingerprintHint = profile.portalFingerprint,+ presetHint = profile.magPreset+ ).magPreset+ )+ return (listOf(defaultRecipe) + fallbackRecipesFor(effectiveAuthMode))+ .distinctBy { "${it.recipe}:${it.magPreset}:${it.authMode}" }+ }++ private fun candidateAuthAttempts(+ profile: StalkerDeviceProfile,+ effectiveAuthMode: StalkerAuthMode+ ): List<StalkerAuthAttempt> {+ val recipes = candidateRecipes(profile, effectiveAuthMode)+ val defaultRecipe = recipes.firstOrNull() ?: return emptyList()+ val hasLearnedEndpointPreference = profile.endpointPreference != StalkerEndpointPreference.AUTO ||+ defaultRecipe.endpointPreference != StalkerEndpointPreference.AUTO+ return if (hasLearnedEndpointPreference) {+ recipes.flatMapIndexed { recipeIndex, recipe ->+ orderedLoadUrlCandidates(profile, recipe).map { loadUrl ->+ StalkerAuthAttempt(recipeIndex, recipe, loadUrl)+ }+ }+ } else {+ orderedLoadUrlCandidates(profile, defaultRecipe).flatMap { loadUrl ->+ recipes.mapIndexed { recipeIndex, recipe ->+ StalkerAuthAttempt(recipeIndex, recipe, loadUrl)+ }+ }+ }+ }++ private fun orderedLoadUrlCandidates(+ profile: StalkerDeviceProfile,+ recipe: StalkerRecipeSpec+ ): List<String> {+ val baseCandidates = StalkerUrlFactory.loadUrlCandidates(profile.portalUrl)+ val preferred = recipe.endpointPreference.takeUnless { it == StalkerEndpointPreference.AUTO }+ ?: profile.endpointPreference+ return when (preferred) {+ StalkerEndpointPreference.PORTAL ->+ baseCandidates.sortedByDescending { candidate -> candidate.lowercase(Locale.ROOT).endsWith("/portal.php") }+ StalkerEndpointPreference.SERVER_LOAD ->+ baseCandidates.sortedByDescending { candidate -> candidate.lowercase(Locale.ROOT).endsWith("/server/load.php") }+ StalkerEndpointPreference.AUTO -> baseCandidates+ }+ }++ private data class StalkerAuthAttempt(+ val recipeIndex: Int,+ val recipe: StalkerRecipeSpec,+ val loadUrl: String+ )++ private fun endpointPreferenceFor(loadUrl: String): StalkerEndpointPreference =+ when {+ loadUrl.lowercase(Locale.ROOT).endsWith("/portal.php") -> StalkerEndpointPreference.PORTAL+ loadUrl.lowercase(Locale.ROOT).endsWith("/server/load.php") -> StalkerEndpointPreference.SERVER_LOAD+ else -> StalkerEndpointPreference.AUTO+ }++ private fun appendArchiveWindow(+ url: String,+ startSeconds: Long?,+ endSeconds: Long?+ ): String? {+ if (startSeconds == null || startSeconds <= 0L) {+ return url+ }+ val endValue = endSeconds?.takeIf { it > 0L } ?: startSeconds+ val separator = if ('?' in url) '&' else '?'+ val existingUtc = Regex("""([?&])utc=\d+""")+ val existingLutc = Regex("""([?&])lutc=\d+""")+ val withUtc = if (existingUtc.containsMatchIn(url)) {+ existingUtc.replace(url) { match ->+ "${match.groupValues[1]}utc=$startSeconds"+ }+ } else {+ "$url${separator}utc=$startSeconds"+ }+ return if (existingLutc.containsMatchIn(withUtc)) {+ existingLutc.replace(withUtc) { match ->+ "${match.groupValues[1]}lutc=$endValue"+ }+ } else {+ val lutcSeparator = if ('?' in withUtc) '&' else '?'+ "$withUtc${lutcSeparator}lutc=$endValue"+ }+ }++ private fun resolveCookieMode(+ base: StalkerCookieMode,+ serverCookieHeader: String,+ recipe: StalkerRecipeSpec+ ): StalkerCookieMode {+ val hasServerCookies = serverCookieHeader.isNotBlank()+ if (!hasServerCookies) return base+ return when {+ recipe.playbackBackendHint in setOf(+ StalkerPlaybackBackendHint.PLAY_LIVE,+ StalkerPlaybackBackendHint.PLAY_MOVIE,+ StalkerPlaybackBackendHint.TEMP_LINK,+ StalkerPlaybackBackendHint.TEMP_LINK_STRICT+ ) && base == StalkerCookieMode.CREATE_LINK -> StalkerCookieMode.BOTH+ recipe.playbackBackendHint != StalkerPlaybackBackendHint.AUTO -> StalkerCookieMode.PLAYBACK+ else -> StalkerCookieMode.CREATE_LINK+ }+ }+private fun StalkerAuthMode.requiresCredentials(): Boolean =this == StalkerAuthMode.CREDENTIALS_ONLY || this == StalkerAuthMode.MAC_PLUS_CREDENTIALS@@ -2048,6 +2354,12 @@ internal fun buildStalkerDeviceProfile(portalUrl: String,macAddress: String,authMode: StalkerAuthMode = StalkerAuthMode.AUTO,+ magPresetHint: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ portalFingerprintHint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ bootstrapRecipeHint: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ endpointPreferenceHint: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ cookieModeHint: StalkerCookieMode = StalkerCookieMode.NONE,+ playbackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,username: String = "",password: String = "",deviceProfile: String,@@ -2058,10 +2370,23 @@ internal fun buildStalkerDeviceProfile(deviceId2Override: String = "",signatureOverride: String = ""): StalkerDeviceProfile {- val normalizedProfile = deviceProfile.ifBlank { "MAG250" }+ val preset = stalkerMagPresetSpec(magPresetHint)+ val normalizedInputProfile = deviceProfile.trim()+ val normalizedProfile = when {+ normalizedInputProfile.isBlank() -> preset.defaultDeviceProfile+ magPresetHint != StalkerMagPreset.GENERIC_SAFE && normalizedInputProfile.equals("MAG250", ignoreCase = true) ->+ preset.defaultDeviceProfile+ else -> normalizedInputProfile+ }val normalizedTimezone = timezone.ifBlank { java.util.TimeZone.getDefault().id }val normalizedLocale = locale.ifBlank { Locale.getDefault().language.ifBlank { "en" } }val normalizedMac = macAddress.uppercase(Locale.ROOT)+ val normalizedUsername = username.trim()+ val effectiveAuthMode = sanitizeStalkerAuthMode(+ requested = authMode,+ normalizedMac = normalizedMac,+ normalizedUsername = normalizedUsername+ )val serialSeed = normalizedMac.replace(":", "").ifBlank { username.trim().uppercase(Locale.ROOT) }val serialNumber = serialNumberOverride.ifBlank { serialSeed.takeLast(13).padStart(13, '0') }val deviceId = deviceIdOverride.ifBlank { stalkerDigest("device:$normalizedProfile:$normalizedMac") }@@ -2070,8 +2395,14 @@ internal fun buildStalkerDeviceProfile(return StalkerDeviceProfile(portalUrl = portalUrl,macAddress = normalizedMac,- authMode = authMode,- username = username.trim(),+ authMode = effectiveAuthMode,+ magPreset = magPresetHint,+ portalFingerprint = portalFingerprintHint,+ bootstrapRecipe = bootstrapRecipeHint,+ endpointPreference = endpointPreferenceHint,+ cookieMode = cookieModeHint,+ playbackBackendHint = playbackBackendHint,+ username = normalizedUsername,password = password,deviceProfile = normalizedProfile,timezone = normalizedTimezone,@@ -2080,11 +2411,71 @@ internal fun buildStalkerDeviceProfile(deviceId = deviceId,deviceId2 = deviceId2,signature = signature,- userAgent = "Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) $normalizedProfile stbapp ver: 2 rev: 250 Safari/533.3",+ userAgent = "Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) $normalizedProfile stbapp ver: 2 rev: ${preset.imageVersion} Safari/533.3",xUserAgent = "Model: $normalizedProfile; Link: Ethernet")}+private fun sanitizeStalkerAuthMode(+ requested: StalkerAuthMode,+ normalizedMac: String,+ normalizedUsername: String+): StalkerAuthMode {+ val hasMac = normalizedMac.isNotBlank()+ val hasCredentials = normalizedUsername.isNotBlank()+ return when (requested) {+ StalkerAuthMode.AUTO -> StalkerAuthMode.AUTO+ StalkerAuthMode.MAC_ONLY -> when {+ hasMac -> StalkerAuthMode.MAC_ONLY+ hasCredentials -> StalkerAuthMode.CREDENTIALS_ONLY+ else -> StalkerAuthMode.AUTO+ }+ StalkerAuthMode.MAC_PLUS_CREDENTIALS -> when {+ hasMac && hasCredentials -> StalkerAuthMode.MAC_PLUS_CREDENTIALS+ hasMac -> StalkerAuthMode.MAC_ONLY+ hasCredentials -> StalkerAuthMode.CREDENTIALS_ONLY+ else -> StalkerAuthMode.AUTO+ }+ StalkerAuthMode.CREDENTIALS_ONLY -> when {+ hasCredentials -> StalkerAuthMode.CREDENTIALS_ONLY+ hasMac -> StalkerAuthMode.MAC_ONLY+ else -> StalkerAuthMode.AUTO+ }+ }+}++private fun StalkerDeviceProfile.withRecipe(+ recipe: StalkerRecipeSpec,+ effectiveAuthMode: StalkerAuthMode+): StalkerDeviceProfile {+ return buildStalkerDeviceProfile(+ portalUrl = portalUrl,+ macAddress = macAddress,+ authMode = effectiveAuthMode,+ magPresetHint = recipe.magPreset,+ portalFingerprintHint = portalFingerprint,+ bootstrapRecipeHint = recipe.recipe,+ endpointPreferenceHint = recipe.endpointPreference.takeUnless {+ it == StalkerEndpointPreference.AUTO+ } ?: endpointPreference,+ cookieModeHint = recipe.cookieMode.takeUnless {+ it == StalkerCookieMode.NONE+ } ?: cookieMode,+ playbackBackendHint = recipe.playbackBackendHint.takeUnless {+ it == StalkerPlaybackBackendHint.AUTO+ } ?: playbackBackendHint,+ username = username,+ password = password,+ deviceProfile = deviceProfile,+ timezone = timezone,+ locale = locale,+ serialNumberOverride = serialNumber,+ deviceIdOverride = "",+ deviceId2Override = "",+ signatureOverride = ""+ )+}+private fun stalkerDigest(seed: String): String =MessageDigest.getInstance("SHA-256").digest(seed.toByteArray(Charsets.UTF_8))diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.ktindex 1e4aea81..48eef2f0 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerApiService.kt@@ -2,12 +2,24 @@ package com.streamvault.data.remote.stalkerimport com.streamvault.domain.model.Resultimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.StalkerPortalProfiledata class StalkerDeviceProfile(val portalUrl: String,val macAddress: String,val authMode: StalkerAuthMode,+ val magPreset: StalkerMagPreset,+ val portalFingerprint: StalkerPortalFingerprint,+ val bootstrapRecipe: StalkerBootstrapRecipe,+ val endpointPreference: StalkerEndpointPreference,+ val cookieMode: StalkerCookieMode,+ val playbackBackendHint: StalkerPlaybackBackendHint,val username: String,val password: String,val deviceProfile: String,@@ -28,7 +40,29 @@ data class StalkerSession(val serverCookieHeader: String = "",val effectiveAuthMode: StalkerAuthMode = StalkerAuthMode.AUTO,val portalProfile: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,- val bootstrapEvidence: List<String> = emptyList()+ val portalFingerprint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ val magPreset: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ val bootstrapRecipe: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ val fingerprintEvidence: StalkerFingerprintEvidence = StalkerFingerprintEvidence(),+ val bootstrapEvidence: List<String> = emptyList(),+ val recipeEvidence: List<String> = emptyList(),+ val rediscoveryAttempted: Boolean = false+)++data class StalkerFingerprintEvidence(+ val endpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ val cookieMode: StalkerCookieMode = StalkerCookieMode.NONE,+ val playbackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,+ val localizationRequired: Boolean = false,+ val modulesRequired: Boolean = false,+ val alternateEndpointAccepted: Boolean = false,+ val genericPresetRejected: Boolean = false,+ val strictPresetAccepted: Boolean = false,+ val archiveViaCreateLink: Boolean = false,+ val archiveViaDirectUrl: Boolean = false,+ val archiveRequiresBootstrapPrep: Boolean = false,+ val archiveRequiresStrictCookies: Boolean = false,+ val archiveEndpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO)data class StalkerProviderProfile(@@ -42,10 +76,18 @@ data class StalkerProviderProfile(val bootstrapStrategy: StalkerBootstrapStrategy = StalkerBootstrapStrategy.AUTO,val effectiveAuthMode: StalkerAuthMode = StalkerAuthMode.AUTO,val portalProfile: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,+ val portalFingerprint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ val magPreset: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ val bootstrapRecipe: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ val fingerprintEvidence: StalkerFingerprintEvidence = StalkerFingerprintEvidence(),val portalCapabilities: StalkerPortalCapabilities = StalkerPortalCapabilities(),val credentialRequired: Boolean = false,val macRequired: Boolean = true,val bootstrapEvidence: List<String> = emptyList(),+ val recipeEvidence: List<String> = emptyList(),+ val strictFingerprintRequired: Boolean = false,+ val fallbackRecipeUsed: Boolean = false,+ val rediscoveryAttempted: Boolean = false,val ambiguousState: Boolean = false)@@ -252,6 +294,10 @@ interface StalkerApiService {profile: StalkerDeviceProfile,kind: StalkerStreamKind,cmd: String,- seriesNumber: Int? = null+ seriesNumber: Int? = null,+ archiveStartSeconds: Long? = null,+ archiveEndSeconds: Long? = null): Result<String>++ fun currentCookieHeader(session: StalkerSession): String = session.serverCookieHeader}diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerCompatibility.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerCompatibility.ktindex bb94268e..73d1c241 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerCompatibility.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerCompatibility.kt@@ -13,6 +13,8 @@ enum class StalkerBootstrapStrategy {enum class StalkerPlaybackMode {DIRECT_URL,LOCALHOST_CMD,+ PLAY_LIVE_PORTAL,+ PLAY_MOVIE_PORTAL,TEMP_LINK_NGINX,TEMP_LINK_FLUSSONIC,TEMP_LINK_WOWZA,@@ -105,6 +107,12 @@ internal fun detectStalkerPlaybackMode(host.isBlank() || host == "localhost" || host == "127.0.0.1" || host == "0.0.0.0" ->StalkerPlaybackMode.LOCALHOST_CMD+ path.endsWith("/play/live.php") ->+ StalkerPlaybackMode.PLAY_LIVE_PORTAL++ path.endsWith("/play/movie.php") ->+ StalkerPlaybackMode.PLAY_MOVIE_PORTAL+capabilities.flussonicTemporaryLink ->StalkerPlaybackMode.TEMP_LINK_FLUSSONIC@@ -133,6 +141,8 @@ internal fun orderStalkerCommandVariants(private fun playbackModeRank(mode: StalkerPlaybackMode): Int = when (mode) {StalkerPlaybackMode.DIRECT_URL -> 0StalkerPlaybackMode.MULTI_CMD -> 1+ StalkerPlaybackMode.PLAY_LIVE_PORTAL,+ StalkerPlaybackMode.PLAY_MOVIE_PORTAL,StalkerPlaybackMode.LOCALHOST_CMD -> 2StalkerPlaybackMode.TEMP_LINK_NGINX,StalkerPlaybackMode.TEMP_LINK_FLUSSONIC,diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackAdapters.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackAdapters.ktindex 68b0ff64..975f1313 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackAdapters.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackAdapters.kt@@ -1,6 +1,8 @@package com.streamvault.data.remote.stalkerimport com.streamvault.domain.model.StalkerPortalProfile+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerPlaybackBackendHintinternal interface StalkerPlaybackAdapter {val adapterMode: StalkerPlaybackMode@@ -9,7 +11,9 @@ internal interface StalkerPlaybackAdapter {descriptor: StalkerPlaybackDescriptor,variant: StalkerCommandVariant,portalProfileHint: StalkerPortalProfile,- preferredMode: StalkerPlaybackMode?+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode): Booleanfun allowsDirectBypass(variant: StalkerCommandVariant): Boolean@@ -31,7 +35,9 @@ internal object DirectOrCreateLinkAdapter : StalkerPlaybackAdapter {descriptor: StalkerPlaybackDescriptor,variant: StalkerCommandVariant,portalProfileHint: StalkerPortalProfile,- preferredMode: StalkerPlaybackMode?+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode): Boolean = variant.playbackMode == StalkerPlaybackMode.DIRECT_URL ||variant.playbackMode == StalkerPlaybackMode.LOCALHOST_CMD ||descriptor.primaryMode == StalkerPlaybackMode.MULTI_CMD@@ -43,6 +49,63 @@ internal object DirectOrCreateLinkAdapter : StalkerPlaybackAdapter {variant.playbackMode != StalkerPlaybackMode.DIRECT_URL}+internal object CookieAwareDirectAdapter : StalkerPlaybackAdapter {+ override val adapterMode: StalkerPlaybackMode = StalkerPlaybackMode.DIRECT_URL++ override fun matches(+ descriptor: StalkerPlaybackDescriptor,+ variant: StalkerCommandVariant,+ portalProfileHint: StalkerPortalProfile,+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode+ ): Boolean = variant.playbackMode == StalkerPlaybackMode.DIRECT_URL &&+ backendHint == StalkerPlaybackBackendHint.DIRECT &&+ cookieModeHint in setOf(StalkerCookieMode.PLAYBACK, StalkerCookieMode.BOTH)++ override fun allowsDirectBypass(variant: StalkerCommandVariant): Boolean = true++ override fun requiresCreateLink(variant: StalkerCommandVariant): Boolean = false+}++internal object PlayLivePortalAdapter : StalkerPlaybackAdapter {+ override val adapterMode: StalkerPlaybackMode = StalkerPlaybackMode.PLAY_LIVE_PORTAL++ override fun matches(+ descriptor: StalkerPlaybackDescriptor,+ variant: StalkerCommandVariant,+ portalProfileHint: StalkerPortalProfile,+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode+ ): Boolean = variant.playbackMode == StalkerPlaybackMode.PLAY_LIVE_PORTAL ||+ backendHint == StalkerPlaybackBackendHint.PLAY_LIVE++ override fun allowsDirectBypass(variant: StalkerCommandVariant): Boolean = true++ override fun requiresCreateLink(variant: StalkerCommandVariant): Boolean =+ variant.playbackMode != StalkerPlaybackMode.PLAY_LIVE_PORTAL+}++internal object PlayMoviePortalAdapter : StalkerPlaybackAdapter {+ override val adapterMode: StalkerPlaybackMode = StalkerPlaybackMode.PLAY_MOVIE_PORTAL++ override fun matches(+ descriptor: StalkerPlaybackDescriptor,+ variant: StalkerCommandVariant,+ portalProfileHint: StalkerPortalProfile,+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode+ ): Boolean = variant.playbackMode == StalkerPlaybackMode.PLAY_MOVIE_PORTAL ||+ backendHint == StalkerPlaybackBackendHint.PLAY_MOVIE++ override fun allowsDirectBypass(variant: StalkerCommandVariant): Boolean = true++ override fun requiresCreateLink(variant: StalkerCommandVariant): Boolean =+ variant.playbackMode != StalkerPlaybackMode.PLAY_MOVIE_PORTAL+}+internal object NginxSecureLinkAdapter : StalkerPlaybackAdapter {override val adapterMode: StalkerPlaybackMode = StalkerPlaybackMode.TEMP_LINK_NGINX@@ -50,7 +113,9 @@ internal object NginxSecureLinkAdapter : StalkerPlaybackAdapter {descriptor: StalkerPlaybackDescriptor,variant: StalkerCommandVariant,portalProfileHint: StalkerPortalProfile,- preferredMode: StalkerPlaybackMode?+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode): Boolean = variant.playbackMode == StalkerPlaybackMode.TEMP_LINK_NGINX ||descriptor.capabilities.nginxSecureLink ||descriptor.capabilities.useHttpTemporaryLink ||@@ -68,7 +133,9 @@ internal object FlussonicTemporaryLinkAdapter : StalkerPlaybackAdapter {descriptor: StalkerPlaybackDescriptor,variant: StalkerCommandVariant,portalProfileHint: StalkerPortalProfile,- preferredMode: StalkerPlaybackMode?+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode): Boolean = variant.playbackMode == StalkerPlaybackMode.TEMP_LINK_FLUSSONIC ||descriptor.capabilities.flussonicTemporaryLink@@ -84,7 +151,9 @@ internal object WowzaTemporaryLinkAdapter : StalkerPlaybackAdapter {descriptor: StalkerPlaybackDescriptor,variant: StalkerCommandVariant,portalProfileHint: StalkerPortalProfile,- preferredMode: StalkerPlaybackMode?+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode): Boolean = variant.playbackMode == StalkerPlaybackMode.TEMP_LINK_WOWZA ||descriptor.capabilities.wowzaTemporaryLink@@ -97,20 +166,28 @@ internal fun resolveStalkerPlaybackAdapter(descriptor: StalkerPlaybackDescriptor,variant: StalkerCommandVariant,portalProfileHint: StalkerPortalProfile,- preferredMode: StalkerPlaybackMode?+ preferredMode: StalkerPlaybackMode?,+ backendHint: StalkerPlaybackBackendHint,+ cookieModeHint: StalkerCookieMode): StalkerPlaybackAdapter {val ordered = buildList {if (preferredMode != null) {adapterForMode(preferredMode)?.let(::add)}+ adapterForBackendHint(backendHint)?.let(::add)add(when (variant.playbackMode) {StalkerPlaybackMode.TEMP_LINK_FLUSSONIC -> FlussonicTemporaryLinkAdapterStalkerPlaybackMode.TEMP_LINK_WOWZA -> WowzaTemporaryLinkAdapterStalkerPlaybackMode.TEMP_LINK_NGINX -> NginxSecureLinkAdapter+ StalkerPlaybackMode.PLAY_LIVE_PORTAL -> PlayLivePortalAdapter+ StalkerPlaybackMode.PLAY_MOVIE_PORTAL -> PlayMoviePortalAdapterelse -> DirectOrCreateLinkAdapter})+ if (cookieModeHint in setOf(StalkerCookieMode.PLAYBACK, StalkerCookieMode.BOTH)) {+ add(CookieAwareDirectAdapter)+ }if (portalProfileHint == StalkerPortalProfile.MAG_STRICT) add(NginxSecureLinkAdapter)if (descriptor.capabilities.flussonicTemporaryLink) add(FlussonicTemporaryLinkAdapter)if (descriptor.capabilities.wowzaTemporaryLink) add(WowzaTemporaryLinkAdapter)@@ -120,7 +197,7 @@ internal fun resolveStalkerPlaybackAdapter(add(DirectOrCreateLinkAdapter)}.distinctBy { it.adapterMode }return ordered.firstOrNull { adapter ->- adapter.matches(descriptor, variant, portalProfileHint, preferredMode)+ adapter.matches(descriptor, variant, portalProfileHint, preferredMode, backendHint, cookieModeHint)} ?: DirectOrCreateLinkAdapter}@@ -128,7 +205,18 @@ private fun adapterForMode(mode: StalkerPlaybackMode): StalkerPlaybackAdapter? =StalkerPlaybackMode.TEMP_LINK_FLUSSONIC -> FlussonicTemporaryLinkAdapterStalkerPlaybackMode.TEMP_LINK_WOWZA -> WowzaTemporaryLinkAdapterStalkerPlaybackMode.TEMP_LINK_NGINX -> NginxSecureLinkAdapter+ StalkerPlaybackMode.PLAY_LIVE_PORTAL -> PlayLivePortalAdapter+ StalkerPlaybackMode.PLAY_MOVIE_PORTAL -> PlayMoviePortalAdapterStalkerPlaybackMode.DIRECT_URL,StalkerPlaybackMode.LOCALHOST_CMD,StalkerPlaybackMode.MULTI_CMD -> DirectOrCreateLinkAdapter}++private fun adapterForBackendHint(hint: StalkerPlaybackBackendHint): StalkerPlaybackAdapter? = when (hint) {+ StalkerPlaybackBackendHint.DIRECT -> CookieAwareDirectAdapter+ StalkerPlaybackBackendHint.PLAY_LIVE -> PlayLivePortalAdapter+ StalkerPlaybackBackendHint.PLAY_MOVIE -> PlayMoviePortalAdapter+ StalkerPlaybackBackendHint.TEMP_LINK,+ StalkerPlaybackBackendHint.TEMP_LINK_STRICT -> NginxSecureLinkAdapter+ StalkerPlaybackBackendHint.AUTO -> null+}diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackResolutionException.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackResolutionException.ktindex aff0a23c..e74e19e5 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackResolutionException.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPlaybackResolutionException.kt@@ -1,8 +1,23 @@package com.streamvault.data.remote.stalker+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport java.io.IOExceptionclass StalkerPlaybackResolutionException(message: String,- cause: Throwable? = null+ cause: Throwable? = null,+ val streamKind: StalkerStreamKind = StalkerStreamKind.LIVE,+ val portalFingerprint: StalkerPortalFingerprint? = null,+ val magPreset: StalkerMagPreset? = null,+ val bootstrapRecipe: StalkerBootstrapRecipe? = null,+ val endpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ val cookieMode: StalkerCookieMode = StalkerCookieMode.NONE,+ val playbackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,+ val fallbackRecipeUsed: Boolean = false,+ val rediscoveryAttempted: Boolean = false) : IOException(message, cause)diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPortalRecipes.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPortalRecipes.ktnew file mode 100644index 00000000..ff0bc4d9--- /dev/null+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerPortalRecipes.kt@@ -0,0 +1,196 @@+package com.streamvault.data.remote.stalker++import com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprint+import com.streamvault.domain.model.StalkerPortalProfile++internal data class StalkerMagPresetSpec(+ val defaultDeviceProfile: String,+ val versionString: String,+ val imageVersion: String,+ val hwVersion: String,+ val apiSignature: String,+ val metricsJson: String,+ val localization: String,+ val requireStrictIdentity: Boolean = false+)++internal data class StalkerRecipeSpec(+ val recipe: StalkerBootstrapRecipe,+ val magPreset: StalkerMagPreset,+ val authMode: StalkerAuthMode,+ val requestAccountInfo: Boolean,+ val requestModules: Boolean,+ val requestLocalization: Boolean,+ val strictIdentityRequired: Boolean,+ val endpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ val preferLocalizationBeforeProfile: Boolean = false,+ val cookieMode: StalkerCookieMode = StalkerCookieMode.NONE,+ val playbackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO+)++internal fun stalkerMagPresetSpec(preset: StalkerMagPreset): StalkerMagPresetSpec = when (preset) {+ StalkerMagPreset.GENERIC_SAFE -> StalkerMagPresetSpec(+ defaultDeviceProfile = "MAG250",+ versionString = "ImageDescription: 0.2.18-r23-250; ImageDate: Wed Oct 31 15:22:54 EEST 2018; PORTAL version: 5.6.2; API Version: JS API version: 343; STB API version: 146; Player Engine version: 0x58c",+ imageVersion = "218",+ hwVersion = "1.7-BD-00",+ apiSignature = "262",+ metricsJson = "{}",+ localization = "en_US.utf8"+ )++ StalkerMagPreset.MAG250_LEGACY -> StalkerMagPresetSpec(+ defaultDeviceProfile = "MAG250",+ versionString = "ImageDescription: 0.2.16-r17-250; ImageDate: Thu Sep 13 12:08:56 EEST 2017; PORTAL version: 5.3.0; API Version: JS API version: 331; STB API version: 141; Player Engine version: 0x572",+ imageVersion = "216",+ hwVersion = "1.7-BD-00",+ apiSignature = "254",+ metricsJson = """{"mac":"legacy","sn":"legacy"}""",+ localization = "en_GB.utf8"+ )++ StalkerMagPreset.MAG254_STRICT -> StalkerMagPresetSpec(+ defaultDeviceProfile = "MAG254",+ versionString = "ImageDescription: 0.2.18-r23-254; ImageDate: Thu Nov 1 11:14:12 EET 2018; PORTAL version: 5.6.8; API Version: JS API version: 343; STB API version: 146; Player Engine version: 0x58c",+ imageVersion = "254",+ hwVersion = "2.6-IB-00",+ apiSignature = "263",+ metricsJson = """{"hw":"strict","video_out":"hdmi"}""",+ localization = "en_US.utf8",+ requireStrictIdentity = true+ )++ StalkerMagPreset.MINISTRA_MODERN -> StalkerMagPresetSpec(+ defaultDeviceProfile = "MAG322",+ versionString = "ImageDescription: 0.2.21-r14-254; ImageDate: Wed Apr 24 13:42:11 EEST 2019; PORTAL version: 5.6.8; API Version: JS API version: 343; STB API version: 146; Player Engine version: 0x5a1",+ imageVersion = "221",+ hwVersion = "2.6-IB-00",+ apiSignature = "270",+ metricsJson = """{"platform":"ministra","video_out":"hdmi","num_banks":2}""",+ localization = "en_US.utf8",+ requireStrictIdentity = true+ )+}++internal fun defaultRecipeFor(+ authMode: StalkerAuthMode,+ fingerprintHint: StalkerPortalFingerprint,+ presetHint: StalkerMagPreset+): StalkerRecipeSpec {+ if (fingerprintHint == StalkerPortalFingerprint.MODULE_GATED) {+ return StalkerRecipeSpec(+ recipe = StalkerBootstrapRecipe.MODULE_GATED,+ magPreset = presetHint.takeUnless { it == StalkerMagPreset.GENERIC_SAFE } ?: StalkerMagPreset.MINISTRA_MODERN,+ authMode = authMode,+ requestAccountInfo = true,+ requestModules = true,+ requestLocalization = true,+ strictIdentityRequired = true,+ endpointPreference = StalkerEndpointPreference.PORTAL,+ preferLocalizationBeforeProfile = true,+ cookieMode = StalkerCookieMode.CREATE_LINK,+ playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT+ )+ }+ return when (authMode) {+ StalkerAuthMode.CREDENTIALS_ONLY -> StalkerRecipeSpec(+ recipe = StalkerBootstrapRecipe.AUTH_ONLY,+ magPreset = presetHint,+ authMode = authMode,+ requestAccountInfo = true,+ requestModules = false,+ requestLocalization = false,+ strictIdentityRequired = false,+ cookieMode = StalkerCookieMode.CREATE_LINK+ )++ StalkerAuthMode.MAC_PLUS_CREDENTIALS -> StalkerRecipeSpec(+ recipe = StalkerBootstrapRecipe.AUTH_STRICT_MAG,+ magPreset = presetHint.takeUnless { it == StalkerMagPreset.GENERIC_SAFE } ?: StalkerMagPreset.MAG254_STRICT,+ authMode = authMode,+ requestAccountInfo = true,+ requestModules = false,+ requestLocalization = true,+ strictIdentityRequired = true,+ cookieMode = StalkerCookieMode.CREATE_LINK,+ playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT+ )++ else -> StalkerRecipeSpec(+ recipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ magPreset = presetHint,+ authMode = authMode,+ requestAccountInfo = false,+ requestModules = false,+ requestLocalization = false,+ strictIdentityRequired = false,+ cookieMode = StalkerCookieMode.CREATE_LINK+ )+ }+}++internal fun fallbackRecipesFor(authMode: StalkerAuthMode): List<StalkerRecipeSpec> = when (authMode) {+ StalkerAuthMode.MAC_ONLY -> listOf(+ StalkerRecipeSpec(StalkerBootstrapRecipe.LEGACY_MAG, StalkerMagPreset.MAG250_LEGACY, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = false, strictIdentityRequired = false, cookieMode = StalkerCookieMode.CREATE_LINK),+ StalkerRecipeSpec(StalkerBootstrapRecipe.STRICT_MAG, StalkerMagPreset.MAG254_STRICT, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.PORTAL_PREFERRED, StalkerMagPreset.MAG254_STRICT, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.MODULE_GATED, StalkerMagPreset.MINISTRA_MODERN, authMode, requestAccountInfo = true, requestModules = true, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, preferLocalizationBeforeProfile = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.LOCALIZATION_STRICT, StalkerMagPreset.MINISTRA_MODERN, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, preferLocalizationBeforeProfile = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT)+ )++ StalkerAuthMode.CREDENTIALS_ONLY -> listOf(+ StalkerRecipeSpec(StalkerBootstrapRecipe.AUTH_ONLY, StalkerMagPreset.GENERIC_SAFE, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = false, strictIdentityRequired = false, cookieMode = StalkerCookieMode.CREATE_LINK),+ StalkerRecipeSpec(StalkerBootstrapRecipe.PORTAL_PREFERRED, StalkerMagPreset.MAG254_STRICT, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.AUTH_STRICT_MAG, StalkerMagPreset.MINISTRA_MODERN, authMode, requestAccountInfo = true, requestModules = true, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, preferLocalizationBeforeProfile = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT)+ )++ StalkerAuthMode.MAC_PLUS_CREDENTIALS -> listOf(+ StalkerRecipeSpec(StalkerBootstrapRecipe.AUTH_STRICT_MAG, StalkerMagPreset.MAG254_STRICT, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.PORTAL_PREFERRED, StalkerMagPreset.MAG254_STRICT, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.MODULE_GATED, StalkerMagPreset.MINISTRA_MODERN, authMode, requestAccountInfo = true, requestModules = true, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, preferLocalizationBeforeProfile = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT),+ StalkerRecipeSpec(StalkerBootstrapRecipe.LOCALIZATION_STRICT, StalkerMagPreset.MINISTRA_MODERN, authMode, requestAccountInfo = true, requestModules = false, requestLocalization = true, strictIdentityRequired = true, endpointPreference = StalkerEndpointPreference.PORTAL, preferLocalizationBeforeProfile = true, cookieMode = StalkerCookieMode.CREATE_LINK, playbackBackendHint = StalkerPlaybackBackendHint.TEMP_LINK_STRICT)+ )++ StalkerAuthMode.AUTO -> emptyList()+}++internal fun detectPortalFingerprint(+ profile: StalkerProviderProfile,+ effectiveAuthMode: StalkerAuthMode,+ selectedPreset: StalkerMagPreset,+ selectedRecipe: StalkerBootstrapRecipe+): StalkerPortalFingerprint = when {+ profile.moduleNames.isNotEmpty() || profile.portalCapabilities.moduleRestricted ->+ StalkerPortalFingerprint.MODULE_GATED++ (profile.portalCapabilities.nginxSecureLink || profile.portalCapabilities.useHttpTemporaryLink) &&+ selectedPreset != StalkerMagPreset.GENERIC_SAFE ->+ StalkerPortalFingerprint.TEMP_LINK_STRICT++ effectiveAuthMode == StalkerAuthMode.CREDENTIALS_ONLY ->+ StalkerPortalFingerprint.AUTH_ONLY++ effectiveAuthMode == StalkerAuthMode.MAC_PLUS_CREDENTIALS &&+ selectedRecipe == StalkerBootstrapRecipe.AUTH_STRICT_MAG ->+ StalkerPortalFingerprint.AUTH_STRICT_MAG++ selectedPreset == StalkerMagPreset.MAG254_STRICT || selectedPreset == StalkerMagPreset.MINISTRA_MODERN ->+ StalkerPortalFingerprint.STRICT_MAG++ else -> StalkerPortalFingerprint.BASIC_MAC+}++internal fun profileForFingerprint(fingerprint: StalkerPortalFingerprint): StalkerPortalProfile = when (fingerprint) {+ StalkerPortalFingerprint.BASIC_MAC -> StalkerPortalProfile.MAG_BASIC+ StalkerPortalFingerprint.STRICT_MAG,+ StalkerPortalFingerprint.TEMP_LINK_STRICT -> StalkerPortalProfile.MAG_STRICT+ StalkerPortalFingerprint.AUTH_ONLY -> StalkerPortalProfile.AUTH_REQUIRED+ StalkerPortalFingerprint.AUTH_STRICT_MAG -> StalkerPortalProfile.AUTH_PLUS_MAG+ StalkerPortalFingerprint.MODULE_GATED -> StalkerPortalProfile.MODULE_GATED+}diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerProvider.ktindex 1e39458f..a6f44481 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@@ -1,5 +1,6 @@package com.streamvault.data.remote.stalker+import android.util.Logimport com.streamvault.data.util.AdultContentClassifierimport com.streamvault.data.util.UrlSecurityPolicyimport com.streamvault.domain.model.Category@@ -15,6 +16,12 @@ import com.streamvault.domain.model.Resultimport com.streamvault.domain.model.Seasonimport com.streamvault.domain.model.Seriesimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.StalkerPortalProfileimport com.streamvault.domain.provider.IptvProviderimport com.streamvault.domain.util.ChannelNormalizer@@ -29,7 +36,10 @@ data class StalkerPlaybackInfo(val url: String,val headers: Map<String, String> = emptyMap(),val userAgent: String? = null,- val playbackMode: StalkerPlaybackMode = StalkerPlaybackMode.DIRECT_URL+ val playbackMode: StalkerPlaybackMode = StalkerPlaybackMode.DIRECT_URL,+ val endpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ val cookieMode: StalkerCookieMode = StalkerCookieMode.NONE,+ val backendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO)data class StalkerPagedResult<T>(@@ -49,6 +59,12 @@ class StalkerProvider(private val authMode: StalkerAuthMode = StalkerAuthMode.AUTO,private val username: String = "",private val password: String = "",+ private val portalFingerprintHint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ private val magPresetHint: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ private val bootstrapRecipeHint: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ private val endpointPreferenceHint: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ private val cookieModeHint: StalkerCookieMode = StalkerCookieMode.NONE,+ private val playbackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,private val portalProfileHint: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,private val preferredPlaybackMode: StalkerPlaybackMode? = null,private val deviceProfile: String,@@ -59,6 +75,9 @@ class StalkerProvider(private val deviceId2: String = "",private val signature: String = "") : IptvProvider {+ private companion object {+ private const val TAG = "StalkerProvider"+ }private data class CategorySeed(val id: Long,@@ -83,6 +102,7 @@ class StalkerProvider(return when (val authResult = ensureAuthenticated()) {is Result.Success -> {val profile = authResult.data.second+ val learnedDeviceProfile = buildLearnedDeviceProfile(profile)val hostLabel = portalUrl.substringAfter("://").substringBefore('/').ifBlank { "portal" }val providerName = profile.accountName?.takeUnless { it.isBlank() || it == "0" }?: normalizedUsername().takeIf { it.isNotBlank() }@@ -96,20 +116,29 @@ class StalkerProvider(username = normalizedUsername(),password = normalizedPassword(),stalkerMacAddress = normalizedMacAddress(),- stalkerDeviceProfile = normalizedDeviceProfile(),- stalkerDeviceTimezone = normalizedTimezone(),- stalkerDeviceLocale = normalizedLocale(),- stalkerSerialNumber = normalizedSerialNumber(),- stalkerDeviceId = normalizedDeviceId(),- stalkerDeviceId2 = normalizedDeviceId2(),- stalkerSignature = normalizedSignature(),+ stalkerDeviceProfile = learnedDeviceProfile.deviceProfile,+ stalkerDeviceTimezone = learnedDeviceProfile.timezone,+ stalkerDeviceLocale = learnedDeviceProfile.locale,+ stalkerSerialNumber = learnedDeviceProfile.serialNumber,+ stalkerDeviceId = learnedDeviceProfile.deviceId,+ stalkerDeviceId2 = learnedDeviceProfile.deviceId2,+ stalkerSignature = learnedDeviceProfile.signature,stalkerAuthMode = profile.effectiveAuthMode,stalkerPortalProfile = profile.portalProfile,+ stalkerPortalFingerprint = profile.portalFingerprint,+ stalkerMagPreset = profile.magPreset,+ stalkerLastBootstrapRecipe = profile.bootstrapRecipe,+ stalkerEndpointPreference = profile.fingerprintEvidence.endpointPreference,+ stalkerCookieMode = profile.fingerprintEvidence.cookieMode,+ stalkerPlaybackBackendHint = profile.fingerprintEvidence.playbackBackendHint,stalkerLastPlaybackMode = null,stalkerCredentialsRequired = profile.credentialRequired,stalkerMacRequired = profile.macRequired,stalkerUsesTemporaryLinks = profile.portalCapabilities.usesTemporaryLinks,stalkerModuleRestricted = profile.portalCapabilities.moduleRestricted,+ stalkerStrictFingerprintRequired = profile.strictFingerprintRequired,+ stalkerRecipeFallbackUsed = profile.fallbackRecipeUsed,+ stalkerRecipeRediscoveryAttempts = if (profile.rediscoveryAttempted) 1 else 0,maxConnections = profile.maxConnections ?: 1,expirationDate = profile.expirationDate,apiVersion = "Stalker/MAG Portal",@@ -335,26 +364,44 @@ class StalkerProvider(suspend fun resolvePlaybackInfo(kind: StalkerStreamKind,cmd: String,- seriesNumber: Int? = null+ seriesNumber: Int? = null,+ archiveStartSeconds: Long? = null,+ archiveEndSeconds: Long? = null): Result<StalkerPlaybackInfo> = resolvePlaybackInfo(kind = kind,descriptor = buildStalkerPlaybackDescriptor(cmd),- seriesNumber = seriesNumber+ seriesNumber = seriesNumber,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds)suspend fun resolvePlaybackInfo(kind: StalkerStreamKind,descriptor: StalkerPlaybackDescriptor?,- seriesNumber: Int? = null+ seriesNumber: Int? = null,+ archiveStartSeconds: Long? = null,+ archiveEndSeconds: Long? = null): Result<StalkerPlaybackInfo> {+ validateArchiveWindow(kind, archiveStartSeconds, archiveEndSeconds)?.let { message ->+ return Result.error(message)+ }val resolvedDescriptor = descriptor ?: return Result.error("This portal requires a different playback path than the default command.")- return resolvePlaybackInfoInternal(kind, resolvedDescriptor, seriesNumber, allowRebootstrap = true)+ return resolvePlaybackInfoInternal(+ kind = kind,+ descriptor = resolvedDescriptor,+ seriesNumber = seriesNumber,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds,+ allowRebootstrap = true+ )}private suspend fun resolvePlaybackInfoInternal(kind: StalkerStreamKind,descriptor: StalkerPlaybackDescriptor,seriesNumber: Int?,+ archiveStartSeconds: Long?,+ archiveEndSeconds: Long?,allowRebootstrap: Boolean): Result<StalkerPlaybackInfo> {return when (val authResult = ensureAuthenticated()) {@@ -372,21 +419,49 @@ class StalkerProvider(portalProfileHint = accountProfile.portalProfile.takeUnless {it == StalkerPortalProfile.MAG_BASIC} ?: portalProfileHint,- preferredMode = preferredPlaybackMode+ preferredMode = preferredPlaybackMode,+ backendHint = accountProfile.fingerprintEvidence.playbackBackendHint+ .takeUnless { it == StalkerPlaybackBackendHint.AUTO }+ ?: playbackBackendHint,+ cookieModeHint = accountProfile.fingerprintEvidence.cookieMode+ .takeUnless { it == StalkerCookieMode.NONE }+ ?: cookieModeHint)val directUrl = extractDirectPlaybackUrl(variant.cmd)- directUrl- ?.takeIf { candidate ->+ val directCandidates = when (kind) {+ StalkerStreamKind.ARCHIVE -> buildArchiveDirectCandidates(+ sourceUrl = directUrl,+ startSeconds = archiveStartSeconds,+ endSeconds = archiveEndSeconds+ )+ else -> listOfNotNull(directUrl)+ }+ directCandidates+ .firstOrNull { candidate ->adapter.allowsDirectBypass(variant) &&shouldBypassCreateLink(kind, candidate)}?.let { candidate ->+ Log.d(+ TAG,+ "Resolved direct Stalker playback provider=$providerId kind=${kind.name} mode=${adapter.adapterMode.name} " ++ "candidateMode=${variant.playbackMode.name} endpoint=${effectiveArchiveEndpointPreference(kind, session).name}"+ )return Result.success(StalkerPlaybackInfo(url = candidate,- headers = buildPlaybackHeaders(session, profile),+ headers = buildPlaybackHeaders(session, profile, candidate),userAgent = profile.userAgent,- playbackMode = adapter.adapterMode+ playbackMode = adapter.adapterMode,+ endpointPreference = effectiveArchiveEndpointPreference(+ kind = kind,+ session = session+ ),+ cookieMode = derivePlaybackCookieMode(+ current = effectiveArchiveCookieMode(kind, session, candidate),+ url = candidate+ ),+ backendHint = detectPlaybackBackendHint(candidate, descriptor.capabilities, adapter)))}@@ -396,14 +471,46 @@ class StalkerProvider(return@forEach}- when (val linkResult = api.createLink(session, profile, kind, variant.cmd, seriesNumber)) {+ when (+ val linkResult = api.createLink(+ session = session,+ profile = profile,+ kind = kind,+ cmd = variant.cmd,+ seriesNumber = seriesNumber,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds+ )+ ) {is Result.Success -> {+ val resolvedUrl = repairCreateLinkUrl(+ kind = kind,+ resolvedUrl = linkResult.data,+ sourceDirectUrl = directUrl,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds+ )+ Log.d(+ TAG,+ "Resolved create_link playback provider=$providerId kind=${kind.name} mode=${adapter.adapterMode.name} " ++ "candidateMode=${variant.playbackMode.name} endpoint=${effectiveArchiveEndpointPreference(kind, session).name} " ++ "cookie=${effectiveArchiveCookieMode(kind, session, resolvedUrl).name}"+ )return Result.success(StalkerPlaybackInfo(- url = repairCreateLinkUrl(kind, linkResult.data, directUrl),- headers = buildPlaybackHeaders(session, profile),+ url = resolvedUrl,+ headers = buildPlaybackHeaders(session, profile, resolvedUrl),userAgent = profile.userAgent,- playbackMode = adapter.adapterMode+ playbackMode = adapter.adapterMode,+ endpointPreference = effectiveArchiveEndpointPreference(+ kind = kind,+ session = session+ ),+ cookieMode = derivePlaybackCookieMode(+ current = effectiveArchiveCookieMode(kind, session, resolvedUrl),+ url = resolvedUrl+ ),+ backendHint = detectPlaybackBackendHint(resolvedUrl, descriptor.capabilities, adapter)))}@@ -422,7 +529,13 @@ class StalkerProvider(portalProfileHint = accountProfile.portalProfile.takeUnless {it == StalkerPortalProfile.MAG_BASIC} ?: portalProfileHint,- preferredMode = preferredPlaybackMode+ preferredMode = preferredPlaybackMode,+ backendHint = accountProfile.fingerprintEvidence.playbackBackendHint+ .takeUnless { it == StalkerPlaybackBackendHint.AUTO }+ ?: playbackBackendHint,+ cookieModeHint = accountProfile.fingerprintEvidence.cookieMode+ .takeUnless { it == StalkerCookieMode.NONE }+ ?: cookieModeHint).allowsRebootstrap(descriptor, accountProfile)} &&isLikelyAuthOrSessionFailure(lastError?.message.orEmpty(), lastError?.exception)@@ -432,11 +545,22 @@ class StalkerProvider(kind = kind,descriptor = descriptor,seriesNumber = seriesNumber,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds,allowRebootstrap = false)}val message = when {+ accountProfile.strictFingerprintRequired && lastError?.message.isNullOrBlank() ->+ "Portal requires stricter MAG emulation."++ accountProfile.fallbackRecipeUsed && descriptor.capabilities.usesTemporaryLinks ->+ "Portal matched a legacy MAG recipe and was retried automatically, but playback still failed."++ accountProfile.rediscoveryAttempted ->+ "Stored portal recipe failed; rediscovery attempted."+descriptor.capabilities.ambiguousAccountState || accountProfile.ambiguousState ->"Portal profile is ambiguous; playback/session validation failed."@@ -448,9 +572,33 @@ class StalkerProvider(?: "Portal could not issue a valid temporary playback link for this stream."else -> lastError?.message?.takeIf { it.isNotBlank() }- ?: "We couldn't resolve a playable Stalker stream for this item."+ ?: "Portal family detected, but no working recipe succeeded."}- Result.error(message, lastError?.exception)+ Log.w(+ TAG,+ "Stalker playback failed provider=$providerId kind=${kind.name} " ++ "fingerprint=${accountProfile.portalFingerprint.name} preset=${accountProfile.magPreset.name} " ++ "recipe=${accountProfile.bootstrapRecipe.name} endpoint=${accountProfile.fingerprintEvidence.endpointPreference.name} " ++ "cookie=${accountProfile.fingerprintEvidence.cookieMode.name} backend=${accountProfile.fingerprintEvidence.playbackBackendHint.name} " ++ "fallback=${accountProfile.fallbackRecipeUsed} rediscovery=${accountProfile.rediscoveryAttempted} " ++ "reason=$message"+ )+ Result.error(+ message,+ StalkerPlaybackResolutionException(+ message = message,+ cause = lastError?.exception,+ streamKind = kind,+ portalFingerprint = accountProfile.portalFingerprint,+ magPreset = accountProfile.magPreset,+ bootstrapRecipe = accountProfile.bootstrapRecipe,+ endpointPreference = accountProfile.fingerprintEvidence.endpointPreference,+ cookieMode = accountProfile.fingerprintEvidence.cookieMode,+ playbackBackendHint = accountProfile.fingerprintEvidence.playbackBackendHint,+ fallbackRecipeUsed = accountProfile.fallbackRecipeUsed,+ rediscoveryAttempted = accountProfile.rediscoveryAttempted+ )+ )}is Result.Error -> Result.error(authResult.message, authResult.exception)is Result.Loading -> Result.error("Unexpected loading state")@@ -460,15 +608,70 @@ class StalkerProvider(suspend fun resolvePlaybackUrl(kind: StalkerStreamKind,cmd: String,- seriesNumber: Int? = null+ seriesNumber: Int? = null,+ archiveStartSeconds: Long? = null,+ archiveEndSeconds: Long? = null): Result<String> =- resolvePlaybackInfo(kind, cmd, seriesNumber).mapData(StalkerPlaybackInfo::url)+ resolvePlaybackInfo(+ kind = kind,+ cmd = cmd,+ seriesNumber = seriesNumber,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds+ ).mapData(StalkerPlaybackInfo::url)override suspend fun buildStreamUrl(streamId: Long, containerExtension: String?): String {throw UnsupportedOperationException("Stalker stream URLs require a command token context.")}- override suspend fun buildCatchUpUrl(streamId: Long, start: Long, end: Long): String? = null+ override suspend fun buildCatchUpUrl(streamId: Long, start: Long, end: Long): String? =+ buildCatchUpUrls(streamId, start, end).firstOrNull()++ override suspend fun buildCatchUpUrls(streamId: Long, start: Long, end: Long): List<String> =+ buildCatchUpUrls(streamId, start, end, sourceStreamUrl = null, sourceCatchUpSource = null)++ suspend fun buildCatchUpUrls(+ streamId: Long,+ start: Long,+ end: Long,+ sourceStreamUrl: String?,+ sourceCatchUpSource: String?+ ): List<String> {+ val safeStart = start.takeIf { it > 0L } ?: return emptyList()+ val safeEnd = end.takeIf { it > safeStart } ?: return emptyList()+ val seedToken = sequenceOf(sourceCatchUpSource, sourceStreamUrl)+ .mapNotNull(StalkerUrlFactory::parseInternalStreamUrl)+ .firstOrNull()+ ?: return emptyList()+ if (seedToken.providerId != providerId) {+ return emptyList()+ }+ if (seedToken.kind != StalkerStreamKind.LIVE && seedToken.kind != StalkerStreamKind.ARCHIVE) {+ return emptyList()+ }+ val seedDescriptor = seedToken.playbackDescriptor+ ?: buildStalkerPlaybackDescriptor(seedToken.cmd)+ ?: return emptyList()+ val orderedCandidates = seedDescriptor.candidates.sortedBy { variant ->+ if (preferredPlaybackMode != null && variant.playbackMode == preferredPlaybackMode) 0 else 1+ }+ return orderedCandidates.mapIndexed { index, variant ->+ StalkerUrlFactory.buildInternalStreamUrl(+ providerId = providerId,+ kind = StalkerStreamKind.ARCHIVE,+ itemId = streamId.takeIf { it > 0L } ?: seedToken.itemId,+ cmd = variant.cmd,+ containerExtension = seedToken.containerExtension,+ archiveStartSeconds = safeStart,+ archiveEndSeconds = safeEnd,+ playbackDescriptor = StalkerPlaybackDescriptor(+ primaryMode = variant.playbackMode,+ candidates = listOf(variant.copy(priority = index)),+ capabilities = seedDescriptor.capabilities+ )+ )+ }.distinct()+ }private suspend fun mapCategories(type: ContentType,@@ -552,6 +755,12 @@ class StalkerProvider(portalUrl = portalUrl,macAddress = normalizedMacAddress(),authMode = authMode,+ magPresetHint = magPresetHint,+ portalFingerprintHint = portalFingerprintHint,+ bootstrapRecipeHint = bootstrapRecipeHint,+ endpointPreferenceHint = endpointPreferenceHint,+ cookieModeHint = cookieModeHint,+ playbackBackendHint = playbackBackendHint,username = normalizedUsername(),password = normalizedPassword(),deviceProfile = normalizedDeviceProfile(),@@ -578,6 +787,35 @@ class StalkerProvider(portalUrl = portalUrl,macAddress = normalizedMacAddress(),authMode = authMode,+ magPresetHint = magPresetHint,+ portalFingerprintHint = portalFingerprintHint,+ bootstrapRecipeHint = bootstrapRecipeHint,+ endpointPreferenceHint = endpointPreferenceHint,+ cookieModeHint = cookieModeHint,+ playbackBackendHint = playbackBackendHint,+ username = normalizedUsername(),+ password = normalizedPassword(),+ deviceProfile = normalizedDeviceProfile(),+ timezone = normalizedTimezone(),+ locale = normalizedLocale(),+ serialNumberOverride = normalizedSerialNumber(),+ deviceIdOverride = normalizedDeviceId(),+ deviceId2Override = normalizedDeviceId2(),+ signatureOverride = normalizedSignature()+ )+ }++ private fun buildLearnedDeviceProfile(profile: StalkerProviderProfile): StalkerDeviceProfile {+ return buildStalkerDeviceProfile(+ portalUrl = portalUrl,+ macAddress = normalizedMacAddress(),+ authMode = profile.effectiveAuthMode,+ magPresetHint = profile.magPreset,+ portalFingerprintHint = profile.portalFingerprint,+ bootstrapRecipeHint = profile.bootstrapRecipe,+ endpointPreferenceHint = profile.fingerprintEvidence.endpointPreference,+ cookieModeHint = profile.fingerprintEvidence.cookieMode,+ playbackBackendHint = profile.fingerprintEvidence.playbackBackendHint,username = normalizedUsername(),password = normalizedPassword(),deviceProfile = normalizedDeviceProfile(),@@ -592,19 +830,29 @@ class StalkerProvider(private fun buildPlaybackHeaders(session: StalkerSession,- profile: StalkerDeviceProfile+ profile: StalkerDeviceProfile,+ url: String): Map<String, String> = buildMap {+ val omitAuthorization = shouldOmitPlaybackAuthorization(url)+ val serverCookieHeader = api.currentCookieHeader(session)+ .ifBlank { session.serverCookieHeader }put("Referer", session.portalReferer)put("Accept", "*/*")- put("Cookie", buildPlaybackCookieHeader(session, profile))+ put("Accept-Encoding", "identity")+ put("Cookie", buildPlaybackCookieHeader(serverCookieHeader, profile))put("X-User-Agent", profile.xUserAgent)- session.token.takeIf { it.isNotBlank() }?.let { token ->+ session.token.takeIf { it.isNotBlank() && !omitAuthorization }?.let { token ->put("Authorization", "Bearer $token")}}+ private fun shouldOmitPlaybackAuthorization(url: String): Boolean {+ val path = runCatching { URI(url).path?.lowercase(Locale.ROOT).orEmpty() }.getOrDefault("")+ return path.endsWith("/play/live.php") || path.endsWith("/play/movie.php")+ }+private fun buildPlaybackCookieHeader(- session: StalkerSession,+ serverCookieHeader: String,profile: StalkerDeviceProfile): String {val cookies = linkedMapOf(@@ -616,17 +864,134 @@ class StalkerProvider("device_id2" to profile.deviceId2,"signature" to profile.signature)- session.serverCookieHeader.split(';')+ serverCookieHeader.split(';').mapNotNull { part ->val key = part.substringBefore('=', missingDelimiterValue = "").trim()val value = part.substringAfter('=', missingDelimiterValue = "").trim()key.takeIf { it.isNotBlank() && value.isNotBlank() }?.let { it to value }}.forEach { (key, value) ->cookies.putIfAbsent(key, value)- }+ }return cookies.entries.joinToString("; ") { (key, value) -> "$key=$value" }}+ private fun derivePlaybackCookieMode(+ current: StalkerCookieMode,+ url: String+ ): StalkerCookieMode {+ val path = runCatching { URI(url).path?.lowercase(Locale.ROOT).orEmpty() }.getOrDefault("")+ val playbackNeedsCookies = path.endsWith("/play/live.php") || path.endsWith("/play/movie.php")+ return when {+ playbackNeedsCookies && current == StalkerCookieMode.CREATE_LINK -> StalkerCookieMode.BOTH+ playbackNeedsCookies -> StalkerCookieMode.PLAYBACK+ else -> current+ }+ }++ private fun effectiveArchiveCookieMode(+ kind: StalkerStreamKind,+ session: StalkerSession,+ url: String+ ): StalkerCookieMode {+ val base = session.fingerprintEvidence.cookieMode+ if (kind != StalkerStreamKind.ARCHIVE) {+ return base+ }+ return when (base) {+ StalkerCookieMode.NONE -> StalkerCookieMode.PLAYBACK+ StalkerCookieMode.CREATE_LINK -> StalkerCookieMode.BOTH+ else -> derivePlaybackCookieMode(base, url)+ }+ }++ private fun effectiveArchiveEndpointPreference(+ kind: StalkerStreamKind,+ session: StalkerSession+ ): StalkerEndpointPreference =+ if (kind == StalkerStreamKind.ARCHIVE) {+ session.fingerprintEvidence.archiveEndpointPreference.takeUnless {+ it == StalkerEndpointPreference.AUTO+ } ?: session.fingerprintEvidence.endpointPreference+ } else {+ session.fingerprintEvidence.endpointPreference+ }++ private fun buildArchiveDirectCandidates(+ sourceUrl: String?,+ startSeconds: Long?,+ endSeconds: Long?+ ): List<String> {+ val normalizedSource = sourceUrl?.trim()?.takeIf { it.isNotBlank() } ?: return emptyList()+ val safeStart = startSeconds?.takeIf { it > 0L } ?: return listOf(normalizedSource)+ val safeEnd = endSeconds?.takeIf { it > safeStart } ?: return listOf(normalizedSource)+ val liveNow = maxOf(safeEnd, System.currentTimeMillis() / 1000L)+ val withUtc = appendArchiveQueryParameter(normalizedSource, "utc", safeStart.toString())+ val withLutc = appendArchiveQueryParameter(withUtc ?: normalizedSource, "lutc", liveNow.toString())+ return listOfNotNull(+ normalizedSource.takeIf { hasArchiveQueryHints(it) },+ withLutc+ ).distinct()+ }++ private fun hasArchiveQueryHints(url: String): Boolean {+ val uri = runCatching { URI(url) }.getOrNull() ?: return false+ val query = uri.rawQuery?.lowercase(Locale.ROOT).orEmpty()+ return query.contains("utc=") ||+ query.contains("lutc=") ||+ query.contains("timeshift=") ||+ uri.path?.lowercase(Locale.ROOT)?.contains("timeshift") == true+ }++ private fun appendArchiveQueryParameter(url: String, name: String, value: String): String? {+ val uri = runCatching { URI(url) }.getOrNull() ?: return null+ val rawQuery = uri.rawQuery+ val existingParts = rawQuery+ ?.split('&')+ ?.filter { it.isNotBlank() }+ .orEmpty()+ .toMutableList()+ val replaced = existingParts.map { part ->+ val key = part.substringBefore('=', missingDelimiterValue = "")+ if (key.equals(name, ignoreCase = true)) {+ "$key=$value"+ } else {+ part+ }+ }.toMutableList()+ if (replaced.none { part ->+ part.substringBefore('=', missingDelimiterValue = "").equals(name, ignoreCase = true)+ }+ ) {+ replaced += "$name=$value"+ }+ val query = replaced.joinToString("&")+ return URI(uri.scheme, uri.authority, uri.path, query, uri.fragment).toString()+ }++ private fun detectPlaybackBackendHint(+ url: String,+ capabilities: StalkerPortalCapabilities,+ adapter: StalkerPlaybackAdapter+ ): StalkerPlaybackBackendHint {+ val path = runCatching { URI(url).path?.lowercase(Locale.ROOT).orEmpty() }.getOrDefault("")+ return when {+ path.endsWith("/play/live.php") -> StalkerPlaybackBackendHint.PLAY_LIVE+ path.endsWith("/play/movie.php") -> StalkerPlaybackBackendHint.PLAY_MOVIE+ adapter.adapterMode == StalkerPlaybackMode.TEMP_LINK_FLUSSONIC ||+ adapter.adapterMode == StalkerPlaybackMode.TEMP_LINK_WOWZA ||+ adapter.adapterMode == StalkerPlaybackMode.TEMP_LINK_NGINX ||+ adapter.adapterMode == StalkerPlaybackMode.PLAY_LIVE_PORTAL ||+ adapter.adapterMode == StalkerPlaybackMode.PLAY_MOVIE_PORTAL ->+ if (capabilities.nginxSecureLink || capabilities.useHttpTemporaryLink) {+ StalkerPlaybackBackendHint.TEMP_LINK_STRICT+ } else {+ StalkerPlaybackBackendHint.TEMP_LINK+ }++ else -> StalkerPlaybackBackendHint.DIRECT+ }+ }+private fun extractDirectPlaybackUrl(cmd: String): String? {return cmd.substringAfter(' ', missingDelimiterValue = cmd)@@ -639,7 +1004,7 @@ class StalkerProvider(val host = parsed.host?.trim()?.lowercase(Locale.ROOT).orEmpty()if (host.isBlank()) return falseif (host == "localhost" || host == "127.0.0.1" || host == "0.0.0.0") return false- if (kind == StalkerStreamKind.LIVE && !hasUsableLiveStreamTarget(parsed)) return false+ if ((kind == StalkerStreamKind.LIVE || kind == StalkerStreamKind.ARCHIVE) && !hasUsableLiveStreamTarget(parsed)) return falsereturn true}@@ -647,23 +1012,31 @@ class StalkerProvider(private fun repairCreateLinkUrl(kind: StalkerStreamKind,resolvedUrl: String,- sourceDirectUrl: String?+ sourceDirectUrl: String?,+ archiveStartSeconds: Long? = null,+ archiveEndSeconds: Long? = null): String {+ val repairedArchive = if (kind == StalkerStreamKind.ARCHIVE) {+ buildArchiveDirectCandidates(resolvedUrl, archiveStartSeconds, archiveEndSeconds).firstOrNull()+ ?: resolvedUrl+ } else {+ resolvedUrl+ }if (kind != StalkerStreamKind.LIVE || sourceDirectUrl.isNullOrBlank()) {- return resolvedUrl+ return repairedArchive}- val resolvedUri = runCatching { URI(resolvedUrl) }.getOrNull() ?: return resolvedUrl+ val resolvedUri = runCatching { URI(repairedArchive) }.getOrNull() ?: return repairedArchiveval sourceUri = runCatching { URI(sourceDirectUrl) }.getOrNull() ?: return resolvedUrlif (!isSameLivePlayPath(resolvedUri, sourceUri)) {- return resolvedUrl+ return repairedArchive}if (hasUsableLiveStreamTarget(resolvedUri)) {- return resolvedUrl+ return repairedArchive}- val sourceStreamId = sourceUri.queryParameter("stream")?.takeIf { it.isNotBlank() } ?: return resolvedUrl- return replaceQueryParameter(resolvedUri, "stream", sourceStreamId) ?: resolvedUrl+ val sourceStreamId = sourceUri.queryParameter("stream")?.takeIf { it.isNotBlank() } ?: return repairedArchive+ return replaceQueryParameter(resolvedUri, "stream", sourceStreamId) ?: repairedArchive}private fun hasUsableLiveStreamTarget(uri: URI): Boolean {@@ -754,6 +1127,11 @@ class StalkerProvider(} ?: directStreamUrl?: return nullval resolvedName = item.name.ifBlank { "Channel $numericId" }+ val catchUpSupported = item.archiveAvailable == true ||+ item.portalCapabilities.archiveAvailable ||+ item.allowLocalTimeshift == true ||+ item.allowLocalPvr == true ||+ item.allowRemotePvr == truereturn Channel(id = 0L,name = resolvedName,@@ -763,6 +1141,9 @@ class StalkerProvider(streamUrl = streamUrl,epgChannelId = item.epgChannelId ?: item.id,number = item.number.coerceAtLeast(0),+ catchUpSupported = catchUpSupported,+ catchUpDays = 0,+ catchUpSource = streamUrl.takeIf { catchUpSupported },providerId = providerId,isAdult = item.isAdult || AdultContentClassifier.isAdultCategoryName(category.name),isUserProtected = false,@@ -1044,17 +1425,42 @@ class StalkerProvider(val exceptionMessage = exception?.message?.lowercase(Locale.ROOT).orEmpty()return normalizedMessage.contains("http 401") ||normalizedMessage.contains("http 403") ||+ normalizedMessage.contains("http 204") ||normalizedMessage.contains("http 456") ||normalizedMessage.contains("authorization") ||normalizedMessage.contains("token") ||normalizedMessage.contains("access denied") ||normalizedMessage.contains("forbidden") ||normalizedMessage.contains("temporary playback link") ||+ normalizedMessage.contains("no content") ||+ normalizedMessage.contains("empty temporary link") ||exceptionMessage.contains("http 401") ||exceptionMessage.contains("http 403") ||+ exceptionMessage.contains("http 204") ||exceptionMessage.contains("http 456") ||exceptionMessage.contains("authorization") ||- exceptionMessage.contains("token")+ exceptionMessage.contains("token") ||+ exceptionMessage.contains("no content")+ }++ private fun validateArchiveWindow(+ kind: StalkerStreamKind,+ archiveStartSeconds: Long?,+ archiveEndSeconds: Long?+ ): String? {+ if (kind != StalkerStreamKind.ARCHIVE) {+ return null+ }+ val safeStart = archiveStartSeconds?.takeIf { it > 0L }+ ?: return "Archive playback requires a valid start time."+ val safeEnd = archiveEndSeconds?.takeIf { it > safeStart }+ ?: return "Archive playback requires an end time after the start time."+ val maxWindowSeconds = 7L * 24L * 60L * 60L+ return if (safeEnd - safeStart > maxWindowSeconds) {+ "Archive playback window is too large for a single request."+ } else {+ null+ }}}diff --git a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerUrlFactory.kt b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerUrlFactory.ktindex 6188bad1..f3c567e6 100644--- a/data/src/main/java/com/streamvault/data/remote/stalker/StalkerUrlFactory.kt+++ b/data/src/main/java/com/streamvault/data/remote/stalker/StalkerUrlFactory.kt@@ -8,6 +8,7 @@ import java.util.Localeenum class StalkerStreamKind(val pathSegment: String) {LIVE("live"),+ ARCHIVE("archive"),MOVIE("movie"),EPISODE("episode")}@@ -19,6 +20,8 @@ data class StalkerStreamToken(val cmd: String,val containerExtension: String? = null,val seriesNumber: Int? = null,+ val archiveStartSeconds: Long? = null,+ val archiveEndSeconds: Long? = null,val playbackDescriptor: StalkerPlaybackDescriptor? = null)@@ -71,6 +74,8 @@ object StalkerUrlFactory {cmd: String,containerExtension: String? = null,seriesNumber: Int? = null,+ archiveStartSeconds: Long? = null,+ archiveEndSeconds: Long? = null,playbackDescriptor: StalkerPlaybackDescriptor? = null): String {val resolvedDescriptor = playbackDescriptor?.copy(@@ -85,6 +90,10 @@ object StalkerUrlFactory {?.let { ext -> add("ext=${encode(ext.lowercase(Locale.ROOT))}") }seriesNumber?.takeIf { it > 0 }?.let { episode -> add("series=${encode(episode.toString())}") }+ archiveStartSeconds?.takeIf { it > 0L }+ ?.let { start -> add("utc=${encode(start.toString())}") }+ archiveEndSeconds?.takeIf { it > 0L }+ ?.let { end -> add("lutc=${encode(end.toString())}") }resolvedDescriptor?.let { descriptor ->add("mode=${encode(descriptor.candidates.firstOrNull()?.playbackMode?.name ?: descriptor.primaryMode.name)}")add("pm=${encode(descriptor.primaryMode.name)}")@@ -109,6 +118,8 @@ object StalkerUrlFactory {val cmd = query["cmd"] ?: return nullval ext = query["ext"]?.trim()?.takeIf { it.isNotBlank() }val seriesNumber = query["series"]?.toIntOrNull()?.takeIf { it > 0 }+ val archiveStartSeconds = query["utc"]?.toLongOrNull()?.takeIf { it > 0L }+ val archiveEndSeconds = query["lutc"]?.toLongOrNull()?.takeIf { it > 0L }val capabilities = decodePortalCapabilities(query["caps"])val primaryMode = query["mode"]?.let { runCatching { StalkerPlaybackMode.valueOf(it) }.getOrNull() }@@ -135,6 +146,8 @@ object StalkerUrlFactory {cmd = cmd,containerExtension = ext,seriesNumber = seriesNumber,+ archiveStartSeconds = archiveStartSeconds,+ archiveEndSeconds = archiveEndSeconds,playbackDescriptor = playbackDescriptor)}@@ -143,6 +156,7 @@ object StalkerUrlFactory {private fun kindFromPathSegment(segment: String): StalkerStreamKind? = when (segment.lowercase(Locale.ROOT)) {StalkerStreamKind.LIVE.pathSegment -> StalkerStreamKind.LIVE+ StalkerStreamKind.ARCHIVE.pathSegment -> StalkerStreamKind.ARCHIVEStalkerStreamKind.MOVIE.pathSegment -> StalkerStreamKind.MOVIEStalkerStreamKind.EPISODE.pathSegment -> StalkerStreamKind.EPISODEelse -> nulldiff --git a/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.kt b/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.ktindex f4bc4578..59be8db7 100644--- a/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.kt+++ b/data/src/main/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolver.kt@@ -13,6 +13,12 @@ import com.streamvault.data.security.CredentialCryptoimport com.streamvault.data.util.UrlSecurityPolicyimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.ProviderTypeimport java.net.URIimport java.util.concurrent.ConcurrentHashMap@@ -39,6 +45,12 @@ class XtreamStreamUrlResolver @Inject constructor(val authMode: StalkerAuthMode,val username: String,val password: String,+ val portalFingerprint: StalkerPortalFingerprint,+ val magPreset: StalkerMagPreset,+ val bootstrapRecipe: StalkerBootstrapRecipe,+ val endpointPreference: StalkerEndpointPreference,+ val cookieMode: StalkerCookieMode,+ val playbackBackendHint: StalkerPlaybackBackendHint,val deviceProfile: String,val timezone: String,val locale: String,@@ -141,7 +153,13 @@ class XtreamStreamUrlResolver @Inject constructor(}val playbackInfo = when (val resolvedResult = getOrCreateStalkerProvider(resolvedProvider)- .resolvePlaybackInfo(token.kind, token.playbackDescriptor, token.seriesNumber)+ .resolvePlaybackInfo(+ kind = token.kind,+ descriptor = token.playbackDescriptor,+ seriesNumber = token.seriesNumber,+ archiveStartSeconds = token.archiveStartSeconds,+ archiveEndSeconds = token.archiveEndSeconds+ )) {is com.streamvault.domain.model.Result.Success -> resolvedResult.datais com.streamvault.domain.model.Result.Error -> throw StalkerPlaybackResolutionException(@@ -150,7 +168,7 @@ class XtreamStreamUrlResolver @Inject constructor()else -> return null}- persistStalkerPlaybackMode(resolvedProvider, playbackInfo.playbackMode)+ persistStalkerPlaybackLearning(resolvedProvider, playbackInfo)ResolvedStreamUrl(url = playbackInfo.url,expirationTime = extractStreamExpirationTime(playbackInfo.url),@@ -197,7 +215,7 @@ class XtreamStreamUrlResolver @Inject constructor()else -> return null}- persistStalkerPlaybackMode(provider, playbackInfo.playbackMode)+ persistStalkerPlaybackLearning(provider, playbackInfo)return ResolvedStreamUrl(url = playbackInfo.url,expirationTime = extractStreamExpirationTime(playbackInfo.url),@@ -270,6 +288,12 @@ class XtreamStreamUrlResolver @Inject constructor(cached.authMode == provider.stalkerAuthMode &&cached.username == provider.username &&cached.password == provider.password &&+ cached.portalFingerprint == provider.stalkerPortalFingerprint &&+ cached.magPreset == provider.stalkerMagPreset &&+ cached.bootstrapRecipe == provider.stalkerLastBootstrapRecipe &&+ cached.endpointPreference == provider.stalkerEndpointPreference &&+ cached.cookieMode == provider.stalkerCookieMode &&+ cached.playbackBackendHint == provider.stalkerPlaybackBackendHint &&cached.deviceProfile == provider.stalkerDeviceProfile &&cached.timezone == provider.stalkerDeviceTimezone &&cached.locale == provider.stalkerDeviceLocale &&@@ -290,6 +314,12 @@ class XtreamStreamUrlResolver @Inject constructor(authMode = provider.stalkerAuthMode,username = provider.username,password = decryptedPassword,+ portalFingerprintHint = provider.stalkerPortalFingerprint,+ magPresetHint = provider.stalkerMagPreset,+ bootstrapRecipeHint = provider.stalkerLastBootstrapRecipe,+ endpointPreferenceHint = provider.stalkerEndpointPreference,+ cookieModeHint = provider.stalkerCookieMode,+ playbackBackendHint = provider.stalkerPlaybackBackendHint,portalProfileHint = provider.stalkerPortalProfile,preferredPlaybackMode = provider.stalkerLastPlaybackMode?.let { value -> runCatching { StalkerPlaybackMode.valueOf(value) }.getOrNull() },@@ -307,6 +337,12 @@ class XtreamStreamUrlResolver @Inject constructor(authMode = provider.stalkerAuthMode,username = provider.username,password = provider.password,+ portalFingerprint = provider.stalkerPortalFingerprint,+ magPreset = provider.stalkerMagPreset,+ bootstrapRecipe = provider.stalkerLastBootstrapRecipe,+ endpointPreference = provider.stalkerEndpointPreference,+ cookieMode = provider.stalkerCookieMode,+ playbackBackendHint = provider.stalkerPlaybackBackendHint,deviceProfile = provider.stalkerDeviceProfile,timezone = provider.stalkerDeviceTimezone,locale = provider.stalkerDeviceLocale,@@ -319,14 +355,20 @@ class XtreamStreamUrlResolver @Inject constructor(return resolvedProvider}- private suspend fun persistStalkerPlaybackMode(+ private suspend fun persistStalkerPlaybackLearning(provider: ProviderEntity,- mode: com.streamvault.data.remote.stalker.StalkerPlaybackMode+ playbackInfo: com.streamvault.data.remote.stalker.StalkerPlaybackInfo) {- if (provider.stalkerLastPlaybackMode == mode.name) {+ val updated = provider.copy(+ stalkerLastPlaybackMode = playbackInfo.playbackMode.name,+ stalkerEndpointPreference = playbackInfo.endpointPreference,+ stalkerCookieMode = playbackInfo.cookieMode,+ stalkerPlaybackBackendHint = playbackInfo.backendHint+ )+ if (updated == provider) {return}- providerDao.update(provider.copy(stalkerLastPlaybackMode = mode.name))+ providerDao.update(updated)}}diff --git a/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.ktindex 402b63f0..277c9229 100644--- a/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/MovieRepositoryImpl.kt@@ -1489,6 +1489,12 @@ class MovieRepositoryImpl @Inject constructor(authMode = provider.stalkerAuthMode,username = provider.username,password = credentialCrypto.decryptIfNeeded(provider.password),+ portalFingerprintHint = provider.stalkerPortalFingerprint,+ magPresetHint = provider.stalkerMagPreset,+ bootstrapRecipeHint = provider.stalkerLastBootstrapRecipe,+ endpointPreferenceHint = provider.stalkerEndpointPreference,+ cookieModeHint = provider.stalkerCookieMode,+ playbackBackendHint = provider.stalkerPlaybackBackendHint,portalProfileHint = provider.stalkerPortalProfile,preferredPlaybackMode = provider.stalkerLastPlaybackMode?.let { value -> runCatching { StalkerPlaybackMode.valueOf(value) }.getOrNull() },diff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex 87f9535a..af496d08 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -741,7 +741,13 @@ class ProviderRepositoryImpl @Inject constructor(val source = channel?.catchUpSource ?: return emptyList()buildM3uCatchUpUrls(source, start, end)}- ProviderType.STALKER_PORTAL -> emptyList()+ ProviderType.STALKER_PORTAL -> createStalkerProviderFromEntity(providerEntity).buildCatchUpUrls(+ streamId = resolvedStreamId,+ start = start,+ end = end,+ sourceStreamUrl = channel?.streamUrl,+ sourceCatchUpSource = channel?.catchUpSource+ )}}@@ -778,6 +784,12 @@ class ProviderRepositoryImpl @Inject constructor(authMode: StalkerAuthMode,username: String,password: String,+ portalFingerprintHint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ magPresetHint: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ bootstrapRecipeHint: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ endpointPreferenceHint: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ cookieModeHint: StalkerCookieMode = StalkerCookieMode.NONE,+ playbackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,portalProfileHint: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,preferredPlaybackMode: StalkerPlaybackMode? = null,deviceProfile: String,@@ -796,6 +808,12 @@ class ProviderRepositoryImpl @Inject constructor(authMode = authMode,username = username,password = password,+ portalFingerprintHint = portalFingerprintHint,+ magPresetHint = magPresetHint,+ bootstrapRecipeHint = bootstrapRecipeHint,+ endpointPreferenceHint = endpointPreferenceHint,+ cookieModeHint = cookieModeHint,+ playbackBackendHint = playbackBackendHint,portalProfileHint = portalProfileHint,preferredPlaybackMode = preferredPlaybackMode,deviceProfile = deviceProfile,@@ -820,6 +838,12 @@ class ProviderRepositoryImpl @Inject constructor(} catch (_: Throwable) {""},+ portalFingerprintHint = entity.stalkerPortalFingerprint,+ magPresetHint = entity.stalkerMagPreset,+ bootstrapRecipeHint = entity.stalkerLastBootstrapRecipe,+ endpointPreferenceHint = entity.stalkerEndpointPreference,+ cookieModeHint = entity.stalkerCookieMode,+ playbackBackendHint = entity.stalkerPlaybackBackendHint,portalProfileHint = entity.stalkerPortalProfile,preferredPlaybackMode = entity.stalkerLastPlaybackMode?.let { runCatching { StalkerPlaybackMode.valueOf(it) }.getOrNull() },diff --git a/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.ktindex 6f77bb68..00dd9b3d 100644--- a/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt@@ -1445,6 +1445,12 @@ class SeriesRepositoryImpl @Inject constructor(authMode = provider.stalkerAuthMode,username = provider.username,password = credentialCrypto.decryptIfNeeded(provider.password),+ portalFingerprintHint = provider.stalkerPortalFingerprint,+ magPresetHint = provider.stalkerMagPreset,+ bootstrapRecipeHint = provider.stalkerLastBootstrapRecipe,+ endpointPreferenceHint = provider.stalkerEndpointPreference,+ cookieModeHint = provider.stalkerCookieMode,+ playbackBackendHint = provider.stalkerPlaybackBackendHint,portalProfileHint = provider.stalkerPortalProfile,preferredPlaybackMode = provider.stalkerLastPlaybackMode?.let { value -> runCatching { StalkerPlaybackMode.valueOf(value) }.getOrNull() },diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt b/data/src/main/java/com/streamvault/data/sync/SyncManager.ktindex 787e20fb..e1366120 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt@@ -4322,6 +4322,12 @@ class SyncManager @Inject constructor(authMode = provider.stalkerAuthMode,username = provider.username,password = provider.password,+ portalFingerprintHint = provider.stalkerPortalFingerprint,+ magPresetHint = provider.stalkerMagPreset,+ bootstrapRecipeHint = provider.stalkerLastBootstrapRecipe,+ endpointPreferenceHint = provider.stalkerEndpointPreference,+ cookieModeHint = provider.stalkerCookieMode,+ playbackBackendHint = provider.stalkerPlaybackBackendHint,portalProfileHint = provider.stalkerPortalProfile,preferredPlaybackMode = provider.stalkerLastPlaybackMode?.let { value -> runCatching { StalkerPlaybackMode.valueOf(value) }.getOrNull() },diff --git a/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.kt b/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.ktindex 9e6912af..7b93da6e 100644--- a/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/stalker/OkHttpStalkerApiServiceTest.kt@@ -2,6 +2,9 @@ package com.streamvault.data.remote.stalkerimport com.google.common.truth.Truth.assertThatimport com.streamvault.domain.model.Result+import com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerMagPresetimport kotlinx.coroutines.test.runTestimport kotlinx.serialization.json.Jsonimport okhttp3.Interceptor@@ -14,6 +17,63 @@ import org.junit.Testclass OkHttpStalkerApiServiceTest {+ @Test+ fun authenticate_retries_with_legacy_recipe_and_updates_profile_metadata() = runTest {+ val requestedVersions = mutableListOf<String>()+ val requestedImages = mutableListOf<String>()+ val service = OkHttpStalkerApiService(+ okHttpClient = OkHttpClient.Builder()+ .addInterceptor { chain ->+ val request = chain.request()+ val action = request.url.queryParameter("action").orEmpty()+ if (action == "get_profile") {+ requestedVersions += request.url.queryParameter("ver").orEmpty()+ requestedImages += request.url.queryParameter("image_version").orEmpty()+ }+ val body = when (action) {+ "handshake" -> """{"js":{"token":"token-123"}}"""+ "get_profile" -> if (requestedVersions.size <= 2) {+ ""+ } else {+ """{"js":{"id":"42","name":"Legacy Box","status":"1","auth_access":true}}"""+ }+ "get_main_info" -> """{"js":{"id":"42","name":"Legacy Box","status":"1","auth_access":true}}"""+ else -> error("Unexpected action '$action'")+ }+ Response.Builder()+ .request(request)+ .protocol(Protocol.HTTP_1_1)+ .code(200)+ .message("OK")+ .body(body.toResponseBody("application/json".toMediaType()))+ .build()+ }+ .build(),+ json = Json { ignoreUnknownKeys = true }+ )++ val result = service.authenticate(+ buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ authMode = StalkerAuthMode.AUTO,+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ assertThat(success.data.first.magPreset).isEqualTo(StalkerMagPreset.MAG250_LEGACY)+ assertThat(success.data.first.bootstrapRecipe).isEqualTo(StalkerBootstrapRecipe.LEGACY_MAG)+ assertThat(success.data.second.magPreset).isEqualTo(StalkerMagPreset.MAG250_LEGACY)+ assertThat(success.data.second.bootstrapRecipe).isEqualTo(StalkerBootstrapRecipe.LEGACY_MAG)+ assertThat(success.data.first.recipeEvidence).containsAtLeast("fallback_recipe", "rediscovery_attempted")+ assertThat(requestedImages).containsExactly("218", "218", "216").inOrder()+ assertThat(requestedVersions.last()).contains("0.2.16-r17-250")+ }+@Testfun authenticate_reads_token_and_profile_from_js_wrapper() = runTest {val service = OkHttpStalkerApiService(@@ -41,6 +101,61 @@ class OkHttpStalkerApiServiceTest {assertThat(success.data.second.maxConnections).isEqualTo(2)}+ @Test+ fun authenticate_module_gated_recipe_rebuilds_profile_for_modern_mag_preset() = runTest {+ val requestedStbTypes = mutableListOf<String>()+ val requestedAgents = mutableListOf<String>()+ val requestedPaths = mutableListOf<String>()+ val service = OkHttpStalkerApiService(+ okHttpClient = OkHttpClient.Builder()+ .addInterceptor { chain ->+ val request = chain.request()+ requestedPaths += request.url.encodedPath+ val action = request.url.queryParameter("action").orEmpty()+ if (action == "get_profile") {+ requestedStbTypes += request.url.queryParameter("stb_type").orEmpty()+ requestedAgents += request.header("X-User-Agent").orEmpty()+ }+ val body = when (action) {+ "handshake" -> """{"js":{"token":"token-123"}}"""+ "get_profile" -> """{"js":{"id":"55","name":"Module Portal","status":"1","auth_access":true}}"""+ "get_main_info" -> """{"js":{"id":"55","name":"Module Portal","status":"1","auth_access":true}}"""+ "get_localization" -> """{"js":{"lang":"en","timezone":"UTC"}}"""+ "get_modules" -> """{"js":{"modules":{"itv":1,"vod":1}}}"""+ "get_events" -> """{"js":[] }"""+ else -> error("Unexpected action '$action'")+ }+ Response.Builder()+ .request(request)+ .protocol(Protocol.HTTP_1_1)+ .code(200)+ .message("OK")+ .body(body.toResponseBody("application/json".toMediaType()))+ .build()+ }+ .build(),+ json = Json { ignoreUnknownKeys = true }+ )++ val result = service.authenticate(+ buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ authMode = StalkerAuthMode.AUTO,+ magPresetHint = StalkerMagPreset.GENERIC_SAFE,+ portalFingerprintHint = com.streamvault.domain.model.StalkerPortalFingerprint.MODULE_GATED,+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ assertThat(requestedPaths.first()).isEqualTo("/portal.php")+ assertThat(requestedStbTypes).contains("MAG322")+ assertThat(requestedAgents.last()).contains("MAG322")+ }+@Testfun createLink_reads_cmd_from_js_wrapper() = runTest {val service = OkHttpStalkerApiService(@@ -119,6 +234,91 @@ class OkHttpStalkerApiServiceTest {assertThat(success.data).isEqualTo("http://cdn.example.com/series/episode11.mkv")}+ @Test+ fun createLink_appends_archive_window_for_archive_streams() = runTest {+ val service = OkHttpStalkerApiService(+ okHttpClient = OkHttpClient.Builder()+ .addInterceptor { chain ->+ Response.Builder()+ .request(chain.request())+ .protocol(Protocol.HTTP_1_1)+ .code(200)+ .message("OK")+ .body(+ """{"js":{"cmd":"ffmpeg http://portal.example.com/play/live.php?stream=301&play_token=abc"}}"""+ .toResponseBody("application/json".toMediaType())+ )+ .build()+ }+ .build(),+ json = Json { ignoreUnknownKeys = true }+ )++ val result = service.createLink(+ session = StalkerSession(+ loadUrl = "https://portal.example.com/server/load.php",+ portalReferer = "https://portal.example.com/c/",+ token = "token-123"+ ),+ profile = buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ ),+ kind = StalkerStreamKind.ARCHIVE,+ cmd = "ffmpeg http://localhost/ch/301_",+ archiveStartSeconds = 1000L,+ archiveEndSeconds = 1300L+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ assertThat(success.data).contains("utc=1000")+ assertThat(success.data).contains("lutc=1300")+ }++ @Test+ fun buildStalkerDeviceProfile_sanitizes_impossible_auth_mode_hints() {+ val credentialsOnly = buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "",+ authMode = com.streamvault.domain.model.StalkerAuthMode.MAC_PLUS_CREDENTIALS,+ username = "alice",+ password = "secret",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )+ val macOnly = buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ authMode = com.streamvault.domain.model.StalkerAuthMode.CREDENTIALS_ONLY,+ username = "",+ password = "",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )+ val strictProfile = buildStalkerDeviceProfile(+ portalUrl = "https://portal.example.com/c",+ macAddress = "00:1A:79:12:34:56",+ authMode = com.streamvault.domain.model.StalkerAuthMode.MAC_ONLY,+ magPresetHint = com.streamvault.domain.model.StalkerMagPreset.MAG254_STRICT,+ username = "",+ password = "",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )++ assertThat(credentialsOnly.authMode).isEqualTo(com.streamvault.domain.model.StalkerAuthMode.CREDENTIALS_ONLY)+ assertThat(macOnly.authMode).isEqualTo(com.streamvault.domain.model.StalkerAuthMode.MAC_ONLY)+ assertThat(strictProfile.deviceProfile).isEqualTo("MAG254")+ assertThat(strictProfile.userAgent).contains("MAG254")+ }+@Testfun authenticate_reads_json_from_callback_wrapper_and_control_char_noise() = runTest {val service = OkHttpStalkerApiService(diff --git a/data/src/test/java/com/streamvault/data/remote/stalker/StalkerPortalReplayHarnessTest.kt b/data/src/test/java/com/streamvault/data/remote/stalker/StalkerPortalReplayHarnessTest.ktindex 94256438..33b0178e 100644--- a/data/src/test/java/com/streamvault/data/remote/stalker/StalkerPortalReplayHarnessTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/stalker/StalkerPortalReplayHarnessTest.kt@@ -1,8 +1,15 @@package com.streamvault.data.remote.stalkerimport com.google.common.truth.Truth.assertThat+import com.google.common.truth.Truth.assertWithMessageimport com.streamvault.domain.model.Resultimport com.streamvault.domain.model.StalkerAuthMode+import com.streamvault.domain.model.StalkerBootstrapRecipe+import com.streamvault.domain.model.StalkerCookieMode+import com.streamvault.domain.model.StalkerEndpointPreference+import com.streamvault.domain.model.StalkerMagPreset+import com.streamvault.domain.model.StalkerPlaybackBackendHint+import com.streamvault.domain.model.StalkerPortalFingerprintimport com.streamvault.domain.model.StalkerPortalProfileimport java.io.InputStreamReaderimport kotlinx.coroutines.test.runTest@@ -26,7 +33,18 @@ class StalkerPortalReplayHarnessTest {"stalker/fixtures/auth_required.json","stalker/fixtures/auth_plus_mag.json","stalker/fixtures/module_gated.json",- "stalker/fixtures/nginx_temp_link.json"+ "stalker/fixtures/nginx_temp_link.json",+ "stalker/fixtures/strict_mag_legacy.json",+ "stalker/fixtures/temp_link_strict.json",+ "stalker/fixtures/recipe_fallback.json",+ "stalker/fixtures/direct_cookie_playback.json",+ "stalker/fixtures/play_live_cookie.json",+ "stalker/fixtures/play_movie_vod.json",+ "stalker/fixtures/portal_endpoint_preferred.json",+ "stalker/fixtures/archive_create_link.json",+ "stalker/fixtures/archive_direct_cookie.json",+ "stalker/fixtures/archive_strict_mag.json",+ "stalker/fixtures/archive_recipe_fallback.json").forEach { path ->val fixture = loadFixture(path)val requestedActions = mutableListOf<String>()@@ -39,6 +57,15 @@ class StalkerPortalReplayHarnessTest {portalUrl = fixture.device.portalUrl,macAddress = fixture.device.macAddress,authMode = StalkerAuthMode.valueOf(fixture.device.authMode),+ endpointPreferenceHint = fixture.device.endpointPreference+ ?.let(StalkerEndpointPreference::valueOf)+ ?: StalkerEndpointPreference.AUTO,+ cookieModeHint = fixture.device.cookieMode+ ?.let(StalkerCookieMode::valueOf)+ ?: StalkerCookieMode.NONE,+ playbackBackendHint = fixture.device.playbackBackendHint+ ?.let(StalkerPlaybackBackendHint::valueOf)+ ?: StalkerPlaybackBackendHint.AUTO,username = fixture.device.username,password = fixture.device.password,deviceProfile = fixture.device.deviceProfile,@@ -48,25 +75,102 @@ class StalkerPortalReplayHarnessTest {val authResult = service.authenticate(profile)assertThat(authResult).isInstanceOf(Result.Success::class.java)val authSuccess = authResult as Result.Success- assertThat(authSuccess.data.first.effectiveAuthMode.name).isEqualTo(fixture.expected.authMode)- assertThat(authSuccess.data.first.portalProfile.name).isEqualTo(fixture.expected.portalProfile)- assertThat(authSuccess.data.first.bootstrapEvidence).containsExactlyElementsIn(fixture.expected.bootstrapEvidence).inOrder()+ assertWithFixture(path, authSuccess.data.first.effectiveAuthMode.name)+ .isEqualTo(fixture.expected.authMode)+ assertWithFixture(path, authSuccess.data.first.portalProfile.name)+ .isEqualTo(fixture.expected.portalProfile)+ assertThat(authSuccess.data.first.bootstrapEvidence)+ .containsExactlyElementsIn(fixture.expected.bootstrapEvidence)+ .inOrder()+ fixture.expected.portalFingerprint?.let { expectedFingerprint ->+ assertWithFixture(path, authSuccess.data.first.portalFingerprint)+ .isEqualTo(StalkerPortalFingerprint.valueOf(expectedFingerprint))+ assertWithFixture(path, authSuccess.data.second.portalFingerprint)+ .isEqualTo(StalkerPortalFingerprint.valueOf(expectedFingerprint))+ }+ fixture.expected.magPreset?.let { expectedPreset ->+ assertWithFixture(path, authSuccess.data.first.magPreset)+ .isEqualTo(StalkerMagPreset.valueOf(expectedPreset))+ assertWithFixture(path, authSuccess.data.second.magPreset)+ .isEqualTo(StalkerMagPreset.valueOf(expectedPreset))+ }+ fixture.expected.bootstrapRecipe?.let { expectedRecipe ->+ assertWithFixture(path, authSuccess.data.first.bootstrapRecipe)+ .isEqualTo(StalkerBootstrapRecipe.valueOf(expectedRecipe))+ assertWithFixture(path, authSuccess.data.second.bootstrapRecipe)+ .isEqualTo(StalkerBootstrapRecipe.valueOf(expectedRecipe))+ }+ fixture.expected.recipeEvidence?.let { expectedEvidence ->+ assertThat(authSuccess.data.first.recipeEvidence)+ .containsAtLeastElementsIn(expectedEvidence)+ }+ fixture.expected.endpointPreference?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.endpointPreference)+ .isEqualTo(StalkerEndpointPreference.valueOf(expected))+ }+ fixture.expected.cookieMode?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.cookieMode)+ .isEqualTo(StalkerCookieMode.valueOf(expected))+ }+ fixture.expected.playbackBackendHint?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.playbackBackendHint)+ .isEqualTo(StalkerPlaybackBackendHint.valueOf(expected))+ }+ fixture.expected.archiveEndpointPreference?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.archiveEndpointPreference)+ .isEqualTo(StalkerEndpointPreference.valueOf(expected))+ }+ fixture.expected.archiveViaCreateLink?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.archiveViaCreateLink)+ .isEqualTo(expected)+ }+ fixture.expected.archiveViaDirectUrl?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.archiveViaDirectUrl)+ .isEqualTo(expected)+ }+ fixture.expected.archiveRequiresBootstrapPrep?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.archiveRequiresBootstrapPrep)+ .isEqualTo(expected)+ }+ fixture.expected.archiveRequiresStrictCookies?.let { expected ->+ assertWithFixture(path, authSuccess.data.first.fingerprintEvidence.archiveRequiresStrictCookies)+ .isEqualTo(expected)+ }fixture.expected.playbackMode?.let { expectedPlaybackMode ->- val liveResult = service.getLiveStreams(- session = authSuccess.data.first,- profile = profile,- categoryId = null- )- assertThat(liveResult).isInstanceOf(Result.Success::class.java)- val firstItem = (liveResult as Result.Success).data.first()+ val catalogType = fixture.expected.catalogType ?: "LIVE"+ val firstItem = when (catalogType.uppercase()) {+ "VOD", "MOVIE" -> {+ val vodResult = service.getVodStreams(+ session = authSuccess.data.first,+ profile = profile,+ categoryId = null+ )+ assertThat(vodResult).isInstanceOf(Result.Success::class.java)+ (vodResult as Result.Success).data.first()+ }++ else -> {+ val liveResult = service.getLiveStreams(+ session = authSuccess.data.first,+ profile = profile,+ categoryId = null+ )+ assertThat(liveResult).isInstanceOf(Result.Success::class.java)+ (liveResult as Result.Success).data.first()+ }+ }fixture.expected.resolvedPlaybackUrl?.let { expectedUrl ->val createLinkResult = service.createLink(session = authSuccess.data.first,profile = profile,- kind = StalkerStreamKind.LIVE,+ kind = fixture.expected.streamKind+ ?.let(StalkerStreamKind::valueOf)+ ?: StalkerStreamKind.LIVE,cmd = firstItem.cmd.orEmpty(),- seriesNumber = null+ seriesNumber = null,+ archiveStartSeconds = fixture.expected.catchUpStartSeconds,+ archiveEndSeconds = fixture.expected.catchUpEndSeconds)assertThat(createLinkResult).isInstanceOf(Result.Success::class.java)val resolvedUrl = (createLinkResult as Result.Success).data@@ -75,10 +179,15 @@ class StalkerPortalReplayHarnessTest {.isEqualTo(expectedPlaybackMode)} ?: assertThat(firstItem.playbackDescriptor?.primaryMode?.name).isEqualTo(expectedPlaybackMode)}- assertThat(requestedActions).containsAtLeastElementsIn(fixture.expected.requestOrder).inOrder()+ assertThat(requestedActions)+ .containsAtLeastElementsIn(fixture.expected.requestOrder)+ .inOrder()}}+ private fun <T> assertWithFixture(path: String, actual: T) =+ assertWithMessage(path).that(actual)+private fun fakeReplayClient(fixture: ReplayFixture,requestedActions: MutableList<String>@@ -94,13 +203,16 @@ class StalkerPortalReplayHarnessTest {val key = "$method:$action"val scripted = responsesByAction[key]?.removeFirstOrNull()?: error("Missing replay response for $key in fixture ${fixture.name}")- Response.Builder()+ val builder = Response.Builder().request(request).protocol(Protocol.HTTP_1_1).code(scripted.code).message("OK").body(scripted.body.toResponseBody("application/json".toMediaType()))- .build()+ scripted.headers.orEmpty().forEach { (name, value) ->+ builder.addHeader(name, value)+ }+ builder.build()}.build()}@@ -126,6 +238,9 @@ private data class ReplayDevice(val portalUrl: String,val macAddress: String,val authMode: String,+ val endpointPreference: String? = null,+ val cookieMode: String? = null,+ val playbackBackendHint: String? = null,val username: String = "",val password: String = "",val deviceProfile: String = "MAG250",@@ -138,6 +253,7 @@ private data class ReplayResponse(val action: String,val method: String = "GET",val code: Int = 200,+ val headers: Map<String, String>? = null,val body: String)@@ -147,6 +263,22 @@ private data class ReplayExpectation(val portalProfile: String,val bootstrapEvidence: List<String>,val requestOrder: List<String>,+ val portalFingerprint: String? = null,+ val magPreset: String? = null,+ val bootstrapRecipe: String? = null,+ val recipeEvidence: List<String>? = null,+ val endpointPreference: String? = null,+ val cookieMode: String? = null,+ val playbackBackendHint: String? = null,+ val archiveEndpointPreference: String? = null,+ val archiveViaCreateLink: Boolean? = null,+ val archiveViaDirectUrl: Boolean? = null,+ val archiveRequiresBootstrapPrep: Boolean? = null,+ val archiveRequiresStrictCookies: Boolean? = null,+ val catalogType: String? = null,+ val streamKind: String? = null,val playbackMode: String? = null,- val resolvedPlaybackUrl: String? = null+ val resolvedPlaybackUrl: String? = null,+ val catchUpStartSeconds: Long? = null,+ val catchUpEndSeconds: Long? = null)diff --git a/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.kt b/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.ktindex 510d33a4..ae5a7f82 100644--- a/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/stalker/StalkerProviderTest.kt@@ -3,6 +3,7 @@ package com.streamvault.data.remote.stalkerimport com.google.common.truth.Truth.assertThatimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.Result+import java.time.Instantimport kotlinx.coroutines.test.runTestimport org.junit.Test@@ -58,8 +59,251 @@ class StalkerProviderTest {assertThat(success.data.status).isEqualTo(ProviderStatus.EXPIRED)}+ @Test+ fun getLiveStreams_maps_archive_capabilities_to_catch_up_fields() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(+ profile = StalkerProviderProfile(accountName = "Room"),+ liveStreams = listOf(+ StalkerItemRecord(+ id = "1200",+ name = "Archive TV",+ cmd = "ffmpeg http://localhost/ch/1200_",+ streamUrl = "http://localhost/ch/1200_",+ portalCapabilities = StalkerPortalCapabilities(+ archiveAvailable = true,+ allowLocalTimeshift = true+ ),+ archiveAvailable = true+ )+ )+ ),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )++ val result = provider.getLiveStreams()++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ val channel = success.data.single()+ assertThat(channel.catchUpSupported).isTrue()+ assertThat(channel.catchUpSource).isNotEmpty()+ }++ @Test+ fun buildCatchUpUrls_returns_internal_archive_candidates_for_live_token() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(profile = StalkerProviderProfile(accountName = "Room")),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ playbackBackendHint = com.streamvault.domain.model.StalkerPlaybackBackendHint.PLAY_LIVE,+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )+ val start = Instant.parse("2024-01-01T10:00:00Z").epochSecond+ val end = Instant.parse("2024-01-01T11:00:00Z").epochSecond+ val sourceStreamUrl = StalkerUrlFactory.buildInternalStreamUrl(+ providerId = 7,+ kind = StalkerStreamKind.LIVE,+ itemId = 1200L,+ cmd = "ffmpeg http://localhost/ch/1200_",+ playbackDescriptor = checkNotNull(+ buildStalkerPlaybackDescriptor(+ primaryCmd = "ffmpeg http://localhost/ch/1200_",+ capabilities = StalkerPortalCapabilities(archiveAvailable = true)+ )+ ),+ )++ val urls = provider.buildCatchUpUrls(+ streamId = 1200L,+ start = start,+ end = end,+ sourceStreamUrl = sourceStreamUrl,+ sourceCatchUpSource = sourceStreamUrl+ )++ assertThat(urls).isNotEmpty()+ val token = StalkerUrlFactory.parseInternalStreamUrl(urls.first())+ assertThat(token?.kind).isEqualTo(StalkerStreamKind.ARCHIVE)+ assertThat(token?.archiveStartSeconds).isEqualTo(start)+ assertThat(token?.archiveEndSeconds).isEqualTo(end)+ }++ @Test+ fun buildCatchUpUrls_ignores_tokens_from_other_providers() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(profile = StalkerProviderProfile(accountName = "Room")),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )+ val foreignToken = StalkerUrlFactory.buildInternalStreamUrl(+ providerId = 99,+ kind = StalkerStreamKind.LIVE,+ itemId = 1200L,+ cmd = "ffmpeg http://localhost/ch/1200_"+ )++ val urls = provider.buildCatchUpUrls(+ streamId = 1200L,+ start = Instant.parse("2024-01-01T10:00:00Z").epochSecond,+ end = Instant.parse("2024-01-01T11:00:00Z").epochSecond,+ sourceStreamUrl = foreignToken,+ sourceCatchUpSource = foreignToken+ )++ assertThat(urls).isEmpty()+ }++ @Test+ fun resolvePlaybackInfo_rejects_invalid_archive_window() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(profile = StalkerProviderProfile(accountName = "Room")),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )++ val result = provider.resolvePlaybackInfo(+ kind = StalkerStreamKind.ARCHIVE,+ descriptor = buildStalkerPlaybackDescriptor("ffmpeg http://localhost/ch/1200_"),+ archiveStartSeconds = 1_000L,+ archiveEndSeconds = 999L+ )++ assertThat(result).isInstanceOf(Result.Error::class.java)+ val error = result as Result.Error+ assertThat(error.message).contains("end time after the start time")+ }++ @Test+ fun resolvePlaybackInfo_omits_authorization_for_play_live_temp_links() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(+ profile = StalkerProviderProfile(accountName = "Room"),+ createLinkUrl = "http://fdox.org:8080/play/live.php?mac=00:1A:79:BA:73:FA&stream=228556&extension=ts&play_token=abc123"+ ),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ playbackBackendHint = com.streamvault.domain.model.StalkerPlaybackBackendHint.TEMP_LINK_STRICT,+ cookieModeHint = com.streamvault.domain.model.StalkerCookieMode.CREATE_LINK,+ deviceProfile = "MAG322",+ timezone = "UTC",+ locale = "en"+ )++ val result = provider.resolvePlaybackInfo(+ kind = StalkerStreamKind.LIVE,+ descriptor = checkNotNull(+ buildStalkerPlaybackDescriptor(+ primaryCmd = "ffmpeg http://localhost/ch/1200_",+ capabilities = StalkerPortalCapabilities(+ useHttpTemporaryLink = true,+ nginxSecureLink = true+ )+ )+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ assertThat(success.data.headers).doesNotContainKey("Authorization")+ assertThat(success.data.headers).containsKey("Referer")+ assertThat(success.data.headers).containsKey("Cookie")+ assertThat(success.data.headers).containsKey("X-User-Agent")+ assertThat(success.data.cookieMode).isNotEqualTo(com.streamvault.domain.model.StalkerCookieMode.NONE)+ }++ @Test+ fun resolvePlaybackInfo_uses_latest_api_cookie_snapshot_for_playback_headers() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(+ profile = StalkerProviderProfile(accountName = "Room"),+ createLinkUrl = "http://fdox.org:8080/play/live.php?stream=228556&play_token=abc123",+ currentCookieHeader = "PHPSESSID=fresh-session"+ ),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ playbackBackendHint = com.streamvault.domain.model.StalkerPlaybackBackendHint.TEMP_LINK_STRICT,+ cookieModeHint = com.streamvault.domain.model.StalkerCookieMode.CREATE_LINK,+ deviceProfile = "MAG322",+ timezone = "UTC",+ locale = "en"+ )++ val result = provider.resolvePlaybackInfo(+ kind = StalkerStreamKind.LIVE,+ descriptor = checkNotNull(+ buildStalkerPlaybackDescriptor(+ primaryCmd = "ffmpeg http://localhost/ch/1200_",+ capabilities = StalkerPortalCapabilities(useHttpTemporaryLink = true)+ )+ )+ )++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ assertThat(success.data.headers["Cookie"]).contains("PHPSESSID=fresh-session")+ assertThat(success.data.headers["Accept-Encoding"]).isEqualTo("identity")+ }++ @Test+ fun authenticate_persists_effective_learned_mag_identity() = runTest {+ val provider = StalkerProvider(+ providerId = 7,+ api = FakeStalkerApiService(+ profile = StalkerProviderProfile(+ accountName = "Room",+ effectiveAuthMode = com.streamvault.domain.model.StalkerAuthMode.MAC_ONLY,+ portalProfile = com.streamvault.domain.model.StalkerPortalProfile.MODULE_GATED,+ portalFingerprint = com.streamvault.domain.model.StalkerPortalFingerprint.MODULE_GATED,+ magPreset = com.streamvault.domain.model.StalkerMagPreset.MINISTRA_MODERN,+ bootstrapRecipe = com.streamvault.domain.model.StalkerBootstrapRecipe.MODULE_GATED,+ fingerprintEvidence = StalkerFingerprintEvidence(+ endpointPreference = com.streamvault.domain.model.StalkerEndpointPreference.PORTAL,+ cookieMode = com.streamvault.domain.model.StalkerCookieMode.BOTH,+ playbackBackendHint = com.streamvault.domain.model.StalkerPlaybackBackendHint.TEMP_LINK_STRICT+ )+ )+ ),+ portalUrl = "https://portal.example.com/c/",+ macAddress = "00:1A:79:12:34:56",+ deviceProfile = "MAG250",+ timezone = "UTC",+ locale = "en"+ )++ val result = provider.authenticate()++ assertThat(result).isInstanceOf(Result.Success::class.java)+ val success = result as Result.Success+ assertThat(success.data.stalkerMagPreset).isEqualTo(com.streamvault.domain.model.StalkerMagPreset.MINISTRA_MODERN)+ assertThat(success.data.stalkerDeviceProfile).isEqualTo("MAG322")+ assertThat(success.data.stalkerDeviceId).isNotEmpty()+ assertThat(success.data.stalkerSignature).isNotEmpty()+ }+private class FakeStalkerApiService(- private val profile: StalkerProviderProfile+ private val profile: StalkerProviderProfile,+ private val liveStreams: List<StalkerItemRecord> = emptyList(),+ private val createLinkUrl: String = "http://cdn.example.com/stream.ts",+ private val currentCookieHeader: String = "") : StalkerApiService {override suspend fun authenticate(profile: StalkerDeviceProfile): Result<Pair<StalkerSession, StalkerProviderProfile>> =Result.success(@@ -79,7 +323,7 @@ class StalkerProviderTest {session: StalkerSession,profile: StalkerDeviceProfile,categoryId: String?- ) = Result.success(emptyList<StalkerItemRecord>())+ ) = Result.success(liveStreams)override suspend fun streamLiveStreams(session: StalkerSession,@@ -173,7 +417,11 @@ class StalkerProviderTest {profile: StalkerDeviceProfile,kind: StalkerStreamKind,cmd: String,- seriesNumber: Int?- ) = Result.success("http://cdn.example.com/stream.ts")+ seriesNumber: Int?,+ archiveStartSeconds: Long?,+ archiveEndSeconds: Long?+ ) = Result.success(createLinkUrl)++ override fun currentCookieHeader(session: StalkerSession): String = currentCookieHeader}}diff --git a/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt b/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.ktindex 21179d4c..4607c8a1 100644--- a/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt+++ b/data/src/test/java/com/streamvault/data/remote/xtream/XtreamStreamUrlResolverTest.kt@@ -582,7 +582,9 @@ class XtreamStreamUrlResolverTest {profile: StalkerDeviceProfile,kind: StalkerStreamKind,cmd: String,- seriesNumber: Int?+ seriesNumber: Int?,+ archiveStartSeconds: Long?,+ archiveEndSeconds: Long?): Result<String> {createLinkCalls += 1lastCreateLinkSeriesNumber = seriesNumberdiff --git a/data/src/test/resources/stalker/fixtures/README.md b/data/src/test/resources/stalker/fixtures/README.mdnew file mode 100644index 00000000..d347a0a4--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/README.md@@ -0,0 +1,29 @@+# Stalker Replay Fixtures++These fixtures model sanitized portal families for the Stalker replay harness.++To onboard a new real-world portal:+1. Capture the ordered `handshake`, auth, profile, modules, catalog, and `create_link` responses.+2. Remove real domains, tokens, credentials, MAC addresses, and account identifiers.+3. Keep the request action order intact so recipe fallback behavior stays deterministic.+4. Save the fixture as `data/src/test/resources/stalker/fixtures/<family>.json`.+5. Add the file to `StalkerPortalReplayHarnessTest` and assert the expected auth mode, portal profile, fingerprint, MAG preset, and bootstrap recipe.+6. For catch-up/archive portals, include the expected `streamKind`, `catchUpStartSeconds`, `catchUpEndSeconds`, and any archive fingerprint evidence fields.++The goal is to encode new portal families as data plus recipe rules, not ad hoc code paths.++Capture/export helper:++```powershell+.\tools\stalker-har-to-fixture.ps1 `+ -InputPath .\capture.har `+ -OutputPath .\data\src\test\resources\stalker\fixtures\new_portal.json `+ -FixtureName new_portal `+ -PortalUrl https://real.portal.example/c `+ -MacAddress 00:1A:79:AA:BB:CC `+ -AuthMode AUTO `+ -Username alice `+ -Password secret+```++The script extracts Stalker `action=` requests from a HAR capture, redacts domains/tokens/MACs/credentials deterministically, and emits a replay-fixture skeleton in the same format used by `StalkerPortalReplayHarnessTest`.diff --git a/data/src/test/resources/stalker/fixtures/archive_create_link.json b/data/src/test/resources/stalker/fixtures/archive_create_link.jsonnew file mode 100644index 00000000..12c6d56f--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/archive_create_link.json@@ -0,0 +1,29 @@+{+ "name": "archive_create_link",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:AC:10:01",+ "authMode": "AUTO"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-archive-create\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"501\",\"name\":\"Archive Create\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"401\",\"name\":\"Archive Link\",\"tv_genre_id\":\"10\",\"cmd\":\"ffmpeg http://localhost/ch/401_\",\"use_http_tmp_link\":\"1\",\"archive\":\"1\",\"allow_local_timeshift\":\"1\"}]}}" },+ { "action": "create_link", "body": "{\"js\":{\"cmd\":\"ffmpeg http://portal.example.com/play/live.php?stream=401&play_token=arch401\"}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "bootstrapEvidence": ["handshake", "get_profile"],+ "requestOrder": ["handshake", "get_profile", "get_all_channels", "create_link"],+ "cookieMode": "CREATE_LINK",+ "archiveEndpointPreference": "SERVER_LOAD",+ "archiveViaCreateLink": true,+ "archiveRequiresStrictCookies": false,+ "streamKind": "ARCHIVE",+ "playbackMode": "PLAY_LIVE_PORTAL",+ "resolvedPlaybackUrl": "http://portal.example.com/play/live.php?stream=401&play_token=arch401&utc=1715853600&lutc=1715857200",+ "catchUpStartSeconds": 1715853600,+ "catchUpEndSeconds": 1715857200+ }+}diff --git a/data/src/test/resources/stalker/fixtures/archive_direct_cookie.json b/data/src/test/resources/stalker/fixtures/archive_direct_cookie.jsonnew file mode 100644index 00000000..bc280c29--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/archive_direct_cookie.json@@ -0,0 +1,27 @@+{+ "name": "archive_direct_cookie",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:AC:10:02",+ "authMode": "AUTO",+ "cookieMode": "PLAYBACK",+ "playbackBackendHint": "DIRECT"+ },+ "responses": [+ { "action": "handshake", "headers": { "Set-Cookie": "PHPSESSID=archive-direct; Path=/; HttpOnly" }, "body": "{\"js\":{\"token\":\"token-archive-direct\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"502\",\"name\":\"Archive Direct\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"402\",\"name\":\"Archive Direct\",\"tv_genre_id\":\"11\",\"cmd\":\"ffmpeg http://portal.example.com/archive/402.ts\",\"archive\":\"1\",\"allow_local_timeshift\":\"1\"}]}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "bootstrapEvidence": ["handshake", "get_profile"],+ "requestOrder": ["handshake", "get_profile", "get_all_channels"],+ "cookieMode": "CREATE_LINK",+ "playbackBackendHint": "DIRECT",+ "archiveEndpointPreference": "SERVER_LOAD",+ "archiveViaDirectUrl": false,+ "archiveRequiresStrictCookies": false,+ "playbackMode": "DIRECT_URL"+ }+}diff --git a/data/src/test/resources/stalker/fixtures/archive_recipe_fallback.json b/data/src/test/resources/stalker/fixtures/archive_recipe_fallback.jsonnew file mode 100644index 00000000..1d259530--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/archive_recipe_fallback.json@@ -0,0 +1,41 @@+{+ "name": "archive_recipe_fallback",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:AC:10:04",+ "authMode": "AUTO",+ "username": "archive",+ "password": "secret"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-archive-fallback-a\"}}" },+ { "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },+ { "action": "get_profile", "body": "" },+ { "action": "get_profile", "body": "" },+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-archive-fallback-b\"}}" },+ { "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"504\",\"name\":\"Archive Fallback\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"504\",\"name\":\"Archive Fallback\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_localization", "body": "{\"js\":{\"lang\":\"en\",\"timezone\":\"UTC\"}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"404\",\"name\":\"Archive Fallback\",\"tv_genre_id\":\"13\",\"cmd\":\"ffmpeg http://localhost/ch/404_\",\"archive\":\"1\",\"allow_local_timeshift\":\"1\"}]}}" },+ { "action": "create_link", "body": "{\"js\":{\"cmd\":\"ffmpeg http://portal.example.com/play/live.php?stream=404&play_token=arch404\"}}" }+ ],+ "expected": {+ "authMode": "MAC_PLUS_CREDENTIALS",+ "portalProfile": "MAG_STRICT",+ "portalFingerprint": "STRICT_MAG",+ "magPreset": "MAG254_STRICT",+ "bootstrapRecipe": "PORTAL_PREFERRED",+ "recipeEvidence": ["recipe:PORTAL_PREFERRED", "preset:MAG254_STRICT", "fallback_recipe", "rediscovery_attempted"],+ "bootstrapEvidence": ["handshake", "do_auth", "get_profile", "get_account_info", "get_localization"],+ "requestOrder": ["handshake", "do_auth", "get_profile", "get_profile", "handshake", "do_auth", "get_profile", "get_main_info", "get_localization", "get_all_channels", "create_link"],+ "endpointPreference": "SERVER_LOAD",+ "archiveRequiresBootstrapPrep": true,+ "archiveViaCreateLink": true,+ "streamKind": "ARCHIVE",+ "playbackMode": "PLAY_LIVE_PORTAL",+ "resolvedPlaybackUrl": "http://portal.example.com/play/live.php?stream=404&play_token=arch404&utc=1715853600&lutc=1715857200",+ "catchUpStartSeconds": 1715853600,+ "catchUpEndSeconds": 1715857200+ }+}diff --git a/data/src/test/resources/stalker/fixtures/archive_strict_mag.json b/data/src/test/resources/stalker/fixtures/archive_strict_mag.jsonnew file mode 100644index 00000000..75d1f478--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/archive_strict_mag.json@@ -0,0 +1,35 @@+{+ "name": "archive_strict_mag",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:AC:10:03",+ "authMode": "AUTO"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-archive-strict-a\"}}" },+ { "action": "get_profile", "body": "" },+ { "action": "get_profile", "body": "" },+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-archive-strict-b\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"503\",\"name\":\"Archive Strict\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"503\",\"name\":\"Archive Strict\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"403\",\"name\":\"Archive Strict\",\"tv_genre_id\":\"12\",\"cmd\":\"ffmpeg http://localhost/ch/403_\",\"archive\":\"1\",\"allow_local_timeshift\":\"1\",\"nginx_secure_link\":\"1\"}]}}" },+ { "action": "create_link", "body": "{\"js\":{\"cmd\":\"ffmpeg http://portal.example.com/play/live.php?stream=403&play_token=arch403\"}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "portalFingerprint": "BASIC_MAC",+ "magPreset": "MAG250_LEGACY",+ "bootstrapRecipe": "LEGACY_MAG",+ "recipeEvidence": ["recipe:LEGACY_MAG", "preset:MAG250_LEGACY", "fallback_recipe", "rediscovery_attempted"],+ "bootstrapEvidence": ["handshake", "get_profile", "get_account_info"],+ "requestOrder": ["handshake", "get_profile", "get_profile", "handshake", "get_profile", "get_main_info", "get_all_channels", "create_link"],+ "archiveViaCreateLink": true,+ "archiveRequiresStrictCookies": false,+ "streamKind": "ARCHIVE",+ "playbackMode": "PLAY_LIVE_PORTAL",+ "resolvedPlaybackUrl": "http://portal.example.com/play/live.php?stream=403&play_token=arch403&utc=1715853600&lutc=1715857200",+ "catchUpStartSeconds": 1715853600,+ "catchUpEndSeconds": 1715857200+ }+}diff --git a/data/src/test/resources/stalker/fixtures/auth_plus_mag.json b/data/src/test/resources/stalker/fixtures/auth_plus_mag.jsonindex 5f25fa69..a896d71b 100644--- a/data/src/test/resources/stalker/fixtures/auth_plus_mag.json+++ b/data/src/test/resources/stalker/fixtures/auth_plus_mag.json@@ -8,16 +8,19 @@"password": "secret"},"responses": [- { "action": "handshake", "body": "{\"js\":{\"token\":\"token-789\"}}" },- { "action": "get_profile", "body": "{\"js\":{\"name\":\"Partial\",\"status\":\"0\",\"auth_access\":false}}" },{ "action": "handshake", "body": "{\"js\":{\"token\":\"token-789\"}}" },{ "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },- { "action": "get_profile", "body": "{\"js\":{\"id\":\"42\",\"name\":\"Full Access\",\"status\":\"1\",\"auth_access\":true}}" }+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"42\",\"name\":\"Full Access\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"42\",\"name\":\"Full Access\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_localization", "body": "{\"js\":{\"lang\":\"en\",\"timezone\":\"UTC\"}}" }],"expected": {"authMode": "MAC_PLUS_CREDENTIALS","portalProfile": "AUTH_PLUS_MAG",- "bootstrapEvidence": ["handshake", "do_auth", "get_profile"],- "requestOrder": ["handshake", "get_profile", "handshake", "do_auth", "get_profile"]+ "portalFingerprint": "AUTH_STRICT_MAG",+ "magPreset": "MAG254_STRICT",+ "bootstrapRecipe": "AUTH_STRICT_MAG",+ "bootstrapEvidence": ["handshake", "do_auth", "get_profile", "get_account_info", "get_localization"],+ "requestOrder": ["handshake", "do_auth", "get_profile", "get_main_info", "get_localization"]}}diff --git a/data/src/test/resources/stalker/fixtures/auth_required.json b/data/src/test/resources/stalker/fixtures/auth_required.jsonindex 8bf42164..3e4ea80a 100644--- a/data/src/test/resources/stalker/fixtures/auth_required.json+++ b/data/src/test/resources/stalker/fixtures/auth_required.json@@ -10,12 +10,16 @@"responses": [{ "action": "handshake", "body": "{\"js\":{\"token\":\"token-456\"}}" },{ "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },- { "action": "get_profile", "body": "{\"js\":{\"id\":\"88\",\"name\":\"Bedroom\",\"status\":\"1\",\"auth_access\":true}}" }+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"88\",\"name\":\"Bedroom\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"88\",\"name\":\"Bedroom\",\"status\":\"1\",\"auth_access\":true}}" }],"expected": {"authMode": "CREDENTIALS_ONLY","portalProfile": "AUTH_REQUIRED",- "bootstrapEvidence": ["handshake", "do_auth", "get_profile"],- "requestOrder": ["handshake", "do_auth", "get_profile"]+ "portalFingerprint": "AUTH_ONLY",+ "magPreset": "GENERIC_SAFE",+ "bootstrapRecipe": "AUTH_ONLY",+ "bootstrapEvidence": ["handshake", "do_auth", "get_profile", "get_account_info"],+ "requestOrder": ["handshake", "do_auth", "get_profile", "get_main_info"]}}diff --git a/data/src/test/resources/stalker/fixtures/direct_cookie_playback.json b/data/src/test/resources/stalker/fixtures/direct_cookie_playback.jsonnew file mode 100644index 00000000..0eb3eafa--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/direct_cookie_playback.json@@ -0,0 +1,24 @@+{+ "name": "direct_cookie_playback",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:CA:FE:11",+ "authMode": "AUTO",+ "cookieMode": "PLAYBACK",+ "playbackBackendHint": "DIRECT"+ },+ "responses": [+ { "action": "handshake", "headers": { "Set-Cookie": "PHPSESSID=direct-cookie; Path=/; HttpOnly" }, "body": "{\"js\":{\"token\":\"token-direct\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"31\",\"name\":\"Cookie Direct\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"300\",\"name\":\"Direct\",\"tv_genre_id\":\"10\",\"cmd\":\"http://edge.example.com/live/direct.m3u8\"}]}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "endpointPreference": "SERVER_LOAD",+ "playbackBackendHint": "DIRECT",+ "bootstrapEvidence": ["handshake", "get_profile"],+ "requestOrder": ["handshake", "get_profile", "get_all_channels"],+ "playbackMode": "DIRECT_URL"+ }+}diff --git a/data/src/test/resources/stalker/fixtures/nginx_temp_link.json b/data/src/test/resources/stalker/fixtures/nginx_temp_link.jsonindex 4b231d11..5af94089 100644--- a/data/src/test/resources/stalker/fixtures/nginx_temp_link.json+++ b/data/src/test/resources/stalker/fixtures/nginx_temp_link.json@@ -16,7 +16,7 @@"portalProfile": "MAG_BASIC","bootstrapEvidence": ["handshake", "get_profile"],"requestOrder": ["handshake", "get_profile", "get_all_channels", "create_link"],- "playbackMode": "TEMP_LINK_NGINX",+ "playbackMode": "PLAY_LIVE_PORTAL","resolvedPlaybackUrl": "http://edge.example.com/play/live.php?stream=100&play_token=abc"}}diff --git a/data/src/test/resources/stalker/fixtures/play_live_cookie.json b/data/src/test/resources/stalker/fixtures/play_live_cookie.jsonnew file mode 100644index 00000000..48c82ac6--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/play_live_cookie.json@@ -0,0 +1,23 @@+{+ "name": "play_live_cookie",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:CA:FE:12",+ "authMode": "AUTO"+ },+ "responses": [+ { "action": "handshake", "headers": { "Set-Cookie": "PHPSESSID=play-live; Path=/; HttpOnly" }, "body": "{\"js\":{\"token\":\"token-live-cookie\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"41\",\"name\":\"Play Live\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"301\",\"name\":\"Portal Live\",\"tv_genre_id\":\"10\",\"cmd\":\"ffmpeg http://localhost/ch/301_\",\"use_http_tmp_link\":\"1\",\"nginx_secure_link\":\"1\"}]}}" },+ { "action": "create_link", "body": "{\"js\":{\"cmd\":\"ffmpeg http://portal.example.com/play/live.php?stream=301&play_token=live301\"}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "cookieMode": "CREATE_LINK",+ "bootstrapEvidence": ["handshake", "get_profile"],+ "requestOrder": ["handshake", "get_profile", "get_all_channels", "create_link"],+ "playbackMode": "PLAY_LIVE_PORTAL",+ "resolvedPlaybackUrl": "http://portal.example.com/play/live.php?stream=301&play_token=live301"+ }+}diff --git a/data/src/test/resources/stalker/fixtures/play_movie_vod.json b/data/src/test/resources/stalker/fixtures/play_movie_vod.jsonnew file mode 100644index 00000000..2d5460f5--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/play_movie_vod.json@@ -0,0 +1,25 @@+{+ "name": "play_movie_vod",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:CA:FE:13",+ "authMode": "AUTO"+ },+ "responses": [+ { "action": "handshake", "headers": { "Set-Cookie": "PHPSESSID=play-movie; Path=/; HttpOnly" }, "body": "{\"js\":{\"token\":\"token-movie-cookie\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"51\",\"name\":\"Movie Portal\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_ordered_list", "body": "{\"js\":{\"total_items\":\"1\",\"max_page_items\":\"50\",\"data\":[{\"id\":\"401\",\"name\":\"Movie Portal\",\"category_id\":\"20\",\"cmd\":\"ffmpeg http://localhost/movie/401_\"}]}}" },+ { "action": "create_link", "body": "{\"js\":{\"cmd\":\"ffmpeg http://portal.example.com/play/movie.php?stream=401.mkv&play_token=movie401\"}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "cookieMode": "CREATE_LINK",+ "bootstrapEvidence": ["handshake", "get_profile"],+ "requestOrder": ["handshake", "get_profile", "get_ordered_list", "create_link"],+ "catalogType": "VOD",+ "streamKind": "MOVIE",+ "playbackMode": "PLAY_MOVIE_PORTAL",+ "resolvedPlaybackUrl": "http://portal.example.com/play/movie.php?stream=401.mkv&play_token=movie401"+ }+}diff --git a/data/src/test/resources/stalker/fixtures/portal_endpoint_preferred.json b/data/src/test/resources/stalker/fixtures/portal_endpoint_preferred.jsonnew file mode 100644index 00000000..2143544e--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/portal_endpoint_preferred.json@@ -0,0 +1,20 @@+{+ "name": "portal_endpoint_preferred",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:CA:FE:14",+ "authMode": "AUTO",+ "endpointPreference": "PORTAL"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-portal-pref\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"61\",\"name\":\"Portal First\",\"status\":\"1\",\"auth_access\":true}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "endpointPreference": "PORTAL",+ "bootstrapEvidence": ["handshake", "get_profile"],+ "requestOrder": ["handshake", "get_profile"]+ }+}diff --git a/data/src/test/resources/stalker/fixtures/recipe_fallback.json b/data/src/test/resources/stalker/fixtures/recipe_fallback.jsonnew file mode 100644index 00000000..8c7791f7--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/recipe_fallback.json@@ -0,0 +1,35 @@+{+ "name": "recipe_fallback",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:FA:CE:03",+ "authMode": "AUTO",+ "username": "fallback",+ "password": "secret"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-fallback-a\"}}" },+ { "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },+ { "action": "get_profile", "body": "" },+ { "action": "get_profile", "body": "" },+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-fallback-b\"}}" },+ { "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"99\",\"name\":\"Recovered\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"99\",\"name\":\"Recovered\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_localization", "body": "{\"js\":{\"lang\":\"en\",\"timezone\":\"UTC\"}}" },+ { "action": "get_modules", "body": "{\"js\":{\"modules\":{\"itv\":1,\"vod\":1}}}" }+ ],+ "expected": {+ "authMode": "MAC_PLUS_CREDENTIALS",+ "portalProfile": "MAG_STRICT",+ "portalFingerprint": "STRICT_MAG",+ "magPreset": "MAG254_STRICT",+ "bootstrapRecipe": "PORTAL_PREFERRED",+ "recipeEvidence": ["recipe:PORTAL_PREFERRED", "preset:MAG254_STRICT", "fallback_recipe", "rediscovery_attempted"],+ "endpointPreference": "SERVER_LOAD",+ "cookieMode": "CREATE_LINK",+ "playbackBackendHint": "TEMP_LINK_STRICT",+ "bootstrapEvidence": ["handshake", "do_auth", "get_profile", "get_account_info", "get_localization"],+ "requestOrder": ["handshake", "do_auth", "get_profile", "get_profile", "handshake", "do_auth", "get_profile", "get_main_info", "get_localization"]+ }+}diff --git a/data/src/test/resources/stalker/fixtures/strict_mag_legacy.json b/data/src/test/resources/stalker/fixtures/strict_mag_legacy.jsonnew file mode 100644index 00000000..dd3e7865--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/strict_mag_legacy.json@@ -0,0 +1,26 @@+{+ "name": "strict_mag_legacy",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:FA:CE:01",+ "authMode": "AUTO"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-legacy-a\"}}" },+ { "action": "get_profile", "body": "" },+ { "action": "get_profile", "body": "" },+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-legacy-b\"}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"88\",\"name\":\"Legacy\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"88\",\"name\":\"Legacy\",\"status\":\"1\",\"auth_access\":true}}" }+ ],+ "expected": {+ "authMode": "MAC_ONLY",+ "portalProfile": "MAG_BASIC",+ "portalFingerprint": "BASIC_MAC",+ "magPreset": "MAG250_LEGACY",+ "bootstrapRecipe": "LEGACY_MAG",+ "recipeEvidence": ["recipe:LEGACY_MAG", "preset:MAG250_LEGACY", "fallback_recipe", "rediscovery_attempted"],+ "bootstrapEvidence": ["handshake", "get_profile", "get_account_info"],+ "requestOrder": ["handshake", "get_profile", "get_profile", "handshake", "get_profile", "get_main_info"]+ }+}diff --git a/data/src/test/resources/stalker/fixtures/temp_link_strict.json b/data/src/test/resources/stalker/fixtures/temp_link_strict.jsonnew file mode 100644index 00000000..2feb3223--- /dev/null+++ b/data/src/test/resources/stalker/fixtures/temp_link_strict.json@@ -0,0 +1,31 @@+{+ "name": "temp_link_strict",+ "device": {+ "portalUrl": "https://portal.example.com/c",+ "macAddress": "00:1A:79:FA:CE:02",+ "authMode": "MAC_PLUS_CREDENTIALS",+ "username": "demo",+ "password": "secret"+ },+ "responses": [+ { "action": "handshake", "body": "{\"js\":{\"token\":\"token-strict\"}}" },+ { "action": "do_auth", "method": "POST", "body": "{\"js\":{\"status\":1}}" },+ { "action": "get_profile", "body": "{\"js\":{\"id\":\"77\",\"name\":\"Strict Temp\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_main_info", "body": "{\"js\":{\"id\":\"77\",\"name\":\"Strict Temp\",\"status\":\"1\",\"auth_access\":true}}" },+ { "action": "get_localization", "body": "{\"js\":{\"lang\":\"en\",\"timezone\":\"UTC\"}}" },+ { "action": "get_all_channels", "body": "{\"js\":{\"data\":[{\"id\":\"200\",\"name\":\"Cinema\",\"tv_genre_id\":\"11\",\"cmd\":\"ffmpeg http://localhost/ch/200_\",\"use_http_tmp_link\":\"1\",\"nginx_secure_link\":\"1\"}]}}" },+ { "action": "create_link", "body": "{\"js\":{\"cmd\":\"ffmpeg http://strict.example.com/play/live.php?stream=200&play_token=xyz\"}}" }+ ],+ "expected": {+ "authMode": "MAC_PLUS_CREDENTIALS",+ "portalProfile": "AUTH_PLUS_MAG",+ "portalFingerprint": "AUTH_STRICT_MAG",+ "magPreset": "MAG254_STRICT",+ "bootstrapRecipe": "AUTH_STRICT_MAG",+ "recipeEvidence": ["recipe:AUTH_STRICT_MAG", "preset:MAG254_STRICT"],+ "bootstrapEvidence": ["handshake", "do_auth", "get_profile", "get_account_info", "get_localization"],+ "requestOrder": ["handshake", "do_auth", "get_profile", "get_main_info", "get_localization", "get_all_channels", "create_link"],+ "playbackMode": "PLAY_LIVE_PORTAL",+ "resolvedPlaybackUrl": "http://strict.example.com/play/live.php?stream=200&play_token=xyz"+ }+}diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 5f5f48ce..72bcd82f 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -6,33 +6,27 @@ All notable product changes are recorded in this document.### Added-- Added queued background Stalker catalog indexing for Movies and Series so new providers become usable with Live TV first while VOD and series continue loading in the background.-- Added a dedicated Stalker index worker with resumable category/page progress, retry budgeting, cooldowns, and recovery-aware job scheduling.-- Added persisted Stalker hydration cursor metadata for attempted page, successful page, retry timing, retry budget, failure count, and page fingerprints, with database migration coverage.-- Added Stalker summary-index persistence using thin movie and series rows in the existing local catalog tables and shared index/job infrastructure.-- Added Stalker support for the shared sync progress bus used by the welcome/loading flow.-- Added optional Stalker MAG identity override fields for `serial number`, `device_id`, `device_id2`, and `signature`, with setup-screen editing and provider persistence.+- Added live-first Stalker sync with background Movies/Series indexing so providers become usable sooner while VOD keeps loading in the background.+- Added advanced Stalker auth and MAG compatibility support, including MAC-only, credential-based, mixed auth, and stricter MAG identity presets.+- Added variant-aware Stalker playback handling for direct URLs, multi-command entries, temp-link portals, and `play/live.php` / `play/movie.php` backends.+- Added persisted Stalker portal learning for auth mode, portal profile, MAG preset, bootstrap recipe, endpoint preference, cookie mode, and last working playback path.+- Added a Stalker replay-fixture matrix and HAR-to-fixture capture script for onboarding new portal families faster.### Changed-- Changed Stalker provider onboarding and full sync to use a live-first, index-first model: Live TV is committed first, then Movies, Series, and EPG are queued or continued in the background instead of relying on browse-time lazy population.-- Changed Stalker manual Settings sync for Movies and Series to queue background indexing instead of running blocking full category loads.-- Changed Stalker repository browse fallback so on-demand category hydration is now a fallback path only when background indexing is unavailable or exhausted.-- Changed Stalker stale-provider recovery on app open to requeue only stale or retryable catalog sections and avoid duplicate work while a section is already actively running.-- Changed Stalker portal EPG replacement to operate channel-by-channel instead of deleting the entire provider guide up front.+- Changed Stalker bootstrap from a single happy-path flow into recipe-driven session setup with cookies, localization/modules support, portal fingerprinting, and fallback rediscovery.+- Changed Stalker catalog parsing to preserve backend flags, command variants, archive/timeshift hints, and other portal capabilities for later playback decisions.+- Changed Stalker playback resolution to choose backend-specific strategies instead of forcing everything through one `cmd -> create_link` path.+- Changed Stalker sync recovery and manual sync to reuse indexed state, resume partial work, and avoid duplicate or blocking reloads.+- Changed Stalker EPG refresh to update more safely channel-by-channel instead of wiping healthy guide data up front.### Fixed-- Fixed Stalker VOD and series catalogs loading mainly on demand by moving the primary path to queued background indexing with incremental visibility as pages land.-- Fixed Stalker category/page retries being too shallow by persisting retry state, cooldowns, and page cursors across worker passes and restarts.-- Fixed Stalker index rebuild safety around partial failures and page anomalies so stale pruning is suppressed when completion is uncertain and previously indexed content remains visible.-- Fixed Stalker auth-expiry handling during background indexing by invalidating portal authentication and retrying once on likely session failures.-- Fixed Stalker wildcard-category handling to avoid indexing duplicate full-catalog shells when normal categories are also available.-- Fixed Stalker portal EPG partial-failure behavior so a broken guide refresh no longer wipes healthy guide data for untouched channels.-- Fixed Stalker manual section sync progress leaving stale progress-bus state behind after completion.-- Fixed Stalker Settings provider cards hiding the Series diagnostic tile even when series indexing is available.-- Fixed Settings EPG counts showing `0` for providers with loaded guide data by observing the real per-provider program count instead of relying on stale sync metadata.-- Fixed Stalker MAG emulation being locked to generated identity values by allowing explicit STBEmu-style device identity fields while preserving generated fallbacks when those overrides are left blank.+- Fixed many Stalker portals that could browse catalogs but failed at playback because they needed different auth, bootstrap, cookie, endpoint, or temp-link behavior.+- Fixed incorrect handling of ambiguous Stalker account states such as `status=0`, which could previously be treated too aggressively as expired.+- Fixed Stalker temp-link and backend-family failures being reported too generically by surfacing clearer empty-link and session-rejection diagnostics, including HTTP `204` cases.+- Fixed Stalker indexing and hydration reliability on large or unstable portals with persisted cursors, retries, cooldowns, and safer stale-data pruning.+- Fixed Stalker setup and sync edge cases around wildcard categories, stale progress, provider diagnostics, explicit MAG identity overrides, and per-provider EPG counts.## [1.0.11] - 2026-05-13diff --git a/docs/deep-research-report.md b/docs/deep-research-report.mdnew file mode 100644index 00000000..515c4c8a--- /dev/null+++ b/docs/deep-research-report.md@@ -0,0 +1,90 @@+# Practical MAG Compatibility Gaps in Stalker Playback++## Core diagnosis++The pattern you described, where handshake, profile loading, live/VOD/series catalogues, and even `create_link` appear to work but playback fails, is exactly what you would expect from a **partial MAG emulation that passes the control plane but diverges on the media plane**. In Ministra/Stalker, catalogue browsing rides mostly on `load.php` JSON calls, while playback crosses into a more sensitive path that can involve device-bound identity checks, stream-source selection, temporary-link generation, NGINX/secure-link validation, Flussonic/Wowza integration, and per-channel filtering. Official Infomir documentation and the archived MAG client code make that split very clear. citeturn22view0turn35view0turn34view0turn37view0turn45view0++That is why “catalogue works, playback fails” is not a contradiction. A portal can happily authorise the STB-facing API enough to return genres, channel lists, VOD metadata, and even a provisional `create_link` response, while still rejecting the **actual stream retrieval** because the client fingerprint, the pre-play bootstrap state, or the final URL fetch path does not match what the portal expects from a real MAG-style device. citeturn26view0turn27search10turn32view0turn35view0turn37view0++## What dedicated MAG-style clients actually emulate++A working MAG-style client does more than send a MAC address. In real traces and in archived client code, Stalker control-plane requests typically include the portal referer, MAC-language-timezone cookies, a bearer token after handshake, and the legacy MAG header pair of a QtEmbedded `User-Agent` plus `X-User-Agent` carrying model/link-type information. A representative pattern looks like this:++```text+Referer: http://<portal>/stalker_portal/c/+Cookie: mac=<MAC>; stb_lang=<lang>; timezone=<tz>+Authorization: Bearer <token>+X-User-Agent: Model: MAG250; Link: WiFi+User-Agent: Mozilla/5.0 (QtEmbedded; U; Linux; C) ... MAG200 stbapp ver: 2 rev: 250 ...+```++The same older-style header set also appears in third-party implementations that intentionally mimic MAG behaviour. citeturn47view0turn13search1turn41search0++The bigger compatibility gap is the **full `get_profile` fingerprint**, not just the headers. Archived MAG JS code shows `get_profile` sending `stb_type`, `sn`, `ver`, `image_version`, `hw_version`, `device_id`, `device_id2`, `signature`, `client_type=STB`, `video_out`, `metrics`, `hw_version_2`, `timestamp`, `api_signature`, and `prehash`. The same code also shows that newer model families such as `MAG322`, `MAG324`, and `AuraHD4` do **not** use exactly the same `GetUID` pattern as the older MAG250-style path. By contrast, older third-party clients often stop at the legacy subset: `stb_type=MAG250`, `image_version=216`, `hw_version=1.7-BD-00`, blank `device_id*`, blank `signature`, and no newer telemetry fields. That difference is large enough for a hardened portal to notice even if catalogue calls still succeed. citeturn22view0turn21view2turn21view3turn21view4turn42view0++The bootstrap sequence also matters. In the archived MAG client, handshake is followed by `get_profile`, then `get_localization`, then `user_init`, and later TV-related initialisation pulls favourites, modules, and first-channel player state. Real traffic traces also show `watchdog/get_events` beginning during TV initialisation, not as an optional afterthought. In other words, a dedicated client arrives at playback with more state already established than many custom players reproduce. citeturn22view0turn44view0turn44view2turn47view0++A subtle but practical point is that MAG identity is expected to be **internally coherent**. Official docs show model-based access controls via `allowed_stb_types` and `strict_stb_type_check`, while MAG client code and traces show a consistent tuple of model, serial number, version string, image version, hardware version, player version, and device identifiers. If your app claims one model in `X-User-Agent`, another in `stb_type`, and a third-era firmware string in `ver`, you may still browse, but you are very easy to classify as non-native. citeturn37view0turn22view0turn47view0++## The playback boundary where partial emulation fails++The Stalker playback path is more variable than the browsing path. Open-source Stalker server code shows `createLink()` branching between direct URLs, load-balanced stream choices, and temporary HTTP links, and it explicitly uses request variables such as `disable_ad` and `force_ch_link_check` while assembling the final `cmd`. Older third-party clients also show `create_link` defaults such as `cmd`, `forced_storage`, and `disable_ad`, and some of them add a referer only for `ITV_CREATE_LINK`. That means a client can be “mostly correct” for catalogue calls yet still differ at the one request that actually decides how playback is resolved. citeturn5view0turn33search0turn42view0++Infomir’s official temporary-link documentation shows why this matters. In the recommended HTTP temporary-link setup, the player requests a `/ch/<token>` URL on the NGINX front end; NGINX rewrites that to `chk_tmp_tv_link.php`, and then only an internal `/get/<host>/<path>` location is allowed to proxy the real upstream stream. The documented config forwards `X-Real-IP $remote_addr`, and the platform documentation separately insists on enabling Apache `remoteip` support so the backend sees the subscriber’s real source IP correctly. In the secure-link variant, the signed URL can even include `$remote_addr` in the MD5 calculation, which makes the final media fetch explicitly **IP-bound**. citeturn35view0turn34view0turn37view0++That IP binding is one of the most important practical gaps. If your custom player resolves `create_link` on one path but fetches media via a different egress route, a localhost proxy, a server-side relay, a different interface, or a player engine that does not preserve the same outward identity as the control-plane client, the resulting `/ch/...` or secure-link URL can be valid for a MAG client and invalid for your app. That failure mode is especially consistent with “MyTVOnline+ works, custom app fails”, because the dedicated client is more likely to request the portal-provided playback URL directly from the device’s own network stack. citeturn34view0turn35view0turn37view0++The same principle shows up in backend-specific integrations. Infomir’s Flussonic helper checks the temporary token and, when valid, returns headers such as `X-AuthDuration`, `X-Unique`, `X-Max-Sessions`, and `X-UserId` for the media server path. That tells you that some playback authorisation is no longer happening in `load.php` at all; it happens in the media-server integration layer after `create_link`. So a control-plane clone can still fail if it does not enter the exact media path the portal expects. citeturn45view0++Infomir also added support for several channel links with a **user-agent filter**, and the platform documents the ability to restrict streaming-link access by device model. That is a direct explanation for why browsing can work while playback fails: the channel is visible in the catalogue, but the actual stream source chosen at play time may be filtered by model, user-agent, or configured access rule. citeturn36search1turn23search6turn37view0++## Why browsing and even `create_link` can succeed before playback still fails++Handshake and catalogue browsing are a relatively low bar because they mainly prove that the portal is willing to talk to the client as an STB-like consumer. Playback is a higher bar because it is where the portal finally has to bind a subscriber, a device identity, a stream URL, a source IP, and a media backend together. Official platform configuration includes anti-cloning options such as `enable_device_id_validation`, model gating via `allowed_stb_types`, stricter model checks, OAuth-to-STB binding options, and stronger fake-device protections added over time. Infomir staff explicitly described `enable_device_id_validation` as a check on STB-information integrity and anti-cloning protection. citeturn27search1turn27search10turn36search1turn37view0++That anti-cloning behaviour is not theoretical. In an official support thread, a maintainer responded to a `device_id2 mismatch` authorisation failure by advising the operator to clear `device_id` and `device_id2` for that MAC, and when the operator disabled device-ID validation to make the box work, the maintainer warned against it because it would let emulators use the portal. In parallel, experienced users of STBEmu and Formuler/MyTVOnline-class devices report that some subscriptions only work after copying **MAC + serial + device_id + device_id2 + signature + hw_version** into the emulator. That is exactly the sort of gap that lets browsing work on a custom client but stops playback at the moment the portal needs stronger confidence that the caller is the same device it believes it provisioned. citeturn26view0turn32view0++`create_link` itself can also be misleading. Server-side code can accept the request, enter the channel-link logic, and still end up with no valid `result.cmd` because the selected source is filtered out, temporary-link generation fails, a link-check path is required, or the eventual command resolves to a backend URL your player cannot actually consume. From the outside, that often looks like “`create_link` works but playback is empty”, when the real failure is either late in command assembly or one step later on the stream fetch. citeturn5view0turn33search0turn35view0++A final category is modern Ministra hardening around non-native devices. Community discussions around Ministra 5.4.x show operators reporting that Formuler boxes and STBEmu clients stopped being accepted after upgrades even with `disable_third_party_devices = false`, and Infomir’s current commercial positioning also ties provider support to Ministra Player Apps subscriptions rather than the older licence-key model. That does not prove every playback failure is a licensing problem, but it does show that newer Ministra deployments can enforce a stricter distinction between “looks close enough to a MAG” and “is a supported client”. citeturn30view0turn29search0turn31search1++## Ranked list of the most likely causes++| Likelihood | Cause | Why it fits the exact symptom |+| --- | --- | --- |+| Very high | **Persisted device binding mismatch**: `sn`, `device_id`, `device_id2`, `signature`, `hw_version`, or model/firmware tuple do not match what the portal stored for that MAC | Infomir exposes anti-cloning controls such as `enable_device_id_validation`, maintainers diagnose `device_id2 mismatch` explicitly, and working STBEmu/MyTVOnline-class setups often need the full identifier tuple copied from a real client. This is the cleanest explanation for “catalogue works, playback fails, real client works”. citeturn26view0turn27search10turn32view0 |+| Very high | **IP-bound temporary-link or secure-link failure** on the final media request | Official NGINX temp-link and secure-link docs bind playback to the NGINX front end, to `X-Real-IP`, and in secure-link mode even to `$remote_addr` in the URL signature. If your player, proxy, or playback engine changes the network path between `create_link` and stream fetch, the final URL is rejected even though the control plane succeeded. citeturn35view0turn34view0turn37view0 |+| High | **Incomplete MAG bootstrap before first play** | Archived MAG code does more than handshake + profile: it runs localisation, user initialisation, TV/player setup, favourites/modules loading, and watchdog traffic before normal TV use. Custom clients that jump straight from catalogue to `create_link` can miss state that some portals expect around playback. citeturn22view0turn44view0turn44view2turn47view0 |+| High | **`create_link` request mismatch**: missing or wrong `force_ch_link_check`, `disable_ad`, `forced_storage`, referer, or control-plane headers | Server code consumes `disable_ad` and `force_ch_link_check`, and third-party clients show explicit `forced_storage`, `disable_ad`, and referer handling for `create_link`. This is a common place where a custom player looks “close enough” elsewhere but differs at playback resolution time. citeturn5view0turn33search0turn42view0turn47view0 |+| Medium | **Per-channel source filtering by user-agent or device model** | Infomir added several-source channels with user-agent filters and documents model-based restriction of streaming-link access. That can leave the catalogue visible but deny or divert the actual stream source when play is pressed. citeturn36search1turn23search6turn37view0 |+| Medium | **Newer MAG fingerprint fields missing**: `client_type`, `metrics`, `hw_version_2`, `timestamp`, `api_signature`, `prehash` | Archived MAG JS sends a much richer fingerprint than many older open-source emulators. A portal that has learned to distinguish native and non-native clients can use those gaps as a hardening signal even if it still tolerates browsing. citeturn22view0turn42view0 |+| Lower but real | **Third-party-device support or certification hardening in newer Ministra** | Community reports from 5.4.x show non-native clients being rejected despite the old `disable_third_party_devices` toggle. This is less likely when your app already reaches the catalogue, but it still belongs on the list for mixed portal fleets and upgraded deployments. citeturn30view0turn29search0turn31search1 |++## Concrete diff checklist and the implementation changes most likely to improve compatibility++The fastest way to debug this class of problem is to diff your app against a known-good MAG-style client at **three layers at once**: control-plane requests, `create_link`, and the final media fetch. Compare at least the following items:++| Layer | What to compare exactly | Why it matters |+| --- | --- | --- |+| Portal entry | Referer path (`/c/` vs `/c/index.html`), `User-Agent`, `X-User-Agent`, `Cookie: mac/stb_lang/timezone`, bearer token use | Real traces and emulators reproduce a very specific header envelope, and some portals key off it. citeturn47view0turn13search1turn41search0 |+| Handshake | Presence of saved token reuse and `prehash` | MAG JS includes both; token handling changed across middleware versions. citeturn22view0turn27search2 |+| `get_profile` | Full field set and coherence of `stb_type`, `sn`, `ver`, `image_version`, `hw_version`, `device_id*`, `signature`, `client_type`, telemetry fields | This is the single biggest fingerprint surface. citeturn22view0turn21view2turn42view0 |+| Bootstrap | Whether you do `get_localization`, `user_init`-equivalent setup, module loading, favourites/TV initialisation, watchdog traffic before first play | A working client reaches playback with more state already established. citeturn44view0turn44view2turn47view0 |+| `create_link` | Query parameters, header set, referer, `disable_ad`, `force_ch_link_check`, `forced_storage`, and exact submitted `cmd` | Small request differences here can alter source selection or return an unusable command. citeturn5view0turn33search0turn42view0 |+| Returned command | Whether you preserve the command **byte-for-byte**, including solution prefixes such as `ffmpeg `, query strings, and token parameters | Server code can prepend player-solution tokens and signed URLs that must not be normalised away. citeturn5view0 |+| Temp-link playback | Whether you request the front-end `/ch/<token>` URL as-is, through the same outward IP, instead of rewriting it to backend hosts or localhost paths | Official temp-link flow depends on front-end NGINX rewrite and internal redirecting. citeturn35view0turn34view0turn37view0 |+| Network identity | Whether the actual media fetch originates from the same client IP the portal/backend expects | Secure-link and real-IP forwarding make this decisive. citeturn34view0turn35view0turn37view0 |+| Stream-source filtering | Whether the working client receives a different source because of user-agent/model filters on the channel | The catalogue can be identical while the selected stream link differs. citeturn36search1turn23search6 |+| Server logs | Apache auth failures, `device_id2 mismatch`, NGINX `403/410`, Flussonic auth headers, channel-monitoring/link-check errors | The decisive clue is often on the media side, not in `load.php`. citeturn26view0turn34view0turn45view0 |++If your goal is to maximise compatibility rather than keep the implementation minimal, the changes most likely to move the needle are these.++First, treat each portal as needing a **persisted device profile**, not just a MAC and a generic MAG persona. Persist `sn`, `stb_type`, `ver`, `image_version`, `hw_version`, `device_id`, `device_id2`, and `signature` per portal profile, and allow importing them from a known-good client trace when necessary. The sources above strongly suggest that this beats trying to re-derive “mostly MAG-like” values from the MAC alone. citeturn22view0turn26view0turn32view0++Secondly, support a **modern `get_profile` mode** alongside your legacy MAG250 mode. For portals that are sensitive, send the richer MAG fields that archived MAG JS sends, including `client_type`, `video_out`, `metrics`, `hw_version_2`, `timestamp`, `api_signature`, and `prehash`, and keep the whole model/firmware story internally consistent. Many custom Stalker implementations fail because they still emulate only the older subset that lax portals accept. citeturn22view0turn42view0++Thirdly, replicate the **pre-play bootstrap** of a real client before the first playback attempt. At minimum, do handshake, `get_profile`, `get_localization`, module initialisation, TV/player initialisation, and watchdog start in the same broad order as the working client, and carry any playback-affecting flags such as `force_ch_link_check`, `disable_ad`, and `forced_storage` into `create_link`. citeturn44view0turn44view2turn47view0turn5view0++Fourthly, make playback URL handling **opaque and lossless**. Do not strip prefixes like `ffmpeg `, do not re-encode signed query parameters, do not rewrite `/ch/<token>` to backend paths, and do not insert a local proxy unless you can guarantee the same outbound IP and header behaviour as direct device playback. This one change can eliminate a large class of temp-link and secure-link failures. citeturn35view0turn34view0turn37view0turn45view0++Finally, build a **wire-level diff mode** into your app. For one failing portal, capture a working MyTVOnline+/STBEmu session and your own session, then diff: request headers, cookies, query params, pre-play sequence timing, `create_link` body, returned `cmd`, final URL, redirect chain, and server response codes. With Stalker compatibility, the winning fixes are usually not architectural; they are small deltas in identity, sequencing, or final URL handling that only become obvious when you compare both traces side by side. citeturn47view0turn22view0turn35view0turn45view0\ No newline at end of filediff --git a/domain/src/main/java/com/streamvault/domain/model/Provider.kt b/domain/src/main/java/com/streamvault/domain/model/Provider.ktindex 1a6cfa00..3f838bde 100644--- a/domain/src/main/java/com/streamvault/domain/model/Provider.kt+++ b/domain/src/main/java/com/streamvault/domain/model/Provider.kt@@ -21,11 +21,20 @@ data class Provider(val stalkerSignature: String = "",val stalkerAuthMode: StalkerAuthMode = StalkerAuthMode.AUTO,val stalkerPortalProfile: StalkerPortalProfile = StalkerPortalProfile.MAG_BASIC,+ val stalkerPortalFingerprint: StalkerPortalFingerprint = StalkerPortalFingerprint.BASIC_MAC,+ val stalkerMagPreset: StalkerMagPreset = StalkerMagPreset.GENERIC_SAFE,+ val stalkerLastBootstrapRecipe: StalkerBootstrapRecipe = StalkerBootstrapRecipe.GENERIC_SAFE,+ val stalkerEndpointPreference: StalkerEndpointPreference = StalkerEndpointPreference.AUTO,+ val stalkerCookieMode: StalkerCookieMode = StalkerCookieMode.NONE,+ val stalkerPlaybackBackendHint: StalkerPlaybackBackendHint = StalkerPlaybackBackendHint.AUTO,val stalkerLastPlaybackMode: String? = null,val stalkerCredentialsRequired: Boolean = false,val stalkerMacRequired: Boolean = true,val stalkerUsesTemporaryLinks: Boolean = false,val stalkerModuleRestricted: Boolean = false,+ val stalkerStrictFingerprintRequired: Boolean = false,+ val stalkerRecipeFallbackUsed: Boolean = false,+ val stalkerRecipeRediscoveryAttempts: Int = 0,val isActive: Boolean = true,val maxConnections: Int = 1,val expirationDate: Long? = null,@@ -82,6 +91,55 @@ enum class StalkerPortalProfile {MODULE_GATED}+enum class StalkerPortalFingerprint {+ BASIC_MAC,+ STRICT_MAG,+ AUTH_ONLY,+ AUTH_STRICT_MAG,+ MODULE_GATED,+ TEMP_LINK_STRICT+}++enum class StalkerMagPreset {+ GENERIC_SAFE,+ MAG250_LEGACY,+ MAG254_STRICT,+ MINISTRA_MODERN+}++enum class StalkerBootstrapRecipe {+ GENERIC_SAFE,+ LEGACY_MAG,+ STRICT_MAG,+ PORTAL_PREFERRED,+ LOCALIZATION_STRICT,+ AUTH_ONLY,+ AUTH_STRICT_MAG,+ MODULE_GATED+}++enum class StalkerEndpointPreference {+ AUTO,+ SERVER_LOAD,+ PORTAL+}++enum class StalkerCookieMode {+ NONE,+ CREATE_LINK,+ PLAYBACK,+ BOTH+}++enum class StalkerPlaybackBackendHint {+ AUTO,+ DIRECT,+ PLAY_LIVE,+ PLAY_MOVIE,+ TEMP_LINK,+ TEMP_LINK_STRICT+}+enum class ProviderStatus {ACTIVE,PARTIAL,diff --git a/player/src/main/java/com/streamvault/player/PlayerEngine.kt b/player/src/main/java/com/streamvault/player/PlayerEngine.ktindex 0e28e069..8183af13 100644--- a/player/src/main/java/com/streamvault/player/PlayerEngine.kt+++ b/player/src/main/java/com/streamvault/player/PlayerEngine.kt@@ -231,6 +231,8 @@ sealed class PlayerError(val message: String) {PlaybackErrorCategory.NETWORK -> buildNetworkErrorMessage(chain)PlaybackErrorCategory.HTTP_AUTH -> buildHttpErrorMessage(chain, "Access denied")PlaybackErrorCategory.HTTP_SERVER -> buildHttpErrorMessage(chain, "Server error")+ PlaybackErrorCategory.EMPTY_RESPONSE ->+ "Provider returned an empty stream response (HTTP 204)."PlaybackErrorCategory.SSL -> "Secure connection failed (SSL/TLS error)."PlaybackErrorCategory.CLEAR_TEXT_BLOCKED ->"This stream requires a secure (HTTPS) connection."@@ -250,6 +252,7 @@ sealed class PlayerError(val message: String) {PlaybackErrorCategory.CLEAR_TEXT_BLOCKED,PlaybackErrorCategory.SSL -> NetworkError(msg)+ PlaybackErrorCategory.EMPTY_RESPONSE,PlaybackErrorCategory.SOURCE_MALFORMED,PlaybackErrorCategory.LIVE_WINDOW -> SourceError(msg)diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.ktindex d1b046d1..803ae6e4 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt@@ -1,18 +1,25 @@package com.streamvault.player.playbackimport android.content.Context+import android.util.Logimport androidx.media3.datasource.DefaultDataSourceimport androidx.media3.datasource.DataSourceimport androidx.media3.datasource.okhttp.OkHttpDataSourceimport com.streamvault.domain.model.StreamInfo+import java.net.URIimport java.util.concurrent.ConcurrentHashMapimport java.util.concurrent.TimeUnit+import okhttp3.Interceptorimport okhttp3.OkHttpClientclass PlayerDataSourceFactoryProvider(private val context: Context,private val baseClient: OkHttpClient) {+ private companion object {+ private const val TAG = "PlayerDataSource"+ }+private val clientsByProfile = ConcurrentHashMap<PlayerTimeoutProfile, OkHttpClient>()fun createFactory(@@ -22,8 +29,10 @@ class PlayerDataSourceFactoryProvider(): Pair<PlayerTimeoutProfile, DataSource.Factory> {val profile = PlayerTimeoutProfile.resolve(streamInfo, resolvedStreamType, preload)val headers = streamInfo.headers+ logRequestShape(streamInfo, headers, preload)val client = clientsByProfile.computeIfAbsent(profile) {baseClient.newBuilder()+ .addInterceptor(StalkerPlaybackRequestLoggingInterceptor).connectTimeout(profile.connectTimeoutMs, TimeUnit.MILLISECONDS).readTimeout(profile.readTimeoutMs, TimeUnit.MILLISECONDS).writeTimeout(profile.writeTimeoutMs, TimeUnit.MILLISECONDS)@@ -38,5 +47,70 @@ class PlayerDataSourceFactoryProvider(val factory = DefaultDataSource.Factory(context, upstreamFactory)return profile to factory}++ private fun logRequestShape(+ streamInfo: StreamInfo,+ headers: Map<String, String>,+ preload: Boolean+ ) {+ val hasStalkerHeaders = headers.containsKey("X-User-Agent") ||+ headers.containsKey("Authorization") ||+ headers["Cookie"]?.contains("mac=", ignoreCase = true) == true+ if (!hasStalkerHeaders) {+ return+ }+ val uri = runCatching { URI(streamInfo.url) }.getOrNull()+ Log.d(+ TAG,+ "Playback request headers preload=$preload host=${uri?.host.orEmpty()} path=${uri?.path.orEmpty()} " ++ "ua=${!streamInfo.userAgent.isNullOrBlank()} referer=${headers.containsKey("Referer")} " ++ "cookie=${headers.containsKey("Cookie")} auth=${headers.containsKey("Authorization")} " ++ "xua=${headers.containsKey("X-User-Agent")}"+ )+ }+}++private object StalkerPlaybackRequestLoggingInterceptor : Interceptor {+ private const val TAG = "PlayerDataSource"++ override fun intercept(chain: Interceptor.Chain): okhttp3.Response {+ val request = chain.request()+ if (!request.hasStalkerPlaybackShape()) {+ return chain.proceed(request)+ }+ Log.d(+ TAG,+ "Playback request actual method=${request.method} target=${PlaybackLogSanitizer.sanitizeUrl(request.url.toString())} " ++ "ua=${request.header("User-Agent") != null} referer=${request.header("Referer") != null} " ++ "cookie=${request.header("Cookie") != null} auth=${request.header("Authorization") != null} " ++ "xua=${request.header("X-User-Agent") != null} range=${request.header("Range") != null} " ++ "acceptEncoding=${request.header("Accept-Encoding")?.take(24).orEmpty()} cookieKeys=${request.cookieKeySummary()}"+ )+ val response = chain.proceed(request)+ Log.d(+ TAG,+ "Playback response actual target=${PlaybackLogSanitizer.sanitizeUrl(request.url.toString())} " ++ "code=${response.code} length=${response.header("Content-Length").orEmpty()} " ++ "type=${response.header("Content-Type").orEmpty()}"+ )+ return response+ }++ private fun okhttp3.Request.hasStalkerPlaybackShape(): Boolean {+ val path = url.encodedPath.lowercase()+ return header("X-User-Agent") != null ||+ header("Authorization") != null ||+ header("Cookie")?.contains("mac=", ignoreCase = true) == true ||+ path.endsWith("/play/live.php") ||+ path.endsWith("/play/movie.php")+ }++ private fun okhttp3.Request.cookieKeySummary(): String {+ val cookie = header("Cookie") ?: return ""+ return cookie.split(';')+ .mapNotNull { part -> part.substringBefore('=', missingDelimiterValue = "").trim().takeIf(String::isNotBlank) }+ .take(12)+ .joinToString("|")+ }}diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerErrorClassifier.kt b/player/src/main/java/com/streamvault/player/playback/PlayerErrorClassifier.ktindex 94d6a8ef..07881a80 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerErrorClassifier.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerErrorClassifier.kt@@ -16,6 +16,7 @@ enum class PlaybackErrorCategory {NETWORK,HTTP_AUTH,HTTP_SERVER,+ EMPTY_RESPONSE,FORMAT_UNSUPPORTED,DECODER,DRM,@@ -44,6 +45,7 @@ object PlayerErrorClassifier {playbackException?.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW ->PlaybackErrorCategory.LIVE_WINDOWhttpCode == 401 || httpCode == 403 || httpCode == 456 -> PlaybackErrorCategory.HTTP_AUTH+ httpCode == 204 -> PlaybackErrorCategory.EMPTY_RESPONSEhttpCode in setOf(408, 429, 500, 502, 503, 504) -> PlaybackErrorCategory.HTTP_SERVERchain.any { it is SSLHandshakeException || it is SSLException } ||chain.any { it.message?.contains("certificate", ignoreCase = true) == true } ->@@ -75,7 +77,7 @@ object PlayerErrorClassifier {}private fun parseHttpStatus(message: String?): Int? {- return Regex("""\b(401|403|408|429|456|500|502|503|504)\b""").find(message.orEmpty())+ return Regex("""\b(204|401|403|408|429|456|500|502|503|504)\b""").find(message.orEmpty())?.groupValues?.getOrNull(1)?.toIntOrNull()diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.kt b/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.ktindex 7d207c8c..056900af 100644--- a/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.kt+++ b/player/src/main/java/com/streamvault/player/playback/PlayerRetryPolicy.kt@@ -62,6 +62,7 @@ class PlayerRetryPolicy(PlaybackErrorCategory.LIVE_WINDOW -> "refresh-live-window"PlaybackErrorCategory.NETWORK -> "transient-network"PlaybackErrorCategory.HTTP_SERVER -> "server-retryable"+ PlaybackErrorCategory.EMPTY_RESPONSE -> "empty-http-response"else -> "retryable-source"}}@@ -114,6 +115,7 @@ class PlayerRetryPolicy(else -> 1}+ PlaybackErrorCategory.EMPTY_RESPONSE,PlaybackErrorCategory.SOURCE_MALFORMED -> if (playbackStarted) 0 else 1PlaybackErrorCategory.UNKNOWN -> if (playbackStarted) 0 else 1}diff --git a/player/src/test/java/com/streamvault/player/playback/PlayerErrorClassifierTest.kt b/player/src/test/java/com/streamvault/player/playback/PlayerErrorClassifierTest.ktindex e17c16f0..9ad3529b 100644--- a/player/src/test/java/com/streamvault/player/playback/PlayerErrorClassifierTest.kt+++ b/player/src/test/java/com/streamvault/player/playback/PlayerErrorClassifierTest.kt@@ -26,6 +26,12 @@ class PlayerErrorClassifierTest {.isEqualTo(PlaybackErrorCategory.HTTP_AUTH)}+ @Test+ fun `204 maps to empty response`() {+ assertThat(PlayerErrorClassifier.classify(IOException("HTTP 204")))+ .isEqualTo(PlaybackErrorCategory.EMPTY_RESPONSE)+ }+@Testfun `ssl exception maps to ssl`() {assertThat(PlayerErrorClassifier.classify(SSLHandshakeException("certificate verify failed")))diff --git a/tools/stalker-har-to-fixture.ps1 b/tools/stalker-har-to-fixture.ps1new file mode 100644index 00000000..82d9b764--- /dev/null+++ b/tools/stalker-har-to-fixture.ps1@@ -0,0 +1,140 @@+param(+ [Parameter(Mandatory = $true)]+ [string]$InputPath,+ [Parameter(Mandatory = $true)]+ [string]$OutputPath,+ [Parameter(Mandatory = $true)]+ [string]$FixtureName,+ [string]$PortalUrl = "https://portal.example.com/c",+ [string]$MacAddress = "00:1A:79:12:34:56",+ [string]$AuthMode = "AUTO",+ [string]$Username = "",+ [string]$Password = ""+)++Set-StrictMode -Version Latest+$ErrorActionPreference = "Stop"++function Normalize-String {+ param([string]$Value)+ if ([string]::IsNullOrWhiteSpace($Value)) { return "" }+ return $Value.Trim()+}++function Sanitize-Body {+ param(+ [string]$Body,+ [string]$PortalHost,+ [string]$MacAddress,+ [string]$Username,+ [string]$Password+ )++ $result = $Body+ if ([string]::IsNullOrWhiteSpace($result)) { return "" }++ $result = $result -replace [regex]::Escape($PortalHost), "portal.example.com"+ $result = $result -replace [regex]::Escape($MacAddress), "00:1A:79:12:34:56"++ if (-not [string]::IsNullOrWhiteSpace($Username)) {+ $result = $result -replace [regex]::Escape($Username), "user"+ }+ if (-not [string]::IsNullOrWhiteSpace($Password)) {+ $result = $result -replace [regex]::Escape($Password), "secret"+ }++ $result = [regex]::Replace($result, "(?<=(play_token|token|PHPSESSID|session)=)[A-Za-z0-9._\-]+", "sanitized")+ $result = [regex]::Replace($result, "(?<=""token"":\s*"")[^""]+", "token-sanitized")+ $result = [regex]::Replace($result, "(?<=""mac"":\s*"")[^""]+", "00:1A:79:12:34:56")+ $result = [regex]::Replace($result, "https?://[^/""']+", "https://portal.example.com")+ return $result+}++function Read-HarEntries {+ param([string]$Path)+ $raw = Get-Content -Raw -Path $Path+ $parsed = $raw | ConvertFrom-Json -Depth 100+ if ($null -eq $parsed.log -or $null -eq $parsed.log.entries) {+ throw "Input HAR does not contain log.entries"+ }+ return @($parsed.log.entries)+}++$entries = Read-HarEntries -Path $InputPath+$portalHost = ([Uri]$PortalUrl).Host++$responses = New-Object System.Collections.Generic.List[object]++foreach ($entry in $entries) {+ $requestUrl = Normalize-String $entry.request.url+ if ([string]::IsNullOrWhiteSpace($requestUrl)) { continue }++ try {+ $uri = [Uri]$requestUrl+ } catch {+ continue+ }++ $query = [System.Web.HttpUtility]::ParseQueryString($uri.Query)+ $action = Normalize-String $query["action"]+ if ([string]::IsNullOrWhiteSpace($action)) { continue }++ $method = Normalize-String $entry.request.method+ if ([string]::IsNullOrWhiteSpace($method)) { $method = "GET" }++ $body = ""+ if ($null -ne $entry.response.content -and $null -ne $entry.response.content.text) {+ $body = [string]$entry.response.content.text+ }++ $headers = @{}+ foreach ($header in @($entry.response.headers)) {+ $headerName = Normalize-String $header.name+ if ($headerName -eq "Set-Cookie") {+ $headers[$headerName] = "PHPSESSID=sanitized; Path=/; HttpOnly"+ }+ }++ $responseRecord = [ordered]@{+ action = $action+ method = $method.ToUpperInvariant()+ code = [int]$entry.response.status+ body = (Sanitize-Body -Body $body -PortalHost $portalHost -MacAddress $MacAddress -Username $Username -Password $Password)+ }++ if ($headers.Count -gt 0) {+ $responseRecord["headers"] = $headers+ }++ $responses.Add([pscustomobject]$responseRecord)+}++$fixture = [ordered]@{+ name = $FixtureName+ device = [ordered]@{+ portalUrl = $PortalUrl+ macAddress = $MacAddress+ authMode = $AuthMode+ }+ responses = $responses+ expected = [ordered]@{+ authMode = $AuthMode+ portalProfile = "MAG_BASIC"+ bootstrapEvidence = @()+ requestOrder = @($responses | ForEach-Object { $_.action })+ }+}++if (-not [string]::IsNullOrWhiteSpace($Username)) {+ $fixture.device["username"] = "user"+}+if (-not [string]::IsNullOrWhiteSpace($Password)) {+ $fixture.device["password"] = "secret"+}++$outputDirectory = Split-Path -Parent $OutputPath+if (-not [string]::IsNullOrWhiteSpace($outputDirectory) -and -not (Test-Path $outputDirectory)) {+ New-Item -ItemType Directory -Path $outputDirectory | Out-Null+}++$fixture | ConvertTo-Json -Depth 20 | Set-Content -Path $OutputPath -Encoding UTF8