Skip to content

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

feat: support recording HLS while watching

David Nashash042c81171871
diff --git a/app/src/main/java/com/streamvault/app/di/NetworkModule.kt b/app/src/main/java/com/streamvault/app/di/NetworkModule.kt
index 5062f9d1..2acb86ea 100644
--- a/app/src/main/java/com/streamvault/app/di/NetworkModule.kt
+++ b/app/src/main/java/com/streamvault/app/di/NetworkModule.kt
@@ -7,6 +7,8 @@ import com.streamvault.app.BuildConfig
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.streamvault.data.remote.NetworkTimeoutConfig
+import com.streamvault.data.manager.recording.RecordingHttpClientFactory
+import com.streamvault.data.manager.recording.RecordingNetworkProfile
import com.streamvault.data.remote.http.DefaultUserAgentInterceptor
import com.streamvault.data.remote.http.buildAppRequestProfile
import com.streamvault.data.remote.http.buildAppUserAgent
@@ -21,8 +23,11 @@ import com.streamvault.player.AudioCompatibilityMemoryStore
import com.streamvault.player.Media3PlayerEngine
import com.streamvault.player.PlayerEngine
import com.streamvault.player.PlaybackSupportSnapshotStore
+import com.streamvault.player.playback.applyPlaybackTransportPolicy
+import com.streamvault.player.playback.applyUnsafeTlsBypass
import com.streamvault.player.di.AuxiliaryPlayerEngine
import com.streamvault.player.di.MainPlayerEngine
+import com.streamvault.domain.util.LivePlaybackByteTap
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -31,6 +36,8 @@ import dagger.hilt.components.SingletonComponent
import kotlinx.serialization.json.Json
import okhttp3.Cache
import okhttp3.OkHttpClient
+import java.net.InetSocketAddress
+import java.net.Proxy
import okhttp3.logging.HttpLoggingInterceptor
import java.io.File
import java.util.concurrent.TimeUnit.SECONDS
@@ -92,6 +99,25 @@ object NetworkModule {
.build()
}
+ @Provides
+ @Singleton
+ fun provideRecordingHttpClientFactory(okHttpClient: OkHttpClient): RecordingHttpClientFactory =
+ RecordingHttpClientFactory { profile: RecordingNetworkProfile ->
+ val transportPolicy = profile.playbackTransportPolicy
+ val builder = when {
+ transportPolicy != null ->
+ okHttpClient.newBuilder().applyPlaybackTransportPolicy(transportPolicy)
+ profile.allowInvalidSsl -> okHttpClient.newBuilder().applyUnsafeTlsBypass()
+ else -> okHttpClient.newBuilder()
+ }
+ val proxyHost = profile.proxyHost.trim()
+ val proxyPort = profile.proxyPort
+ if (proxyHost.isNotEmpty() && proxyPort != null) {
+ builder.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress(proxyHost, proxyPort)))
+ }
+ builder.build()
+ }
+
@Provides
@Singleton
fun provideXtreamApiService(okHttpClient: OkHttpClient, xtreamJson: Json): XtreamApiService =
@@ -131,13 +157,15 @@ object NetworkModule {
okHttpClient: OkHttpClient,
playbackCompatibilityRepository: com.streamvault.domain.repository.PlaybackCompatibilityRepository,
audioCompatibilityMemoryStore: AudioCompatibilityMemoryStore,
- playbackSupportSnapshotStore: PlaybackSupportSnapshotStore
+ playbackSupportSnapshotStore: PlaybackSupportSnapshotStore,
+ livePlaybackByteTap: LivePlaybackByteTap
): PlayerEngine = Media3PlayerEngine(
context,
okHttpClient,
playbackCompatibilityRepository,
audioCompatibilityMemoryStore,
- playbackSupportSnapshotStore
+ playbackSupportSnapshotStore,
+ livePlaybackByteTap
)
/**
diff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/83.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/83.json
new file mode 100644
index 00000000..26fed0d2
--- /dev/null
+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/83.json
@@ -0,0 +1,7222 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 83,
+ "identityHash": "b6b0aab2b99bd49babb3c0f2af69340d",
+ "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, `is_active` 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": "isActive",
+ "columnName": "is_active",
+ "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_type",
+ "unique": false,
+ "columnNames": [
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_providers_type` ON `${TABLE_NAME}` (`type`)"
+ },
+ {
+ "name": "index_providers_is_active",
+ "unique": false,
+ "columnNames": [
+ "is_active"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_providers_is_active` ON `${TABLE_NAME}` (`is_active`)"
+ }
+ ]
+ },
+ {
+ "tableName": "provider_configs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `type` TEXT NOT NULL, `schema_version` INTEGER NOT NULL, `configuration_generation` INTEGER NOT NULL, `identity_key` TEXT NOT NULL, `encrypted_config_json` TEXT NOT NULL, `guide_source_policy` TEXT NOT NULL, `channel_logo_source_policy` TEXT NOT NULL, `updated_at` 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": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "schemaVersion",
+ "columnName": "schema_version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configurationGeneration",
+ "columnName": "configuration_generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "identityKey",
+ "columnName": "identity_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "encryptedConfigJson",
+ "columnName": "encrypted_config_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "guideSourcePolicy",
+ "columnName": "guide_source_policy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelLogoSourcePolicy",
+ "columnName": "channel_logo_source_policy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_configs_provider_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_configs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_provider_configs_identity_key",
+ "unique": true,
+ "columnNames": [
+ "identity_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_configs_identity_key` ON `${TABLE_NAME}` (`identity_key`)"
+ },
+ {
+ "name": "index_provider_configs_type",
+ "unique": false,
+ "columnNames": [
+ "type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_configs_type` ON `${TABLE_NAME}` (`type`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "provider_account_runtime",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `catalog_layout` TEXT NOT NULL, `catalog_layout_detection_version` INTEGER NOT NULL, `observed_at` 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": "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": "catalogLayout",
+ "columnName": "catalog_layout",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "catalogLayoutDetectionVersion",
+ "columnName": "catalog_layout_detection_version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "observedAt",
+ "columnName": "observed_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_account_runtime_provider_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_account_runtime_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "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, `playback_metadata_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": "playbackMetadataJson",
+ "columnName": "playback_metadata_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, `playback_metadata_json` TEXT, 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
+ },
+ {
+ "fieldPath": "playbackMetadataJson",
+ "columnName": "playback_metadata_json",
+ "affinity": "TEXT"
+ }
+ ],
+ "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, `catalog_origin` TEXT NOT NULL, `episode_playback_template_url` TEXT, 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
+ },
+ {
+ "fieldPath": "catalogOrigin",
+ "columnName": "catalog_origin",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "episodePlaybackTemplateUrl",
+ "columnName": "episode_playback_template_url",
+ "affinity": "TEXT"
+ }
+ ],
+ "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_series_id_episode_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "series_id",
+ "episode_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_series_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `series_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, `provider_order` INTEGER NOT NULL DEFAULT 0, `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": "providerOrder",
+ "columnName": "provider_order",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "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, `playback_metadata_json` TEXT, `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": "playbackMetadataJson",
+ "columnName": "playback_metadata_json",
+ "affinity": "TEXT"
+ },
+ {
+ "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, `playback_metadata_json` TEXT, `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": "playbackMetadataJson",
+ "columnName": "playback_metadata_json",
+ "affinity": "TEXT"
+ },
+ {
+ "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, `provider_order` INTEGER NOT NULL DEFAULT 0, `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": "providerOrder",
+ "columnName": "provider_order",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "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, `advertised_total_items` INTEGER, `advertised_total_pages` INTEGER, `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": "advertisedTotalItems",
+ "columnName": "advertised_total_items",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "advertisedTotalPages",
+ "columnName": "advertised_total_pages",
+ "affinity": "INTEGER"
+ },
+ {
+ "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, `advertised_total_items` INTEGER, `advertised_total_pages` INTEGER, `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": "advertisedTotalItems",
+ "columnName": "advertised_total_items",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "advertisedTotalPages",
+ "columnName": "advertised_total_pages",
+ "affinity": "INTEGER"
+ },
+ {
+ "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": "vod_category_hydration",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `last_loaded_page` INTEGER NOT NULL, `last_attempted_page` INTEGER NOT NULL, `last_successful_page` INTEGER NOT NULL, `total_pages` INTEGER NOT NULL, `advertised_total_items` INTEGER, `advertised_total_pages` INTEGER, `page_size` INTEGER NOT NULL, `item_count` INTEGER NOT NULL, `is_complete` INTEGER NOT NULL, `has_movies` INTEGER NOT NULL, `has_series` INTEGER NOT NULL, `last_hydrated_at` INTEGER NOT NULL, `last_status` TEXT NOT NULL, `last_error` TEXT, `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": "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": "advertisedTotalItems",
+ "columnName": "advertised_total_items",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "advertisedTotalPages",
+ "columnName": "advertised_total_pages",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "pageSize",
+ "columnName": "page_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "itemCount",
+ "columnName": "item_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isComplete",
+ "columnName": "is_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "hasMovies",
+ "columnName": "has_movies",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "hasSeries",
+ "columnName": "has_series",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastHydratedAt",
+ "columnName": "last_hydrated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastStatus",
+ "columnName": "last_status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "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_vod_category_hydration_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "vod_catalog_entries",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `raw_item_id` TEXT NOT NULL, `item_type` TEXT NOT NULL, `target_id` INTEGER NOT NULL, `raw_page` INTEGER NOT NULL, `raw_index` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `category_id`, `raw_item_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": "rawItemId",
+ "columnName": "raw_item_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "itemType",
+ "columnName": "item_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetId",
+ "columnName": "target_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rawPage",
+ "columnName": "raw_page",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rawIndex",
+ "columnName": "raw_index",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "raw_item_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_vod_catalog_entries_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_catalog_entries_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_vod_catalog_entries_provider_id_category_id_raw_page_raw_index",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "category_id",
+ "raw_page",
+ "raw_index"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_catalog_entries_provider_id_category_id_raw_page_raw_index` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `raw_page`, `raw_index`)"
+ },
+ {
+ "name": "index_vod_catalog_entries_provider_id_item_type_target_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "item_type",
+ "target_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_vod_catalog_entries_provider_id_item_type_target_id` ON `${TABLE_NAME}` (`provider_id`, `item_type`, `target_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_sources",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `etag` TEXT, `last_modified_header` TEXT, `timezone_policy` TEXT NOT NULL, `timezone_id` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "url",
+ "columnName": "url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastRefreshAt",
+ "columnName": "last_refresh_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSuccessAt",
+ "columnName": "last_success_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "etag",
+ "columnName": "etag",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastModifiedHeader",
+ "columnName": "last_modified_header",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "timezonePolicy",
+ "columnName": "timezone_policy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timezoneId",
+ "columnName": "timezone_id",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_epg_sources_url",
+ "unique": true,
+ "columnNames": [
+ "url"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_sources_url` ON `${TABLE_NAME}` (`url`)"
+ }
+ ]
+ },
+ {
+ "tableName": "provider_epg_sources",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `epg_source_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_epg_sources_provider_id_epg_source_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_epg_sources_provider_id_epg_source_id` ON `${TABLE_NAME}` (`provider_id`, `epg_source_id`)"
+ },
+ {
+ "name": "index_provider_epg_sources_epg_source_id",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_epg_sources_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "epg_sources",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "epg_source_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `display_name` TEXT NOT NULL, `normalized_name` TEXT NOT NULL, `icon_url` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xmltvChannelId",
+ "columnName": "xmltv_channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "displayName",
+ "columnName": "display_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "normalizedName",
+ "columnName": "normalized_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconUrl",
+ "columnName": "icon_url",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_epg_channels_epg_source_id_xmltv_channel_id",
+ "unique": true,
+ "columnNames": [
+ "epg_source_id",
+ "xmltv_channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id_xmltv_channel_id` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`)"
+ },
+ {
+ "name": "index_epg_channels_epg_source_id",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"
+ },
+ {
+ "name": "index_epg_channels_normalized_name",
+ "unique": false,
+ "columnNames": [
+ "normalized_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_channels_normalized_name` ON `${TABLE_NAME}` (`normalized_name`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "epg_sources",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "epg_source_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "epg_programmes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `epg_source_id` INTEGER NOT NULL, `xmltv_channel_id` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `title` TEXT NOT NULL, `subtitle` TEXT, `description` TEXT NOT NULL, `category` TEXT, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `episode_info` TEXT, FOREIGN KEY(`epg_source_id`) REFERENCES `epg_sources`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "xmltvChannelId",
+ "columnName": "xmltv_channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "startTime",
+ "columnName": "start_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "endTime",
+ "columnName": "end_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "subtitle",
+ "columnName": "subtitle",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "description",
+ "columnName": "description",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lang",
+ "columnName": "lang",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rating",
+ "columnName": "rating",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "episodeInfo",
+ "columnName": "episode_info",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id",
+ "xmltv_channel_id",
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`)"
+ },
+ {
+ "name": "index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time",
+ "unique": true,
+ "columnNames": [
+ "epg_source_id",
+ "xmltv_channel_id",
+ "start_time",
+ "end_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id_xmltv_channel_id_start_time_end_time` ON `${TABLE_NAME}` (`epg_source_id`, `xmltv_channel_id`, `start_time`, `end_time`)"
+ },
+ {
+ "name": "index_epg_programmes_epg_source_id",
+ "unique": false,
+ "columnNames": [
+ "epg_source_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_epg_source_id` ON `${TABLE_NAME}` (`epg_source_id`)"
+ },
+ {
+ "name": "index_epg_programmes_start_time",
+ "unique": false,
+ "columnNames": [
+ "start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_epg_programmes_start_time` ON `${TABLE_NAME}` (`start_time`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "epg_sources",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "epg_source_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "channel_epg_mappings",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_channel_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `source_type` TEXT NOT NULL, `epg_source_id` INTEGER, `xmltv_channel_id` TEXT, `match_type` TEXT, `confidence` REAL NOT NULL, `matched_at` INTEGER NOT NULL, `failed_attempts` INTEGER NOT NULL, `source` TEXT, `is_manual_override` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerChannelId",
+ "columnName": "provider_channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "epgSourceId",
+ "columnName": "epg_source_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "xmltvChannelId",
+ "columnName": "xmltv_channel_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "matchType",
+ "columnName": "match_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "confidence",
+ "columnName": "confidence",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "matchedAt",
+ "columnName": "matched_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failedAttempts",
+ "columnName": "failed_attempts",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "isManualOverride",
+ "columnName": "is_manual_override",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_channel_epg_mappings_provider_id_provider_channel_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "provider_channel_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id_provider_channel_id` ON `${TABLE_NAME}` (`provider_id`, `provider_channel_id`)"
+ },
+ {
+ "name": "index_channel_epg_mappings_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_epg_mappings_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "combined_m3u_profiles",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "combined_m3u_profile_members",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `profile_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, FOREIGN KEY(`profile_id`) REFERENCES `combined_m3u_profiles`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileId",
+ "columnName": "profile_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_combined_m3u_profile_members_profile_id",
+ "unique": false,
+ "columnNames": [
+ "profile_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id` ON `${TABLE_NAME}` (`profile_id`)"
+ },
+ {
+ "name": "index_combined_m3u_profile_members_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_combined_m3u_profile_members_profile_id_provider_id",
+ "unique": true,
+ "columnNames": [
+ "profile_id",
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_combined_m3u_profile_members_profile_id_provider_id` ON `${TABLE_NAME}` (`profile_id`, `provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "combined_m3u_profiles",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "profile_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "recording_schedules",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `requested_start_ms` INTEGER NOT NULL, `requested_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `enabled` INTEGER NOT NULL, `is_manual` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelName",
+ "columnName": "channel_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programTitle",
+ "columnName": "program_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "requestedStartMs",
+ "columnName": "requested_start_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "requestedEndMs",
+ "columnName": "requested_end_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurrence",
+ "columnName": "recurrence",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurringRuleId",
+ "columnName": "recurring_rule_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "enabled",
+ "columnName": "enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isManual",
+ "columnName": "is_manual",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_recording_schedules_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_recording_schedules_enabled_requested_start_ms",
+ "unique": false,
+ "columnNames": [
+ "enabled",
+ "requested_start_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_enabled_requested_start_ms` ON `${TABLE_NAME}` (`enabled`, `requested_start_ms`)"
+ },
+ {
+ "name": "index_recording_schedules_recurring_rule_id",
+ "unique": false,
+ "columnNames": [
+ "recurring_rule_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_schedules_recurring_rule_id` ON `${TABLE_NAME}` (`recurring_rule_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "recording_runs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `schedule_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` INTEGER NOT NULL, `channel_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `program_title` TEXT, `scheduled_start_ms` INTEGER NOT NULL, `scheduled_end_ms` INTEGER NOT NULL, `recurrence` TEXT NOT NULL, `recurring_rule_id` TEXT, `status` TEXT NOT NULL, `source_type` TEXT NOT NULL, `resolved_url` TEXT, `headers_json` TEXT NOT NULL, `user_agent` TEXT, `network_profile_json` TEXT NOT NULL DEFAULT '{}', `expiration_time` INTEGER, `provider_label` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `output_credentials_encrypted` TEXT, `bytes_written` INTEGER NOT NULL, `average_throughput_bps` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `last_progress_at_ms` INTEGER, `failure_category` TEXT NOT NULL, `failure_reason` TEXT, `terminal_at_ms` INTEGER, `started_at_ms` INTEGER, `ended_at_ms` INTEGER, `schedule_enabled` INTEGER NOT NULL, `priority` INTEGER NOT NULL, `alarm_start_at_ms` INTEGER, `alarm_stop_at_ms` INTEGER, `exact_alarm_armed` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`schedule_id`) REFERENCES `recording_schedules`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "scheduleId",
+ "columnName": "schedule_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelName",
+ "columnName": "channel_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programTitle",
+ "columnName": "program_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "scheduledStartMs",
+ "columnName": "scheduled_start_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "scheduledEndMs",
+ "columnName": "scheduled_end_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurrence",
+ "columnName": "recurrence",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "recurringRuleId",
+ "columnName": "recurring_rule_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "resolvedUrl",
+ "columnName": "resolved_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "headersJson",
+ "columnName": "headers_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "userAgent",
+ "columnName": "user_agent",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "networkProfileJson",
+ "columnName": "network_profile_json",
+ "affinity": "TEXT",
+ "notNull": true,
+ "defaultValue": "'{}'"
+ },
+ {
+ "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": "outputCredentialsEncrypted",
+ "columnName": "output_credentials_encrypted",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bytesWritten",
+ "columnName": "bytes_written",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "averageThroughputBytesPerSecond",
+ "columnName": "average_throughput_bps",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryCount",
+ "columnName": "retry_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastProgressAtMs",
+ "columnName": "last_progress_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "failureCategory",
+ "columnName": "failure_category",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failureReason",
+ "columnName": "failure_reason",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "terminalAtMs",
+ "columnName": "terminal_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "startedAtMs",
+ "columnName": "started_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "endedAtMs",
+ "columnName": "ended_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "scheduleEnabled",
+ "columnName": "schedule_enabled",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "alarmStartAtMs",
+ "columnName": "alarm_start_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "alarmStopAtMs",
+ "columnName": "alarm_stop_at_ms",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "exactAlarmArmed",
+ "columnName": "exact_alarm_armed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_recording_runs_schedule_id",
+ "unique": false,
+ "columnNames": [
+ "schedule_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_schedule_id` ON `${TABLE_NAME}` (`schedule_id`)"
+ },
+ {
+ "name": "index_recording_runs_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_recording_runs_status_scheduled_start_ms",
+ "unique": false,
+ "columnNames": [
+ "status",
+ "scheduled_start_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_status_scheduled_start_ms` ON `${TABLE_NAME}` (`status`, `scheduled_start_ms`)"
+ },
+ {
+ "name": "index_recording_runs_alarm_start_at_ms",
+ "unique": false,
+ "columnNames": [
+ "alarm_start_at_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_start_at_ms` ON `${TABLE_NAME}` (`alarm_start_at_ms`)"
+ },
+ {
+ "name": "index_recording_runs_alarm_stop_at_ms",
+ "unique": false,
+ "columnNames": [
+ "alarm_stop_at_ms"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_recording_runs_alarm_stop_at_ms` ON `${TABLE_NAME}` (`alarm_stop_at_ms`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "recording_schedules",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "schedule_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "program_reminders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `channel_name` TEXT NOT NULL, `program_title` TEXT NOT NULL, `program_start_time` INTEGER NOT NULL, `remind_at` INTEGER NOT NULL, `lead_time_minutes` INTEGER NOT NULL, `is_dismissed` INTEGER NOT NULL, `notified_at` INTEGER, `exact_alarm_armed` INTEGER NOT NULL, `delivery_state` TEXT NOT NULL, `delivery_attempt_token` TEXT, `delivery_attempted_at` INTEGER, `delivery_attempt_count` INTEGER NOT NULL, `delivery_failure_reason` TEXT, `created_at` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelId",
+ "columnName": "channel_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelName",
+ "columnName": "channel_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programTitle",
+ "columnName": "program_title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "programStartTime",
+ "columnName": "program_start_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "remindAt",
+ "columnName": "remind_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "leadTimeMinutes",
+ "columnName": "lead_time_minutes",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isDismissed",
+ "columnName": "is_dismissed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "notifiedAt",
+ "columnName": "notified_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "exactAlarmArmed",
+ "columnName": "exact_alarm_armed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deliveryState",
+ "columnName": "delivery_state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deliveryAttemptToken",
+ "columnName": "delivery_attempt_token",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "deliveryAttemptedAt",
+ "columnName": "delivery_attempted_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "deliveryAttemptCount",
+ "columnName": "delivery_attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "deliveryFailureReason",
+ "columnName": "delivery_failure_reason",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_program_reminders_provider_id_remind_at",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "remind_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_remind_at` ON `${TABLE_NAME}` (`provider_id`, `remind_at`)"
+ },
+ {
+ "name": "index_program_reminders_is_dismissed_notified_at_remind_at",
+ "unique": false,
+ "columnNames": [
+ "is_dismissed",
+ "notified_at",
+ "remind_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_is_dismissed_notified_at_remind_at` ON `${TABLE_NAME}` (`is_dismissed`, `notified_at`, `remind_at`)"
+ },
+ {
+ "name": "index_program_reminders_provider_id_channel_id_program_start_time",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "program_start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_start_time`)"
+ },
+ {
+ "name": "index_program_reminders_provider_id_channel_id_program_title_program_start_time",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "channel_id",
+ "program_title",
+ "program_start_time"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_program_reminders_provider_id_channel_id_program_title_program_start_time` ON `${TABLE_NAME}` (`provider_id`, `channel_id`, `program_title`, `program_start_time`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "recording_storage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tree_uri` TEXT, `smb_url` TEXT, `smb_credentials_encrypted` 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": "smbUrl",
+ "columnName": "smb_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "smbCredentialsEncrypted",
+ "columnName": "smb_credentials_encrypted",
+ "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, `sealed_session_id` INTEGER, `sealed_row_count` INTEGER NOT NULL DEFAULT 0, `sealed_configuration_generation` INTEGER, `sealed_mapping_profile` TEXT, `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": "sealedSessionId",
+ "columnName": "sealed_session_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "sealedRowCount",
+ "columnName": "sealed_row_count",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "sealedConfigurationGeneration",
+ "columnName": "sealed_configuration_generation",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "sealedMappingProfile",
+ "columnName": "sealed_mapping_profile",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncProfileTier",
+ "columnName": "sync_profile_tier",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncProfileBatchSize",
+ "columnName": "sync_profile_batch_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileStrategy",
+ "columnName": "sync_profile_strategy",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "syncProfileLowMemory",
+ "columnName": "sync_profile_low_memory",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileMemoryClassMb",
+ "columnName": "sync_profile_memory_class_mb",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "syncProfileAvailableMemMb",
+ "columnName": "sync_profile_available_mem_mb",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "completedAt",
+ "columnName": "completed_at",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_xtream_live_onboarding_state_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_xtream_live_onboarding_state_phase",
+ "unique": false,
+ "columnNames": [
+ "phase"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_phase` ON `${TABLE_NAME}` (`phase`)"
+ },
+ {
+ "name": "index_xtream_live_onboarding_state_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ },
+ {
+ "name": "index_xtream_live_onboarding_state_staged_session_id",
+ "unique": false,
+ "columnNames": [
+ "staged_session_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_xtream_live_onboarding_state_staged_session_id` ON `${TABLE_NAME}` (`staged_session_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "stalker_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, `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": "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_stalker_index_jobs_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_index_jobs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_stalker_index_jobs_state",
+ "unique": false,
+ "columnNames": [
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_index_jobs_state` ON `${TABLE_NAME}` (`state`)"
+ },
+ {
+ "name": "index_stalker_index_jobs_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_index_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "stalker_live_category_retries",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `category_name` TEXT NOT NULL, `configuration_generation` INTEGER NOT NULL, `attempt_count` INTEGER NOT NULL, `last_attempt_at` INTEGER NOT NULL, `last_error` 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": "categoryName",
+ "columnName": "category_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configurationGeneration",
+ "columnName": "configuration_generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastAttemptAt",
+ "columnName": "last_attempt_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "category_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_stalker_live_category_retries_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_live_category_retries_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "stalker_portal_state",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `working_endpoint` TEXT, `bootstrap_recipe` TEXT, `bulk_live_supported` INTEGER, `bulk_live_category_fidelity` INTEGER, `movie_wildcard_supported` INTEGER, `series_wildcard_supported` INTEGER, `epg_supported` INTEGER, `safe_metadata_concurrency` INTEGER NOT NULL, `stress_cooldown_until` INTEGER NOT NULL, `endpoint_health_json` TEXT NOT NULL, `endpoint_failed_until` INTEGER NOT NULL, `validated_at` INTEGER NOT NULL, `schema_version` INTEGER NOT NULL, `configuration_generation` INTEGER NOT NULL, `learning_json` TEXT NOT NULL, `observation_source` TEXT NOT NULL, `observed_at` 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": "workingEndpoint",
+ "columnName": "working_endpoint",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bootstrapRecipe",
+ "columnName": "bootstrap_recipe",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bulkLiveSupported",
+ "columnName": "bulk_live_supported",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "bulkLiveCategoryFidelity",
+ "columnName": "bulk_live_category_fidelity",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "movieWildcardSupported",
+ "columnName": "movie_wildcard_supported",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "seriesWildcardSupported",
+ "columnName": "series_wildcard_supported",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "epgSupported",
+ "columnName": "epg_supported",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "safeMetadataConcurrency",
+ "columnName": "safe_metadata_concurrency",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stressCooldownUntil",
+ "columnName": "stress_cooldown_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "endpointHealthJson",
+ "columnName": "endpoint_health_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "endpointFailedUntil",
+ "columnName": "endpoint_failed_until",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "validatedAt",
+ "columnName": "validated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "schemaVersion",
+ "columnName": "schema_version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configurationGeneration",
+ "columnName": "configuration_generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "learningJson",
+ "columnName": "learning_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "observationSource",
+ "columnName": "observation_source",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "observedAt",
+ "columnName": "observed_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_stalker_portal_state_provider_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_stalker_portal_state_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "stalker_remote_identities",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `raw_id` TEXT NOT NULL, `surrogate_id` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `content_type`, `raw_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": "rawId",
+ "columnName": "raw_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "surrogateId",
+ "columnName": "surrogate_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "raw_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_stalker_remote_identities_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_remote_identities_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_stalker_remote_identities_provider_id_content_type_surrogate_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "content_type",
+ "surrogate_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_stalker_remote_identities_provider_id_content_type_surrogate_id` ON `${TABLE_NAME}` (`provider_id`, `content_type`, `surrogate_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "stalker_discovery_staging",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`discovery_id` TEXT NOT NULL, `provider_id` INTEGER, `configuration_generation` INTEGER NOT NULL, `sanitized_summary` TEXT NOT NULL, `categories_json` TEXT NOT NULL, `channels_json` TEXT NOT NULL, `created_at` INTEGER NOT NULL, PRIMARY KEY(`discovery_id`))",
+ "fields": [
+ {
+ "fieldPath": "discoveryId",
+ "columnName": "discovery_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "configurationGeneration",
+ "columnName": "configuration_generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sanitizedSummary",
+ "columnName": "sanitized_summary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "categoriesJson",
+ "columnName": "categories_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "channelsJson",
+ "columnName": "channels_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "discovery_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_stalker_discovery_staging_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_discovery_staging_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_stalker_discovery_staging_created_at",
+ "unique": false,
+ "columnNames": [
+ "created_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_stalker_discovery_staging_created_at` ON `${TABLE_NAME}` (`created_at`)"
+ }
+ ]
+ },
+ {
+ "tableName": "downloads",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `content_id` INTEGER NOT NULL, `content_name` TEXT NOT NULL, `stream_url` TEXT NOT NULL, `source_stream_url` TEXT, `source_stream_id` INTEGER, `container_extension` TEXT, `poster_url` TEXT, `output_uri` TEXT, `output_display_path` TEXT, `status` TEXT NOT NULL, `bytes_written` INTEGER NOT NULL, `total_bytes` INTEGER, `supports_resume` INTEGER NOT NULL, `retry_count` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `completed_at` INTEGER, `failure_reason` TEXT, `owner_id` TEXT, `owner_epoch` INTEGER NOT NULL, `heartbeat_at` INTEGER, `series_id` INTEGER, `season_number` INTEGER, `episode_number` INTEGER, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentId",
+ "columnName": "content_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentName",
+ "columnName": "content_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamUrl",
+ "columnName": "stream_url",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sourceStreamUrl",
+ "columnName": "source_stream_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "sourceStreamId",
+ "columnName": "source_stream_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "containerExtension",
+ "columnName": "container_extension",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "posterUrl",
+ "columnName": "poster_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "outputUri",
+ "columnName": "output_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "outputDisplayPath",
+ "columnName": "output_display_path",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bytesWritten",
+ "columnName": "bytes_written",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalBytes",
+ "columnName": "total_bytes",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "supportsResume",
+ "columnName": "supports_resume",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "retryCount",
+ "columnName": "retry_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "completedAt",
+ "columnName": "completed_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "failureReason",
+ "columnName": "failure_reason",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "ownerId",
+ "columnName": "owner_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "ownerEpoch",
+ "columnName": "owner_epoch",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "heartbeatAt",
+ "columnName": "heartbeat_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "seriesId",
+ "columnName": "series_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "seasonNumber",
+ "columnName": "season_number",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "episodeNumber",
+ "columnName": "episode_number",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_downloads_status",
+ "unique": false,
+ "columnNames": [
+ "status"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_status` ON `${TABLE_NAME}` (`status`)"
+ },
+ {
+ "name": "index_downloads_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_downloads_content_type_content_id",
+ "unique": false,
+ "columnNames": [
+ "content_type",
+ "content_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_downloads_content_type_content_id` ON `${TABLE_NAME}` (`content_type`, `content_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "provider_deletion_cleanup",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `action` TEXT NOT NULL, `target_id` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "action",
+ "columnName": "action",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetId",
+ "columnName": "target_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_deletion_cleanup_provider_id_action_target_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id",
+ "action",
+ "target_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_provider_deletion_cleanup_provider_id_action_target_id` ON `${TABLE_NAME}` (`provider_id`, `action`, `target_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "plugin_provider_ownership",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`package_name` TEXT NOT NULL, `service_class_name` TEXT NOT NULL, `manifest_id` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, PRIMARY KEY(`package_name`, `service_class_name`, `manifest_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "packageName",
+ "columnName": "package_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "serviceClassName",
+ "columnName": "service_class_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "manifestId",
+ "columnName": "manifest_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "package_name",
+ "service_class_name",
+ "manifest_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_plugin_provider_ownership_provider_id",
+ "unique": true,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_plugin_provider_ownership_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "provider_config_revisions",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `revision` INTEGER NOT NULL, `config_json` TEXT NOT NULL, `state` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `revision`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "revision",
+ "columnName": "revision",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configJson",
+ "columnName": "config_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "revision"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_config_revisions_provider_id_state",
+ "unique": false,
+ "columnNames": [
+ "provider_id",
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_config_revisions_provider_id_state` ON `${TABLE_NAME}` (`provider_id`, `state`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "backup_restore_checkpoints",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`restore_key` TEXT NOT NULL, `room_complete` INTEGER NOT NULL, `preferences_complete` INTEGER NOT NULL, `presets_complete` INTEGER NOT NULL, `schedules_complete` INTEGER NOT NULL, `state` TEXT NOT NULL, `preference_snapshot_json` TEXT, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`restore_key`))",
+ "fields": [
+ {
+ "fieldPath": "restoreKey",
+ "columnName": "restore_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "roomComplete",
+ "columnName": "room_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "preferencesComplete",
+ "columnName": "preferences_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "presetsComplete",
+ "columnName": "presets_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "schedulesComplete",
+ "columnName": "schedules_complete",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "preferenceSnapshotJson",
+ "columnName": "preference_snapshot_json",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "restore_key"
+ ]
+ }
+ },
+ {
+ "tableName": "backup_restore_jobs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `restore_key` TEXT NOT NULL, `backup_version` INTEGER NOT NULL, `conflict_strategy` TEXT NOT NULL, `status` TEXT NOT NULL, `total_count` INTEGER NOT NULL, `pending_count` INTEGER NOT NULL, `applied_count` INTEGER NOT NULL, `unresolved_count` INTEGER NOT NULL, `failed_count` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "restoreKey",
+ "columnName": "restore_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "backupVersion",
+ "columnName": "backup_version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "conflictStrategy",
+ "columnName": "conflict_strategy",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalCount",
+ "columnName": "total_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "pendingCount",
+ "columnName": "pending_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "appliedCount",
+ "columnName": "applied_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "unresolvedCount",
+ "columnName": "unresolved_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "failedCount",
+ "columnName": "failed_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_backup_restore_jobs_restore_key",
+ "unique": true,
+ "columnNames": [
+ "restore_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_backup_restore_jobs_restore_key` ON `${TABLE_NAME}` (`restore_key`)"
+ },
+ {
+ "name": "index_backup_restore_jobs_status",
+ "unique": false,
+ "columnNames": [
+ "status"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_jobs_status` ON `${TABLE_NAME}` (`status`)"
+ },
+ {
+ "name": "index_backup_restore_jobs_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_jobs_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ }
+ ]
+ },
+ {
+ "tableName": "backup_restore_items",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `job_id` TEXT NOT NULL, `provider_identity_key` TEXT NOT NULL, `local_provider_id` INTEGER, `section` TEXT NOT NULL, `content_type` TEXT, `stable_reference_key` TEXT NOT NULL, `reference_json` TEXT NOT NULL, `payload_json` TEXT NOT NULL, `status` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `last_error` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, FOREIGN KEY(`job_id`) REFERENCES `backup_restore_jobs`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "jobId",
+ "columnName": "job_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "providerIdentityKey",
+ "columnName": "provider_identity_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "localProviderId",
+ "columnName": "local_provider_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "section",
+ "columnName": "section",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentType",
+ "columnName": "content_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "stableReferenceKey",
+ "columnName": "stable_reference_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceJson",
+ "columnName": "reference_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "payloadJson",
+ "columnName": "payload_json",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "status",
+ "columnName": "status",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastError",
+ "columnName": "last_error",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_backup_restore_items_job_id",
+ "unique": false,
+ "columnNames": [
+ "job_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_items_job_id` ON `${TABLE_NAME}` (`job_id`)"
+ },
+ {
+ "name": "index_backup_restore_items_provider_identity_key_status",
+ "unique": false,
+ "columnNames": [
+ "provider_identity_key",
+ "status"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_items_provider_identity_key_status` ON `${TABLE_NAME}` (`provider_identity_key`, `status`)"
+ },
+ {
+ "name": "index_backup_restore_items_job_id_status",
+ "unique": false,
+ "columnNames": [
+ "job_id",
+ "status"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_backup_restore_items_job_id_status` ON `${TABLE_NAME}` (`job_id`, `status`)"
+ },
+ {
+ "name": "index_backup_restore_items_job_id_section_stable_reference_key",
+ "unique": true,
+ "columnNames": [
+ "job_id",
+ "section",
+ "stable_reference_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_backup_restore_items_job_id_section_stable_reference_key` ON `${TABLE_NAME}` (`job_id`, `section`, `stable_reference_key`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "backup_restore_jobs",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "job_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "provider_workflows",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `generation` INTEGER NOT NULL, `state` TEXT NOT NULL, `reason` TEXT NOT NULL, `priority` INTEGER NOT NULL, `force` INTEGER NOT NULL, `current_phase` TEXT, `lease_token` TEXT, `lease_expires_at` INTEGER, `heartbeat_at` INTEGER, `progress_message` TEXT, `last_error_code` TEXT, `last_error_message` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "generation",
+ "columnName": "generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "priority",
+ "columnName": "priority",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "force",
+ "columnName": "force",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "currentPhase",
+ "columnName": "current_phase",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "leaseToken",
+ "columnName": "lease_token",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "leaseExpiresAt",
+ "columnName": "lease_expires_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "heartbeatAt",
+ "columnName": "heartbeat_at",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "progressMessage",
+ "columnName": "progress_message",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorCode",
+ "columnName": "last_error_code",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorMessage",
+ "columnName": "last_error_message",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "completedAt",
+ "columnName": "completed_at",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_workflows_state",
+ "unique": false,
+ "columnNames": [
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_state` ON `${TABLE_NAME}` (`state`)"
+ },
+ {
+ "name": "index_provider_workflows_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ },
+ {
+ "name": "index_provider_workflows_lease_expires_at",
+ "unique": false,
+ "columnNames": [
+ "lease_expires_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflows_lease_expires_at` ON `${TABLE_NAME}` (`lease_expires_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "provider_workflow_phases",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `generation` INTEGER NOT NULL, `phase` TEXT NOT NULL, `state` TEXT NOT NULL, `attempt_count` INTEGER NOT NULL, `checkpoint` TEXT, `last_error_code` TEXT, `last_error_message` TEXT, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, `completed_at` INTEGER, PRIMARY KEY(`provider_id`, `generation`, `phase`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "providerId",
+ "columnName": "provider_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "generation",
+ "columnName": "generation",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "phase",
+ "columnName": "phase",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "state",
+ "columnName": "state",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "attemptCount",
+ "columnName": "attempt_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "checkpoint",
+ "columnName": "checkpoint",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorCode",
+ "columnName": "last_error_code",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "lastErrorMessage",
+ "columnName": "last_error_message",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "completedAt",
+ "columnName": "completed_at",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "generation",
+ "phase"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_provider_workflow_phases_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ },
+ {
+ "name": "index_provider_workflow_phases_state",
+ "unique": false,
+ "columnNames": [
+ "state"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_state` ON `${TABLE_NAME}` (`state`)"
+ },
+ {
+ "name": "index_provider_workflow_phases_updated_at",
+ "unique": false,
+ "columnNames": [
+ "updated_at"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_provider_workflow_phases_updated_at` ON `${TABLE_NAME}` (`updated_at`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "m3u_classification_overrides",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `source_key` TEXT NOT NULL, `stream_id` INTEGER NOT NULL, `target_type` TEXT NOT NULL, `group_key` TEXT NOT NULL, `series_key` TEXT, `series_name` TEXT, `season_number` INTEGER, `episode_number` INTEGER, `episode_title` TEXT, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `source_key`), 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": "sourceKey",
+ "columnName": "source_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "streamId",
+ "columnName": "stream_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetType",
+ "columnName": "target_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "groupKey",
+ "columnName": "group_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "seriesKey",
+ "columnName": "series_key",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "seriesName",
+ "columnName": "series_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "seasonNumber",
+ "columnName": "season_number",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "episodeNumber",
+ "columnName": "episode_number",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "episodeTitle",
+ "columnName": "episode_title",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "source_key"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_m3u_classification_overrides_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_m3u_classification_overrides_provider_id` ON `${TABLE_NAME}` (`provider_id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "providers",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "provider_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "m3u_category_classification_rules",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `group_key` TEXT NOT NULL, `target_type` TEXT NOT NULL, `updated_at` INTEGER NOT NULL, PRIMARY KEY(`provider_id`, `group_key`), 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": "groupKey",
+ "columnName": "group_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetType",
+ "columnName": "target_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "updatedAt",
+ "columnName": "updated_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "provider_id",
+ "group_key"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_m3u_category_classification_rules_provider_id",
+ "unique": false,
+ "columnNames": [
+ "provider_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_m3u_category_classification_rules_provider_id` ON `${TABLE_NAME}` (`provider_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, 'b6b0aab2b99bd49babb3c0f2af69340d')"
+ ]
+ }
+}
diff --git a/data/src/main/java/com/streamvault/data/local/FeatureMigrationsV82To83.kt b/data/src/main/java/com/streamvault/data/local/FeatureMigrationsV82To83.kt
new file mode 100644
index 00000000..df04c9a8
--- /dev/null
+++ b/data/src/main/java/com/streamvault/data/local/FeatureMigrationsV82To83.kt
@@ -0,0 +1,13 @@
+package com.streamvault.data.local
+
+import androidx.room.migration.Migration
+import androidx.sqlite.db.SupportSQLiteDatabase
+
+/** Persists the resolved network profile needed by a recording service started later. */
+internal object FeatureMigrationsV82To83 {
+ val MIGRATION_82_83 = object : Migration(82, 83) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("ALTER TABLE `recording_runs` ADD COLUMN `network_profile_json` TEXT NOT NULL DEFAULT '{}'")
+ }
+ }
+}
diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
index 74939a14..9b9f9607 100644
--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt
@@ -12,7 +12,7 @@ import org.json.JSONObject
import java.net.URI
import java.security.MessageDigest
-internal const val STREAM_VAULT_DATABASE_VERSION = 82
+internal const val STREAM_VAULT_DATABASE_VERSION = 83
@Database(
entities = [
@@ -212,5 +212,6 @@ abstract class StreamVaultDatabase : RoomDatabase() {
val MIGRATION_79_80 = FeatureMigrationsV79To80.MIGRATION_79_80
val MIGRATION_80_81 = FeatureMigrationsV80To81.MIGRATION_80_81
val MIGRATION_81_82 = FeatureMigrationsV81To82.MIGRATION_81_82
+ val MIGRATION_82_83 = FeatureMigrationsV82To83.MIGRATION_82_83
}
}
diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt
index 63caeac1..9fd432c1 100644
--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt
+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabaseMigrationRegistry.kt
@@ -19,7 +19,8 @@ object StreamVaultDatabaseMigrationRegistry {
val v79To80: List<Migration> = listOf(FeatureMigrationsV79To80.MIGRATION_79_80)
val v80To81: List<Migration> = listOf(FeatureMigrationsV80To81.MIGRATION_80_81)
val v81To82: List<Migration> = listOf(FeatureMigrationsV81To82.MIGRATION_81_82)
- val all: List<Migration> = (v1To24 + v24To49 + v49To75 + v75To76 + v76To77 + v77To78 + v78To79 + v79To80 + v80To81 + v81To82).also(::validate)
+ val v82To83: List<Migration> = listOf(FeatureMigrationsV82To83.MIGRATION_82_83)
+ val all: List<Migration> = (v1To24 + v24To49 + v49To75 + v75To76 + v76To77 + v77To78 + v78To79 + v79To80 + v80To81 + v81To82 + v82To83).also(::validate)
private fun validate(migrations: List<Migration>) {
require(migrations.map { it.startVersion }.distinct().size == migrations.size) {
diff --git a/data/src/main/java/com/streamvault/data/local/entity/RecordingEntities.kt b/data/src/main/java/com/streamvault/data/local/entity/RecordingEntities.kt
index a658c3ad..0da33e25 100644
--- a/data/src/main/java/com/streamvault/data/local/entity/RecordingEntities.kt
+++ b/data/src/main/java/com/streamvault/data/local/entity/RecordingEntities.kt
@@ -88,6 +88,7 @@ data class RecordingRunEntity(
@ColumnInfo(name = "resolved_url") val resolvedUrl: String? = null,
@ColumnInfo(name = "headers_json") val headersJson: String = "{}",
@ColumnInfo(name = "user_agent") val userAgent: String? = null,
+ @ColumnInfo(name = "network_profile_json", defaultValue = "'{}'") val networkProfileJson: String = "{}",
@ColumnInfo(name = "expiration_time") val expirationTime: Long? = null,
@ColumnInfo(name = "provider_label") val providerLabel: String? = null,
@ColumnInfo(name = "output_uri") val outputUri: String? = null,
diff --git a/data/src/main/java/com/streamvault/data/manager/RecordingManagerImpl.kt b/data/src/main/java/com/streamvault/data/manager/RecordingManagerImpl.kt
index 5c47fd7a..1091b38a 100644
--- a/data/src/main/java/com/streamvault/data/manager/RecordingManagerImpl.kt
+++ b/data/src/main/java/com/streamvault/data/manager/RecordingManagerImpl.kt
@@ -23,6 +23,7 @@ import com.streamvault.data.manager.recording.RecordingForegroundService
import com.streamvault.data.manager.recording.RecordingOutputTarget
import com.streamvault.data.manager.recording.RecordingServiceLauncher
import com.streamvault.data.manager.recording.RecordingSourceResolver
+import com.streamvault.data.manager.recording.RecordingNetworkProfile
import com.streamvault.data.manager.recording.ResolvedRecordingSource
import com.streamvault.data.manager.recording.SmbRecordingCredentials
import com.streamvault.data.manager.recording.SmbRecordingStorage
@@ -58,7 +59,10 @@ import com.streamvault.domain.model.RecordingSourceType
import com.streamvault.domain.model.RecordingStatus
import com.streamvault.domain.model.RecordingStorageConfig
import com.streamvault.domain.model.RecordingStorageState
+import com.streamvault.domain.model.RecordingFailureReasonCodes
+import com.streamvault.domain.model.LivePlaybackIdentity
import com.streamvault.domain.model.Result
+import com.streamvault.domain.util.LivePlaybackCaptureBackpressureException
import dagger.hilt.android.qualifiers.ApplicationContext
import java.io.File
import java.io.FileInputStream
@@ -740,6 +744,7 @@ class RecordingManagerImpl @Inject constructor(
resolvedUrl = source.url,
headersJson = headersToJson(source.headers),
userAgent = source.userAgent,
+ networkProfileJson = source.networkProfile.toJson(),
expirationTime = source.expirationTime,
providerLabel = source.providerLabel,
outputUri = outputUri ?: run.outputUri,
@@ -782,6 +787,12 @@ class RecordingManagerImpl @Inject constructor(
sourceType = run.sourceType,
headers = headersFromJson(run.headersJson),
userAgent = run.userAgent,
+ networkProfile = RecordingNetworkProfile.fromJson(run.networkProfileJson),
+ livePlaybackIdentity = if (run.providerId > 0L && run.channelId > 0L) {
+ LivePlaybackIdentity(run.providerId, run.channelId)
+ } else {
+ null
+ },
expirationTime = run.expirationTime,
providerLabel = run.providerLabel
)
@@ -810,7 +821,13 @@ class RecordingManagerImpl @Inject constructor(
} catch (unsupported: UnsupportedRecordingException) {
markRunFailed(run.id, unsupported.message ?: "Recording format is unsupported.", unsupported.category)
} catch (error: Throwable) {
- markRunFailed(run.id, error.message ?: "Recording failed.", inferFailureCategory(error))
+ val failureReason = if (error is LivePlaybackCaptureBackpressureException) {
+ Log.w(TAG, "Live recording output could not keep up with playback.", error)
+ RecordingFailureReasonCodes.LIVE_CAPTURE_OUTPUT_TOO_SLOW
+ } else {
+ error.message ?: "Recording failed."
+ }
+ markRunFailed(run.id, failureReason, inferFailureCategory(error))
} finally {
removeActiveJob(run.id, activeCapture)
onCaptureFinished(run.id)
@@ -1138,6 +1155,7 @@ class RecordingManagerImpl @Inject constructor(
resolvedUrl = source.url,
headersJson = headersToJson(source.headers),
userAgent = source.userAgent,
+ networkProfileJson = source.networkProfile.toJson(),
expirationTime = source.expirationTime,
providerLabel = source.providerLabel,
outputUri = outputUri,
@@ -1233,6 +1251,7 @@ class RecordingManagerImpl @Inject constructor(
resolvedUrl = null,
headersJson = "{}",
userAgent = null,
+ networkProfileJson = "{}",
expirationTime = null,
providerLabel = null,
outputUri = null,
diff --git a/data/src/main/java/com/streamvault/data/manager/recording/RecordingCaptureEngine.kt b/data/src/main/java/com/streamvault/data/manager/recording/RecordingCaptureEngine.kt
index bae30b29..5a3d003b 100644
--- a/data/src/main/java/com/streamvault/data/manager/recording/RecordingCaptureEngine.kt
+++ b/data/src/main/java/com/streamvault/data/manager/recording/RecordingCaptureEngine.kt
@@ -1,11 +1,16 @@
package com.streamvault.data.manager.recording
import android.content.ContentResolver
+import android.util.Log
import com.streamvault.data.remote.http.useCancellableResponse
+import com.streamvault.domain.util.LivePlaybackByteTap
import com.streamvault.domain.model.RecordingFailureCategory
import com.streamvault.domain.model.RecordingSourceType
+import com.streamvault.domain.util.effectiveHttpRequestProperties
+import com.streamvault.domain.util.livePlaybackRequestFingerprint
import java.io.ByteArrayOutputStream
import java.io.IOException
+import java.io.InputStream
import java.net.URI
import java.util.Locale
import javax.crypto.Cipher
@@ -16,6 +21,7 @@ import javax.inject.Singleton
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.isActive
+import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import okhttp3.Request
@@ -29,6 +35,28 @@ data class CaptureProgress(
private const val MAX_TRANSIENT_RETRIES = 3
private const val RETRY_BACKOFF_BASE_MS = 15_000L
private const val STALL_TIMEOUT_MS = 60_000L
+private const val HLS_SHARED_POLL_INTERVAL_MS = 500L
+private const val MAX_HLS_RANGE_BYTES = 32 * 1024 * 1024L
+private const val RECORDING_CAPTURE_TAG = "RecordingCapture"
+private val HLS_CONTENT_RANGE_PATTERN = Regex("""bytes\s+(\d+)-(\d+)/(?:\d+|\*)""", RegexOption.IGNORE_CASE)
+
+private fun checkRecordingResponse(response: okhttp3.Response, source: ResolvedRecordingSource) {
+ if (response.isSuccessful) return
+ if (response.code == 403) {
+ val request = response.request
+ val policyMode = source.networkProfile.playbackTransportPolicy?.mode?.name
+ ?: if (source.networkProfile.allowInvalidSsl) "LEGACY_UNVERIFIED" else "STRICT"
+ Log.w(
+ RECORDING_CAPTURE_TAG,
+ "Upstream denied recording with HTTP 403 host=${request.url.host} type=${source.sourceType} " +
+ "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} proxy=${source.networkProfile.proxyHost.isNotBlank()} " +
+ "transport=$policyMode"
+ )
+ }
+ throw IOException("Recording stream failed with HTTP ${response.code}")
+}
private fun isTransientFailure(error: Throwable): Boolean {
val msg = error.message.orEmpty().lowercase(Locale.ROOT)
@@ -54,8 +82,14 @@ interface RecordingCaptureEngine {
@Singleton
class TsPassThroughCaptureEngine @Inject constructor(
- private val okHttpClient: OkHttpClient
+ private val recordingHttpClientFactory: RecordingHttpClientFactory,
+ private val livePlaybackByteTap: LivePlaybackByteTap
) : RecordingCaptureEngine {
+ constructor(okHttpClient: OkHttpClient) : this(
+ RecordingHttpClientFactory { okHttpClient },
+ LivePlaybackByteTap()
+ )
+
override val sourceType: RecordingSourceType = RecordingSourceType.TS
override suspend fun capture(
@@ -69,17 +103,53 @@ class TsPassThroughCaptureEngine @Inject constructor(
val startMs = System.currentTimeMillis()
var bytesWritten = 0L
var retryCount = 0
+ val client = recordingHttpClientFactory.create(source.networkProfile)
+ val headers = effectiveHttpRequestProperties(source.headers, source.userAgent)
+ val requestFingerprint = source.livePlaybackIdentity?.let {
+ livePlaybackRequestFingerprint(source.url, headers)
+ }
val output = outputTarget.openOutputStream(contentResolver, append = false)
?: throw IOException("Could not open recording output target")
output.use { sink ->
+ suspend fun reportBytes(count: Int) {
+ bytesWritten += count
+ val now = System.currentTimeMillis()
+ val elapsedMs = (now - startMs).coerceAtLeast(1L)
+ onProgress(
+ CaptureProgress(
+ bytesWritten = bytesWritten,
+ averageThroughputBytesPerSecond = (bytesWritten * 1000L) / elapsedMs,
+ lastProgressAtMs = now,
+ retryCount = retryCount
+ )
+ )
+ }
+
+ val sharedCapture = source.livePlaybackIdentity?.let { identity ->
+ requestFingerprint?.let { fingerprint -> livePlaybackByteTap.attach(identity, fingerprint) }
+ }
+ if (sharedCapture != null) {
+ sharedCapture.use { capture ->
+ while (kotlinx.coroutines.currentCoroutineContext().isActive &&
+ System.currentTimeMillis() < scheduledEndMs
+ ) {
+ val chunk = withTimeoutOrNull(STALL_TIMEOUT_MS) { capture.readChunk() }
+ ?: break // Playback ended or stopped delivering; finish through the direct path.
+ if (chunk.isEmpty()) continue
+ sink.write(chunk)
+ reportBytes(chunk.size)
+ }
+ sink.flush()
+ }
+ }
+
while (kotlinx.coroutines.currentCoroutineContext().isActive && System.currentTimeMillis() < scheduledEndMs) {
try {
val request = Request.Builder().url(source.url).apply {
- source.userAgent?.takeIf { it.isNotBlank() }?.let { header("User-Agent", it) }
- source.headers.forEach { (key, value) -> header(key, value) }
+ headers.forEach { (key, value) -> header(key, value) }
}.build()
- okHttpClient.newCall(request).useCancellableResponse { response ->
- if (!response.isSuccessful) throw IOException("Recording stream failed with HTTP ${response.code}")
+ client.newCall(request).useCancellableResponse { response ->
+ checkRecordingResponse(response, source)
val body = response.body ?: throw IOException("Recording stream returned an empty body")
body.byteStream().use { input ->
val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
@@ -94,16 +164,7 @@ class TsPassThroughCaptureEngine @Inject constructor(
if (read <= 0) break
lastDataAt = System.currentTimeMillis()
sink.write(buffer, 0, read)
- bytesWritten += read
- val elapsedMs = (System.currentTimeMillis() - startMs).coerceAtLeast(1L)
- onProgress(
- CaptureProgress(
- bytesWritten = bytesWritten,
- averageThroughputBytesPerSecond = (bytesWritten * 1000L) / elapsedMs,
- lastProgressAtMs = System.currentTimeMillis(),
- retryCount = retryCount
- )
- )
+ reportBytes(read)
}
sink.flush()
}
@@ -122,8 +183,14 @@ class TsPassThroughCaptureEngine @Inject constructor(
@Singleton
class HlsLiveCaptureEngine @Inject constructor(
- private val okHttpClient: OkHttpClient
+ private val recordingHttpClientFactory: RecordingHttpClientFactory,
+ private val livePlaybackByteTap: LivePlaybackByteTap
) : RecordingCaptureEngine {
+ constructor(okHttpClient: OkHttpClient) : this(
+ RecordingHttpClientFactory { okHttpClient },
+ LivePlaybackByteTap()
+ )
+
override val sourceType: RecordingSourceType = RecordingSourceType.HLS
override suspend fun capture(
@@ -137,123 +204,352 @@ class HlsLiveCaptureEngine @Inject constructor(
val startMs = System.currentTimeMillis()
var bytesWritten = 0L
var retryCount = 0
- val headers = buildMap {
- putAll(source.headers)
- source.userAgent?.takeIf { it.isNotBlank() }?.let { put("User-Agent", it) }
+ val client = recordingHttpClientFactory.create(source.networkProfile)
+ val headers = effectiveHttpRequestProperties(source.headers, source.userAgent)
+ val requestFingerprint = source.livePlaybackIdentity?.let {
+ livePlaybackRequestFingerprint(source.url, headers)
}
val output = outputTarget.openOutputStream(contentResolver)
?: throw IOException("Could not open recording output target")
- output.use { sink ->
- var currentPlaylistUrl = source.url
- val maxSeenSegments = 10_000
- val seenSegments = object : LinkedHashSet<String>() {
- override fun add(element: String): Boolean {
- val added = super.add(element)
- if (size > maxSeenSegments) remove(first())
- return added
- }
+ var sharedHlsCapture = source.livePlaybackIdentity?.let { identity ->
+ requestFingerprint?.let { livePlaybackByteTap.attachHls(identity, it) }
+ }
+ Log.i(
+ RECORDING_CAPTURE_TAG,
+ if (sharedHlsCapture != null) {
+ "HLS recording source=foreground-playback"
+ } else {
+ "HLS recording source=direct-upstream"
}
- var lastDataAt = System.currentTimeMillis()
- var consecutiveEmptyPlaylists = 0
- while (kotlinx.coroutines.currentCoroutineContext().isActive && System.currentTimeMillis() < scheduledEndMs) {
- if (System.currentTimeMillis() - lastDataAt > STALL_TIMEOUT_MS) {
- throw IOException("HLS recording stalled — no new segments for ${STALL_TIMEOUT_MS / 1000}s")
- }
- val playlistText = try {
- fetchText(currentPlaylistUrl, headers)
- } catch (e: Throwable) {
- if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
- retryCount++
- delay(RETRY_BACKOFF_BASE_MS * (1L shl (retryCount - 1).coerceAtMost(3)))
- continue
+ )
+ try {
+ output.use { sink ->
+ var currentPlaylistUrl = source.url
+ var activeVariantUrls = emptyList<String>()
+ val maxSeenSegments = 10_000
+ val seenSegments = object : LinkedHashSet<String>() {
+ override fun add(element: String): Boolean {
+ val added = super.add(element)
+ if (size > maxSeenSegments) remove(first())
+ return added
+ }
}
- val playlist = parsePlaylist(currentPlaylistUrl, playlistText, maxVideoHeight)
- when (playlist) {
- is ParsedHlsPlaylist.Master -> {
- currentPlaylistUrl = playlist.bestVariantUrl
+ var lastWrittenMapIdentity: String? = null
+ val byteRangeState = HlsByteRangeState()
+ var lastDataAt = System.currentTimeMillis()
+ while (kotlinx.coroutines.currentCoroutineContext().isActive && System.currentTimeMillis() < scheduledEndMs) {
+ val now = System.currentTimeMillis()
+ val sharedCapture = sharedHlsCapture
+ if (now - lastDataAt > STALL_TIMEOUT_MS &&
+ (sharedCapture == null || sharedCapture.isPlaybackActive())
+ ) {
+ throw IOException("HLS recording stalled — no new segments for ${STALL_TIMEOUT_MS / 1000}s")
}
- is ParsedHlsPlaylist.Media -> {
- // Validate that all encryption methods are supported
- playlist.segments.mapNotNull { it.key }
- .distinctBy { it.uri }
- .forEach { key ->
- if (!key.method.equals("NONE", ignoreCase = true) &&
- !key.method.equals("AES-128", ignoreCase = true)
- ) {
- throw UnsupportedRecordingException(
- "This HLS stream uses unsupported DRM or encryption.",
- RecordingFailureCategory.DRM_UNSUPPORTED
- )
+ sharedCapture?.throwIfFailed()
+ if (sharedCapture != null && !sharedCapture.isPlaybackActive()) {
+ if (now - lastDataAt > STALL_TIMEOUT_MS) {
+ sharedCapture.close()
+ sharedHlsCapture = null
+ activeVariantUrls = emptyList()
+ currentPlaylistUrl = source.url
+ retryCount = 0
+ Log.i(RECORDING_CAPTURE_TAG, "HLS recording source=direct-upstream reason=playback-inactive")
+ } else {
+ delay(HLS_SHARED_POLL_INTERVAL_MS)
+ continue
+ }
+ }
+ val activeCapture = sharedHlsCapture
+ if (activeCapture != null && activeVariantUrls.isNotEmpty()) {
+ activeCapture.newestResource(activeVariantUrls)?.let { activeVariant ->
+ currentPlaylistUrl = activeVariant.url
+ }
+ }
+ val sharedPlaylist = activeCapture?.resource(currentPlaylistUrl)
+ if (activeCapture != null && sharedPlaylist == null) {
+ delay(HLS_SHARED_POLL_INTERVAL_MS)
+ continue
+ }
+ val playlistText = if (activeCapture != null) {
+ requireNotNull(sharedPlaylist).bytes.toString(Charsets.UTF_8)
+ } else {
+ try {
+ fetchText(currentPlaylistUrl, headers, client, source)
+ } catch (e: Throwable) {
+ if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
+ retryCount++
+ delay(RETRY_BACKOFF_BASE_MS * (1L shl (retryCount - 1).coerceAtMost(3)))
+ continue
+ }
+ }
+ val playlistBaseUrl = sharedPlaylist?.url ?: currentPlaylistUrl
+ val playlist = parsePlaylist(playlistBaseUrl, playlistText, maxVideoHeight, byteRangeState)
+ when (playlist) {
+ is ParsedHlsPlaylist.Master -> {
+ activeVariantUrls = playlist.variantUrls
+ currentPlaylistUrl = activeCapture
+ ?.newestResource(playlist.variantUrls)
+ ?.url
+ ?: playlist.bestVariantUrl
+ }
+ is ParsedHlsPlaylist.Media -> {
+ // Validate that all encryption methods are supported
+ if (playlist.segments.any { segment ->
+ segment.initializationSection?.key?.let { key ->
+ key.method.equals("AES-128", ignoreCase = true) && key.iv == null
+ } == true
}
+ ) {
+ throw UnsupportedRecordingException(
+ "This HLS stream uses unsupported DRM or encryption.",
+ RecordingFailureCategory.DRM_UNSUPPORTED
+ )
}
- // Cache key bytes by URI so rotated keys are fetched once each
- val keyCache = mutableMapOf<String, ByteArray>()
- var newSegmentsThisRound = false
- playlist.segments.forEach { segment ->
- kotlinx.coroutines.currentCoroutineContext().ensureActive()
- if (segment.uri in seenSegments) return@forEach
- val bytes = try {
- fetchBytes(segment.uri, headers)
- } catch (e: Throwable) {
- if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
- retryCount++
- return@forEach // Skip this segment, retry on next playlist refresh
+ playlist.segments.flatMap { segment ->
+ listOfNotNull(segment.key, segment.initializationSection?.key)
}
- val segKey = segment.key?.takeIf { it.method.equals("AES-128", ignoreCase = true) }
- val payload = if (segKey != null) {
- val keyBytes = keyCache[segKey.uri] ?: fetchBytes(segKey.uri, headers).also {
- keyCache[segKey.uri] = it
+ .distinctBy { it.uri }
+ .forEach { key ->
+ if (!key.method.equals("NONE", ignoreCase = true) &&
+ !key.method.equals("AES-128", ignoreCase = true)
+ ) {
+ throw UnsupportedRecordingException(
+ "This HLS stream uses unsupported DRM or encryption.",
+ RecordingFailureCategory.DRM_UNSUPPORTED
+ )
+ }
}
- decryptAes128(bytes, keyBytes, segKey.iv, segment.mediaSequenceNumber)
- } else {
- bytes
- }
- sink.write(payload)
- seenSegments += segment.uri
- bytesWritten += payload.size
- newSegmentsThisRound = true
- lastDataAt = System.currentTimeMillis()
- val elapsedMs = (System.currentTimeMillis() - startMs).coerceAtLeast(1L)
- onProgress(
- CaptureProgress(
- bytesWritten = bytesWritten,
- averageThroughputBytesPerSecond = (bytesWritten * 1000L) / elapsedMs,
- lastProgressAtMs = System.currentTimeMillis(),
- retryCount = retryCount
+ // Cache key bytes by URI so rotated keys are fetched once each
+ val keyCache = mutableMapOf<String, ByteArray>()
+ var newSegmentsThisRound = false
+ for (segment in playlist.segments) {
+ kotlinx.coroutines.currentCoroutineContext().ensureActive()
+ val rangeIdentity = segment.byteRange?.let { "@${it.offset}:${it.length}" }.orEmpty()
+ val segmentIdentity = "${segment.mediaSequenceNumber}:${segment.uri}$rangeIdentity"
+ if (segmentIdentity in seenSegments) continue
+ activeCapture?.throwIfFailed()
+ val segmentRangeStart = segment.byteRange?.offset ?: 0L
+ val segmentRangeLength = segment.byteRange?.length ?: -1L
+ val capturedSegment = activeCapture?.recordingResource(
+ segment.uri,
+ segmentRangeStart,
+ segmentRangeLength
+ )
+ val bytes = if (activeCapture != null) {
+ capturedSegment?.bytes ?: break
+ } else {
+ try {
+ fetchBytes(segment.uri, headers, client, source, segment.byteRange)
+ } catch (e: Throwable) {
+ if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
+ retryCount++
+ break // Retry this segment on the next playlist refresh.
+ }
+ }
+ val segKey = segment.key?.takeIf { it.method.equals("AES-128", ignoreCase = true) }
+ val payload = if (segKey != null) {
+ val keyBytes = try {
+ resolveKeyBytes(segKey, activeCapture, keyCache, headers, client, source)
+ } catch (e: Throwable) {
+ if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
+ retryCount++
+ break
+ } ?: break
+ decryptAes128(bytes, keyBytes, segKey.iv, segment.mediaSequenceNumber)
+ } else {
+ bytes
+ }
+ val map = segment.initializationSection
+ val mapIdentity = map?.let { section ->
+ val mapRangeIdentity = section.byteRange
+ ?.let { "@${it.offset}:${it.length}" }
+ .orEmpty()
+ val mapKeyIdentity = section.key?.let { key ->
+ "|${key.method}:${key.uri}:${key.iv.orEmpty()}"
+ }.orEmpty()
+ "${section.uri}$mapRangeIdentity$mapKeyIdentity"
+ }
+ val mapRangeStart = map?.byteRange?.offset ?: 0L
+ val mapRangeLength = map?.byteRange?.length ?: -1L
+ val capturedMap = if (map != null) {
+ activeCapture?.resource(map.uri, mapRangeStart, mapRangeLength)
+ } else {
+ null
+ }
+ val initializationPayload = if (map != null && mapIdentity != lastWrittenMapIdentity) {
+ val mapBytes = if (activeCapture != null) {
+ capturedMap?.bytes ?: break
+ } else {
+ try {
+ fetchBytes(map.uri, headers, client, source, map.byteRange)
+ } catch (e: Throwable) {
+ if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
+ retryCount++
+ break
+ }
+ }
+ val mapKey = map.key?.takeIf { it.method.equals("AES-128", ignoreCase = true) }
+ if (mapKey == null) {
+ mapBytes
+ } else {
+ val mapKeyBytes = try {
+ resolveKeyBytes(mapKey, activeCapture, keyCache, headers, client, source)
+ } catch (e: Throwable) {
+ if (!isTransientFailure(e) || retryCount >= MAX_TRANSIENT_RETRIES) throw e
+ retryCount++
+ break
+ } ?: break
+ decryptAes128(
+ mapBytes,
+ mapKeyBytes,
+ mapKey.iv,
+ map.mediaSequenceNumber
+ )
+ }
+ } else {
+ null
+ }
+ initializationPayload?.let { initBytes ->
+ sink.write(initBytes)
+ bytesWritten += initBytes.size
+ lastWrittenMapIdentity = mapIdentity
+ }
+ capturedMap?.let { activeCapture?.consume(it) }
+ sink.write(payload)
+ seenSegments += segmentIdentity
+ capturedSegment?.let { activeCapture?.consume(it) }
+ bytesWritten += payload.size
+ newSegmentsThisRound = true
+ lastDataAt = System.currentTimeMillis()
+ val elapsedMs = (System.currentTimeMillis() - startMs).coerceAtLeast(1L)
+ onProgress(
+ CaptureProgress(
+ bytesWritten = bytesWritten,
+ averageThroughputBytesPerSecond = (bytesWritten * 1000L) / elapsedMs,
+ lastProgressAtMs = System.currentTimeMillis(),
+ retryCount = retryCount
+ )
)
- )
- if (System.currentTimeMillis() >= scheduledEndMs) return@forEach
+ if (System.currentTimeMillis() >= scheduledEndMs) break
+ }
+ sink.flush()
+ if (newSegmentsThisRound) retryCount = 0
+ if (playlist.endList) break
+ delay((playlist.targetDurationSeconds.coerceAtLeast(2) * 1000L) / 2L)
}
- sink.flush()
- if (newSegmentsThisRound) retryCount = 0
- if (playlist.endList) break
- delay((playlist.targetDurationSeconds.coerceAtLeast(2) * 1000L) / 2L)
}
}
}
+ } finally {
+ sharedHlsCapture?.close()
}
}
- private suspend fun fetchText(url: String, headers: Map<String, String>): String {
+ private suspend fun fetchText(
+ url: String,
+ headers: Map<String, String>,
+ client: OkHttpClient,
+ source: ResolvedRecordingSource
+ ): String {
val request = Request.Builder().url(url).apply {
headers.forEach { (key, value) -> header(key, value) }
}.build()
- okHttpClient.newCall(request).useCancellableResponse { response ->
- if (!response.isSuccessful) throw IOException("Recording stream failed with HTTP ${response.code}")
+ client.newCall(request).useCancellableResponse { response ->
+ checkRecordingResponse(response, source)
return response.body?.string().orEmpty()
}
}
- private suspend fun fetchBytes(url: String, headers: Map<String, String>): ByteArray {
+ private suspend fun fetchBytes(
+ url: String,
+ headers: Map<String, String>,
+ client: OkHttpClient,
+ source: ResolvedRecordingSource,
+ byteRange: HlsByteRange? = null
+ ): ByteArray {
+ val expectedRangeEndExclusive = byteRange?.let { range ->
+ if (range.offset < 0L || range.length <= 0L || range.length > MAX_HLS_RANGE_BYTES) {
+ throw IOException()
+ }
+ runCatching { Math.addExact(range.offset, range.length) }
+ .getOrElse { throw IOException() }
+ }
val request = Request.Builder().url(url).apply {
headers.forEach { (key, value) -> header(key, value) }
+ byteRange?.let { range ->
+ val endInclusive = requireNotNull(expectedRangeEndExclusive) - 1L
+ header("Range", "bytes=${range.offset}-$endInclusive")
+ }
}.build()
- okHttpClient.newCall(request).useCancellableResponse { response ->
- if (!response.isSuccessful) throw IOException("Recording stream failed with HTTP ${response.code}")
- return response.body?.bytes() ?: ByteArray(0)
+ client.newCall(request).useCancellableResponse { response ->
+ checkRecordingResponse(response, source)
+ val body = response.body ?: if (byteRange == null) return ByteArray(0) else throw IOException()
+ if (byteRange == null) return body.bytes()
+ val endExclusive = requireNotNull(expectedRangeEndExclusive)
+ if (response.code == 206) {
+ val bytes = body.bytes()
+ response.header("Content-Range")?.let { contentRange ->
+ val match = HLS_CONTENT_RANGE_PATTERN.matchEntire(contentRange.trim()) ?: throw IOException()
+ val actualStart = match.groupValues[1].toLongOrNull() ?: throw IOException()
+ val actualEndInclusive = match.groupValues[2].toLongOrNull() ?: throw IOException()
+ if (actualStart != byteRange.offset || actualEndInclusive != endExclusive - 1L) {
+ throw IOException()
+ }
+ }
+ if (bytes.size.toLong() != byteRange.length) throw IOException()
+ return bytes
+ }
+ return body.byteStream().use { input ->
+ readByteRange(input, byteRange.offset, byteRange.length)
+ }
}
}
+ private fun readByteRange(input: InputStream, offset: Long, length: Long): ByteArray {
+ val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
+ var skipped = 0L
+ while (skipped < offset) {
+ val requestedSkip = offset - skipped
+ val count = input.skip(requestedSkip)
+ if (count > 0L) {
+ skipped += count
+ } else {
+ val read = input.read(buffer, 0, minOf(buffer.size.toLong(), requestedSkip).toInt())
+ if (read < 0) throw IOException()
+ skipped += read
+ }
+ }
+
+ val output = ByteArrayOutputStream(minOf(length, DEFAULT_BUFFER_SIZE.toLong()).toInt())
+ var remaining = length
+ while (remaining > 0L) {
+ val read = input.read(buffer, 0, minOf(buffer.size.toLong(), remaining).toInt())
+ if (read < 0) throw IOException()
+ output.write(buffer, 0, read)
+ remaining -= read
+ }
+ return output.toByteArray()
+ }
+
+ private suspend fun resolveKeyBytes(
+ key: HlsKey,
+ capture: LivePlaybackByteTap.HlsCapture?,
+ keyCache: MutableMap<String, ByteArray>,
+ headers: Map<String, String>,
+ client: OkHttpClient,
+ source: ResolvedRecordingSource
+ ): ByteArray? {
+ keyCache[key.uri]?.let { return it }
+ val bytes = if (capture != null) {
+ capture.throwIfFailed()
+ capture.resource(key.uri)?.bytes
+ } else {
+ fetchBytes(key.uri, headers, client, source)
+ } ?: return null
+ keyCache[key.uri] = bytes
+ return bytes
+ }
+
private fun decryptAes128(payload: ByteArray, keyBytes: ByteArray, ivHex: String?, mediaSequenceNumber: Long): ByteArray {
val iv = if (ivHex != null) {
ivHex.removePrefix("0x")
@@ -274,7 +570,12 @@ class HlsLiveCaptureEngine @Inject constructor(
return cipher.doFinal(payload)
}
- private fun parsePlaylist(baseUrl: String, rawText: String, maxVideoHeight: Int? = null): ParsedHlsPlaylist {
+ private fun parsePlaylist(
+ baseUrl: String,
+ rawText: String,
+ maxVideoHeight: Int? = null,
+ byteRangeState: HlsByteRangeState
+ ): ParsedHlsPlaylist {
val lines = rawText.lineSequence().map(String::trim).filter { it.isNotEmpty() }.toList()
if (lines.any { it.startsWith("#EXT-X-STREAM-INF", ignoreCase = true) }) {
data class HlsVariant(val bandwidth: Int, val height: Int?, val url: String)
@@ -298,14 +599,22 @@ class HlsLiveCaptureEngine @Inject constructor(
}
val bestVariantUrl = eligible.maxByOrNull { it.bandwidth }?.url
?: throw IOException("No playable HLS variants were available.")
- return ParsedHlsPlaylist.Master(bestVariantUrl)
+ return ParsedHlsPlaylist.Master(
+ bestVariantUrl = bestVariantUrl,
+ variantUrls = variants.map { it.url }
+ )
}
var targetDuration = 6
var endList = false
var currentKey: HlsKey? = null
+ var currentMap: HlsInitializationSection? = null
var mediaSequence = 0L
val segments = mutableListOf<HlsSegment>()
+ val previousSegmentRangeEndByUri = mutableMapOf<String, Long>()
+ val previousMapRangeEndByUri = mutableMapOf<String, Long>()
+ val mapRangeOccurrenceCounts = mutableMapOf<String, Int>()
+ var pendingSegmentByteRange: HlsByteRangeDeclaration? = null
var segmentIndex = 0L
lines.forEach { line ->
when {
@@ -327,13 +636,52 @@ class HlsLiveCaptureEngine @Inject constructor(
iv = attrs["IV"]
)
}
+ line.startsWith("#EXT-X-MAP", ignoreCase = true) -> {
+ val attrs = parseHlsAttributes(line.substringAfter(':'))
+ val mapUrl = attrs["URI"]
+ ?.let { resolveRelativeUrl(baseUrl, it) }
+ ?: throw IOException()
+ val mapRange = attrs["BYTERANGE"]?.let { range ->
+ byteRangeState.resolveMapRange(
+ declaration = parseByteRangeDeclaration(range),
+ resourceUrl = mapUrl,
+ previousRangeEnd = previousMapRangeEndByUri[mapUrl],
+ key = currentKey,
+ occurrenceCounts = mapRangeOccurrenceCounts
+ )
+ }
+ mapRange?.let { previousMapRangeEndByUri[mapUrl] = it.endExclusive() }
+ currentMap = HlsInitializationSection(
+ uri = mapUrl,
+ byteRange = mapRange,
+ key = currentKey?.copy(),
+ mediaSequenceNumber = mediaSequence
+ )
+ }
+ line.startsWith("#EXT-X-BYTERANGE", ignoreCase = true) -> {
+ pendingSegmentByteRange = parseByteRangeDeclaration(line.substringAfter(':'))
+ }
line.startsWith("#") -> Unit
else -> {
+ val segmentUrl = resolveRelativeUrl(baseUrl, line)
+ val segmentSequence = mediaSequence + segmentIndex
+ val segmentRange = pendingSegmentByteRange?.let { declaration ->
+ byteRangeState.resolveSegmentRange(
+ declaration = declaration,
+ resourceUrl = segmentUrl,
+ sequenceNumber = segmentSequence,
+ previousRangeEnd = previousSegmentRangeEndByUri[segmentUrl]
+ )
+ }
+ segmentRange?.let { previousSegmentRangeEndByUri[segmentUrl] = it.endExclusive() }
segments += HlsSegment(
- uri = resolveRelativeUrl(baseUrl, line),
+ uri = segmentUrl,
key = currentKey?.copy(),
- mediaSequenceNumber = mediaSequence + segmentIndex
+ mediaSequenceNumber = segmentSequence,
+ byteRange = segmentRange,
+ initializationSection = currentMap?.copy()
)
+ pendingSegmentByteRange = null
segmentIndex++
}
}
@@ -347,24 +695,61 @@ class HlsLiveCaptureEngine @Inject constructor(
private fun parseHlsAttributes(raw: String): Map<String, String> {
val attrs = mutableMapOf<String, String>()
- val parts = raw.split(',')
- parts.forEach { part ->
- val key = part.substringBefore('=').trim()
- val value = part.substringAfter('=', "").trim().removeSurrounding("\"")
- if (key.isNotBlank()) {
- attrs[key.uppercase(Locale.ROOT)] = value
+ var cursor = 0
+ while (cursor < raw.length) {
+ while (cursor < raw.length && (raw[cursor] == ',' || raw[cursor].isWhitespace())) cursor++
+ val keyStart = cursor
+ while (cursor < raw.length && raw[cursor] != '=' && raw[cursor] != ',') cursor++
+ val key = raw.substring(keyStart, cursor).trim()
+ if (cursor >= raw.length || raw[cursor] != '=') {
+ while (cursor < raw.length && raw[cursor] != ',') cursor++
+ continue
+ }
+ cursor++
+ while (cursor < raw.length && raw[cursor].isWhitespace()) cursor++
+ val value = if (cursor < raw.length && raw[cursor] == '"') {
+ cursor++
+ val valueStart = cursor
+ while (cursor < raw.length && raw[cursor] != '"') {
+ if (raw[cursor] == '\\' && cursor + 1 < raw.length) cursor++
+ cursor++
+ }
+ raw.substring(valueStart, cursor).replace("\\\"", "\"").also {
+ if (cursor < raw.length) cursor++
+ }
+ } else {
+ val valueStart = cursor
+ while (cursor < raw.length && raw[cursor] != ',') cursor++
+ raw.substring(valueStart, cursor).trim()
}
+ if (key.isNotBlank()) attrs[key.uppercase(Locale.ROOT)] = value
}
return attrs
}
+ private fun parseByteRangeDeclaration(raw: String): HlsByteRangeDeclaration {
+ val length = raw.substringBefore('@').trim().toLongOrNull()
+ ?.takeIf { it > 0L }
+ ?: throw IOException()
+ val offset = raw.substringAfter('@', missingDelimiterValue = "")
+ .takeIf { it.isNotBlank() }
+ ?.trim()
+ ?.toLongOrNull()
+ ?.takeIf { it >= 0L }
+ if ('@' in raw && offset == null) throw IOException()
+ return HlsByteRangeDeclaration(length = length, offset = offset)
+ }
+
private fun resolveRelativeUrl(baseUrl: String, value: String): String {
return runCatching { URI(baseUrl).resolve(value).toString() }.getOrDefault(value)
}
}
private sealed interface ParsedHlsPlaylist {
- data class Master(val bestVariantUrl: String) : ParsedHlsPlaylist
+ data class Master(
+ val bestVariantUrl: String,
+ val variantUrls: List<String>
+ ) : ParsedHlsPlaylist
data class Media(
val targetDurationSeconds: Int,
val endList: Boolean,
@@ -375,9 +760,120 @@ private sealed interface ParsedHlsPlaylist {
private data class HlsSegment(
val uri: String,
val key: HlsKey? = null,
+ val mediaSequenceNumber: Long = 0,
+ val byteRange: HlsByteRange? = null,
+ val initializationSection: HlsInitializationSection? = null
+)
+
+private data class HlsInitializationSection(
+ val uri: String,
+ val byteRange: HlsByteRange? = null,
+ val key: HlsKey? = null,
val mediaSequenceNumber: Long = 0
)
+private data class HlsByteRange(
+ val offset: Long,
+ val length: Long
+) {
+ fun endExclusive(): Long = runCatching { Math.addExact(offset, length) }
+ .getOrElse { throw IOException() }
+}
+
+private data class HlsByteRangeDeclaration(
+ val length: Long,
+ val offset: Long?
+)
+
+private data class HlsSegmentRangeKey(
+ val sequenceNumber: Long,
+ val resourceUrl: String
+)
+
+private class HlsByteRangeState {
+ private val segmentRanges = LinkedHashMap<HlsSegmentRangeKey, HlsByteRange>()
+ private val latestSegmentRangeByUrl = LinkedHashMap<String, Pair<Long, HlsByteRange>>()
+ private val mapRangesBySignature = LinkedHashMap<String, MutableList<HlsByteRange>>()
+ private val latestMapRangeByUrl = LinkedHashMap<String, HlsByteRange>()
+
+ fun resolveSegmentRange(
+ declaration: HlsByteRangeDeclaration,
+ resourceUrl: String,
+ sequenceNumber: Long,
+ previousRangeEnd: Long?
+ ): HlsByteRange {
+ val key = HlsSegmentRangeKey(sequenceNumber, resourceUrl)
+ val knownRange = segmentRanges[key]
+ val priorRangeEnd = previousRangeEnd
+ ?: latestSegmentRangeByUrl[resourceUrl]
+ ?.takeIf { (knownSequence, _) -> knownSequence < sequenceNumber }
+ ?.second
+ ?.endExclusive()
+ val range = resolveRange(declaration, knownRange, priorRangeEnd)
+ segmentRanges[key] = range
+ while (segmentRanges.size > MAX_RANGE_HISTORY) {
+ segmentRanges.remove(segmentRanges.keys.first())
+ }
+ val latest = latestSegmentRangeByUrl[resourceUrl]
+ if (latest == null || sequenceNumber >= latest.first) {
+ latestSegmentRangeByUrl[resourceUrl] = sequenceNumber to range
+ }
+ while (latestSegmentRangeByUrl.size > MAX_RANGE_HISTORY) {
+ latestSegmentRangeByUrl.remove(latestSegmentRangeByUrl.keys.first())
+ }
+ return range
+ }
+
+ fun resolveMapRange(
+ declaration: HlsByteRangeDeclaration,
+ resourceUrl: String,
+ previousRangeEnd: Long?,
+ key: HlsKey?,
+ occurrenceCounts: MutableMap<String, Int>
+ ): HlsByteRange {
+ val signature = listOf(
+ resourceUrl,
+ declaration.length.toString(),
+ key?.method.orEmpty(),
+ key?.uri.orEmpty(),
+ key?.iv.orEmpty()
+ ).joinToString("\u0000")
+ val occurrence = occurrenceCounts.getOrDefault(signature, 0)
+ occurrenceCounts[signature] = occurrence + 1
+ val knownRange = mapRangesBySignature[signature]?.getOrNull(occurrence)
+ val offset = declaration.offset
+ ?: previousRangeEnd
+ ?: knownRange?.offset
+ ?: latestMapRangeByUrl[resourceUrl]?.endExclusive()
+ ?: throw IOException()
+ val range = HlsByteRange(offset, declaration.length).also { it.endExclusive() }
+ val rangesForSignature = mapRangesBySignature.getOrPut(signature) { mutableListOf() }
+ while (rangesForSignature.size <= occurrence) rangesForSignature += range
+ rangesForSignature[occurrence] = range
+ latestMapRangeByUrl[resourceUrl] = range
+ while (mapRangesBySignature.size > MAX_RANGE_HISTORY) {
+ mapRangesBySignature.remove(mapRangesBySignature.keys.first())
+ }
+ while (latestMapRangeByUrl.size > MAX_RANGE_HISTORY) {
+ latestMapRangeByUrl.remove(latestMapRangeByUrl.keys.first())
+ }
+ return range
+ }
+
+ private fun resolveRange(
+ declaration: HlsByteRangeDeclaration,
+ knownRange: HlsByteRange?,
+ previousRangeEnd: Long?
+ ): HlsByteRange {
+ val offset = declaration.offset ?: knownRange?.offset ?: previousRangeEnd ?: throw IOException()
+ return HlsByteRange(offset, declaration.length).also { it.endExclusive() }
+ }
+
+ private companion object {
+ const val MAX_RANGE_HISTORY = 10_000
+ }
+}
+
private data class HlsKey(
val method: String,
val uri: String,
diff --git a/data/src/main/java/com/streamvault/data/manager/recording/RecordingNetworkProfile.kt b/data/src/main/java/com/streamvault/data/manager/recording/RecordingNetworkProfile.kt
new file mode 100644
index 00000000..2efac473
--- /dev/null
+++ b/data/src/main/java/com/streamvault/data/manager/recording/RecordingNetworkProfile.kt
@@ -0,0 +1,80 @@
+package com.streamvault.data.manager.recording
+
+import com.streamvault.domain.model.PlaybackTransportMode
+import com.streamvault.domain.model.PlaybackTransportPolicy
+import com.streamvault.domain.model.StalkerTransportOrigin
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonNull
+import kotlinx.serialization.json.JsonObject
+import kotlinx.serialization.json.JsonPrimitive
+import kotlinx.serialization.json.booleanOrNull
+import kotlinx.serialization.json.buildJsonObject
+import kotlinx.serialization.json.contentOrNull
+import kotlinx.serialization.json.intOrNull
+import kotlinx.serialization.json.int
+import kotlinx.serialization.json.jsonObject
+import kotlinx.serialization.json.jsonPrimitive
+import kotlinx.serialization.json.put
+import okhttp3.OkHttpClient
+
+/** Network settings that playback applies to this provider-resolved stream. */
+data class RecordingNetworkProfile(
+ val playbackTransportPolicy: PlaybackTransportPolicy? = null,
+ val allowInvalidSsl: Boolean = false,
+ val proxyHost: String = "",
+ val proxyPort: Int? = null
+) {
+ fun toJson(): String = Json.encodeToString(
+ buildJsonObject {
+ put("allowInvalidSsl", allowInvalidSsl)
+ put("proxyHost", proxyHost)
+ put("proxyPort", proxyPort?.let(::JsonPrimitive) ?: JsonNull)
+ put("playbackTransportPolicy", playbackTransportPolicy?.toJsonElement() ?: JsonNull)
+ }
+ )
+
+ companion object {
+ fun fromJson(raw: String?): RecordingNetworkProfile = runCatching {
+ val root = Json.parseToJsonElement(raw.orEmpty()).jsonObject
+ RecordingNetworkProfile(
+ playbackTransportPolicy = root["playbackTransportPolicy"]
+ ?.takeUnless { it == JsonNull }
+ ?.jsonObject
+ ?.toTransportPolicy(),
+ allowInvalidSsl = root["allowInvalidSsl"]?.jsonPrimitive?.booleanOrNull ?: false,
+ proxyHost = root["proxyHost"]?.jsonPrimitive?.contentOrNull.orEmpty(),
+ proxyPort = root["proxyPort"]?.jsonPrimitive?.intOrNull?.takeIf { it in 1..65535 }
+ )
+ }.getOrDefault(RecordingNetworkProfile())
+ }
+}
+
+fun interface RecordingHttpClientFactory {
+ fun create(profile: RecordingNetworkProfile): OkHttpClient
+}
+
+private fun PlaybackTransportPolicy.toJsonElement(): JsonObject = buildJsonObject {
+ put("mode", mode.name)
+ put("origin", buildJsonObject {
+ put("scheme", origin.scheme)
+ put("host", origin.host)
+ put("port", origin.port)
+ })
+ put("spkiSha256", spkiSha256?.let(::JsonPrimitive) ?: JsonNull)
+ put("allowCrossOriginHttpRedirects", allowCrossOriginHttpRedirects)
+}
+
+private fun JsonObject.toTransportPolicy(): PlaybackTransportPolicy? = runCatching {
+ val originJson = getValue("origin").jsonObject
+ PlaybackTransportPolicy(
+ mode = PlaybackTransportMode.valueOf(getValue("mode").jsonPrimitive.content),
+ origin = StalkerTransportOrigin(
+ scheme = originJson.getValue("scheme").jsonPrimitive.content,
+ host = originJson.getValue("host").jsonPrimitive.content,
+ port = originJson.getValue("port").jsonPrimitive.int
+ ),
+ spkiSha256 = get("spkiSha256")?.jsonPrimitive?.contentOrNull?.takeUnless { it.isBlank() },
+ allowCrossOriginHttpRedirects = get("allowCrossOriginHttpRedirects")?.jsonPrimitive?.booleanOrNull ?: false
+ )
+}.getOrNull()
diff --git a/data/src/main/java/com/streamvault/data/manager/recording/RecordingSourceResolver.kt b/data/src/main/java/com/streamvault/data/manager/recording/RecordingSourceResolver.kt
index 152f4e72..641b44e2 100644
--- a/data/src/main/java/com/streamvault/data/manager/recording/RecordingSourceResolver.kt
+++ b/data/src/main/java/com/streamvault/data/manager/recording/RecordingSourceResolver.kt
@@ -1,12 +1,18 @@
package com.streamvault.data.manager.recording
import com.streamvault.data.local.dao.ProviderDao
+import com.streamvault.data.local.dao.ChannelDao
import com.streamvault.data.remote.http.useCancellableResponse
import com.streamvault.data.remote.xtream.ResolvedStreamUrl
import com.streamvault.data.remote.xtream.XtreamStreamUrlResolver
+import com.streamvault.data.repository.withM3uPlaybackMetadata
import com.streamvault.domain.model.ContentType
+import com.streamvault.domain.model.LivePlaybackIdentity
import com.streamvault.domain.model.RecordingFailureCategory
import com.streamvault.domain.model.RecordingSourceType
+import com.streamvault.domain.model.StreamInfo
+import com.streamvault.domain.model.StreamType
+import com.streamvault.domain.util.effectiveHttpRequestProperties
import java.io.IOException
import java.util.Locale
import javax.inject.Inject
@@ -20,6 +26,8 @@ data class ResolvedRecordingSource(
val sourceType: RecordingSourceType,
val headers: Map<String, String> = emptyMap(),
val userAgent: String? = null,
+ val networkProfile: RecordingNetworkProfile = RecordingNetworkProfile(),
+ val livePlaybackIdentity: LivePlaybackIdentity? = null,
val expirationTime: Long? = null,
val providerLabel: String? = null,
val failureCategory: RecordingFailureCategory = RecordingFailureCategory.NONE
@@ -27,9 +35,10 @@ data class ResolvedRecordingSource(
@Singleton
class RecordingSourceResolver @Inject constructor(
- private val okHttpClient: OkHttpClient,
+ private val recordingHttpClientFactory: RecordingHttpClientFactory,
private val providerDao: ProviderDao,
- private val xtreamStreamUrlResolver: XtreamStreamUrlResolver
+ private val xtreamStreamUrlResolver: XtreamStreamUrlResolver,
+ private val channelDao: ChannelDao
) {
suspend fun resolveLiveSource(
@@ -57,18 +66,50 @@ class RecordingSourceResolver @Inject constructor(
else -> provider.name
}
}
- val inferred = sniffSourceType(resolved)
- return ResolvedRecordingSource(
+ val networkProfile = RecordingNetworkProfile(
+ playbackTransportPolicy = resolved.playbackTransportPolicy,
+ allowInvalidSsl = resolved.allowInvalidSsl,
+ proxyHost = resolved.proxyHost,
+ proxyPort = resolved.proxyPort
+ )
+ val channel = channelDao.getById(channelId)
+ ?.takeIf { it.providerId == providerId }
+ ?: channelDao.getByStreamId(providerId, channelId)
+ val playbackInfo = StreamInfo(
url = resolved.url,
- sourceType = inferred,
headers = resolved.headers,
userAgent = resolved.userAgent,
+ playbackTransportPolicy = resolved.playbackTransportPolicy,
+ allowInvalidSsl = resolved.allowInvalidSsl,
+ proxyHost = resolved.proxyHost,
+ proxyPort = resolved.proxyPort,
+ streamType = StreamType.fromContainerExtension(resolved.containerExtension),
+ containerExtension = resolved.containerExtension,
+ expirationTime = resolved.expirationTime
+ ).withM3uPlaybackMetadata(channel?.playbackMetadataJson)
+ val recordingResolved = resolved.copy(
+ headers = playbackInfo.headers,
+ userAgent = playbackInfo.userAgent
+ )
+ val client = recordingHttpClientFactory.create(networkProfile)
+ val inferred = playbackInfo.streamType.toRecordingSourceType() ?: sniffSourceType(recordingResolved, client)
+ return ResolvedRecordingSource(
+ url = resolved.url,
+ sourceType = inferred,
+ headers = playbackInfo.headers,
+ userAgent = playbackInfo.userAgent,
+ networkProfile = networkProfile,
+ livePlaybackIdentity = if (providerId > 0L && channelId > 0L) {
+ LivePlaybackIdentity(providerId, channelId)
+ } else {
+ null
+ },
expirationTime = resolved.expirationTime,
providerLabel = providerLabel
)
}
- private suspend fun sniffSourceType(resolved: ResolvedStreamUrl): RecordingSourceType {
+ private suspend fun sniffSourceType(resolved: ResolvedStreamUrl, client: OkHttpClient): RecordingSourceType {
// Prefer the container extension reported by the URL resolver (e.g. from the
// Xtream internal token) — this avoids a network probe that many IPTV servers
// reject with 404/416 when a Range header is present.
@@ -85,15 +126,15 @@ class RecordingSourceResolver @Inject constructor(
url.contains(".mpd") || url.contains("ext=mpd") -> RecordingSourceType.DASH
url.endsWith(".ts") || url.contains(".ts?") || url.contains("ext=ts") -> RecordingSourceType.TS
url.endsWith(".m3u8") || url.contains(".m3u8?") || url.contains("ext=m3u8") -> RecordingSourceType.HLS
- else -> probeAdaptiveType(resolved)
+ else -> probeAdaptiveType(resolved, client)
}
}
- private suspend fun probeAdaptiveType(resolved: ResolvedStreamUrl): RecordingSourceType {
+ private suspend fun probeAdaptiveType(resolved: ResolvedStreamUrl, client: OkHttpClient): RecordingSourceType {
// Try HEAD first — lighter and avoids Range-header rejections.
val headResult = try {
val headRequest = buildRequest(resolved, isHead = true)
- okHttpClient.newCall(headRequest).useCancellableResponse { response ->
+ client.newCall(headRequest).useCancellableResponse { response ->
if (!response.isSuccessful) return@useCancellableResponse null
val contentType = response.header("Content-Type").orEmpty().lowercase(Locale.ROOT)
when {
@@ -114,7 +155,7 @@ class RecordingSourceResolver @Inject constructor(
val request = buildRequest(resolved, isHead = false)
val bodyPrefix = try {
- okHttpClient.newCall(request).useCancellableResponse { response ->
+ client.newCall(request).useCancellableResponse { response ->
if (!response.isSuccessful) return@useCancellableResponse ""
val contentType = response.header("Content-Type").orEmpty().lowercase(Locale.ROOT)
when {
@@ -141,8 +182,7 @@ class RecordingSourceResolver @Inject constructor(
return Request.Builder()
.url(resolved.url)
.apply {
- resolved.userAgent?.takeIf { it.isNotBlank() }?.let { header("User-Agent", it) }
- resolved.headers.forEach { (name, value) ->
+ effectiveHttpRequestProperties(resolved.headers, resolved.userAgent).forEach { (name, value) ->
header(name, value)
}
if (isHead) {
@@ -154,3 +194,10 @@ class RecordingSourceResolver @Inject constructor(
.build()
}
}
+
+private fun StreamType.toRecordingSourceType(): RecordingSourceType? = when (this) {
+ StreamType.HLS -> RecordingSourceType.HLS
+ StreamType.DASH -> RecordingSourceType.DASH
+ StreamType.MPEG_TS -> RecordingSourceType.TS
+ else -> null
+}
diff --git a/data/src/main/java/com/streamvault/data/manager/recording/RecordingSupport.kt b/data/src/main/java/com/streamvault/data/manager/recording/RecordingSupport.kt
index 65ddcd81..49dc3f9e 100644
--- a/data/src/main/java/com/streamvault/data/manager/recording/RecordingSupport.kt
+++ b/data/src/main/java/com/streamvault/data/manager/recording/RecordingSupport.kt
@@ -14,6 +14,7 @@ import com.streamvault.domain.model.RecordingFailureCategory
import com.streamvault.domain.model.RecordingItem
import com.streamvault.domain.model.RecordingStorageConfig
import com.streamvault.domain.model.RecordingStorageState
+import com.streamvault.domain.util.LivePlaybackCaptureBackpressureException
import java.io.File
import java.io.FileOutputStream
import java.text.SimpleDateFormat
@@ -112,6 +113,7 @@ internal fun headersFromJson(raw: String?): Map<String, String> {
internal fun inferFailureCategory(error: Throwable?, fallback: RecordingFailureCategory = RecordingFailureCategory.UNKNOWN): RecordingFailureCategory {
if (error is UnsupportedRecordingException) return error.category
+ if (error is LivePlaybackCaptureBackpressureException) return RecordingFailureCategory.STORAGE
val rootCause = error?.cause ?: error
when (rootCause) {
is java.net.SocketTimeoutException,
diff --git a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt
index 41c41bdc..9f7705b3 100644
--- a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt
+++ b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt
@@ -23,6 +23,7 @@ import com.streamvault.domain.model.Channel
import com.streamvault.domain.model.ChannelNumberingMode
import com.streamvault.domain.model.ChannelQualityOption
import com.streamvault.domain.model.ContentType
+import com.streamvault.domain.model.LivePlaybackIdentity
import com.streamvault.domain.model.GroupedChannelLabelMode
import com.streamvault.domain.model.LiveChannelGroupingMode
import com.streamvault.domain.model.LiveChannelObservedQuality
@@ -302,7 +303,8 @@ class ChannelRepositoryImpl @Inject constructor(
streamType = StreamType.fromContainerExtension(resolvedStream.containerExtension),
containerExtension = resolvedStream.containerExtension,
expirationTime = resolvedStream.expirationTime,
- playbackContentKind = PlaybackContentKind.LIVE
+ playbackContentKind = PlaybackContentKind.LIVE,
+ livePlaybackIdentity = LivePlaybackIdentity(channel.providerId, channel.id)
).withM3uPlaybackMetadata(persistedChannel?.playbackMetadataJson)
)
} ?: Result.error("No stream URL available for channel: ${channel.name}")
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 50e7fe81..763eb9c8 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -16,6 +16,7 @@ All notable product changes are recorded in this document.
- Added AVC/H.264 fallback for eligible HEVC episodes, preserving playback position, audio, subtitles, and episode history.
- Added durable retries for failed Stalker live categories, scoped to the current provider configuration and visible categories, with retry promotion and cleanup committed atomically (Room migration v80 to v81).
- Added SMB2/SMB3 share destinations for DVR recordings, with encrypted device-side credentials and in-app playback and deletion.
+- Added live recording controls and HLS capture while watching through a shared connection, including byte-range and fragmented MP4 streams.
- Added Stalker provider setup from supported Stalker playback or export URLs in the URL tab by detecting the portal and MAC address.
- Added global and per-title VOD audio and subtitle preferences to portable backups, while preserving compatibility with earlier backup files.
- Added configurable automatic provider sync in Settings, with global defaults and per-provider overrides for content sections, catalog and guide intervals, network, charging, idle, and preferred run times. It is enabled by default for saved providers, with catalogs refreshed every 24 hours and guides every 6 hours, and shows refresh status and timestamps.
diff --git a/domain/src/main/java/com/streamvault/domain/model/LivePlaybackIdentity.kt b/domain/src/main/java/com/streamvault/domain/model/LivePlaybackIdentity.kt
new file mode 100644
index 00000000..0a712918
--- /dev/null
+++ b/domain/src/main/java/com/streamvault/domain/model/LivePlaybackIdentity.kt
@@ -0,0 +1,12 @@
+package com.streamvault.domain.model
+
+/** Stable provider-scoped identity for a live channel while it is playing or recording. */
+data class LivePlaybackIdentity(
+ val providerId: Long,
+ val channelId: Long
+) {
+ init {
+ require(providerId > 0L) { "Live playback providerId must be positive" }
+ require(channelId > 0L) { "Live playback channelId must be positive" }
+ }
+}
diff --git a/domain/src/main/java/com/streamvault/domain/model/RecordingModels.kt b/domain/src/main/java/com/streamvault/domain/model/RecordingModels.kt
index fbdd2f5d..1d482977 100644
--- a/domain/src/main/java/com/streamvault/domain/model/RecordingModels.kt
+++ b/domain/src/main/java/com/streamvault/domain/model/RecordingModels.kt
@@ -28,6 +28,11 @@ enum class RecordingFailureCategory {
UNKNOWN
}
+/** Stable persisted code for a localized recording failure detail. */
+object RecordingFailureReasonCodes {
+ const val LIVE_CAPTURE_OUTPUT_TOO_SLOW = "streamvault:live_capture_output_too_slow"
+}
+
enum class RecordingRecurrence {
NONE,
DAILY,
diff --git a/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt b/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt
index 675e6539..834075e9 100644
--- a/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt
+++ b/domain/src/main/java/com/streamvault/domain/model/StreamInfo.kt
@@ -20,7 +20,9 @@ data class StreamInfo(
val catchUpUrl: String? = null,
val expirationTime: Long? = null,
val drmInfo: DrmInfo? = null,
- val playbackContentKind: PlaybackContentKind = PlaybackContentKind.UNKNOWN
+ val playbackContentKind: PlaybackContentKind = PlaybackContentKind.UNKNOWN,
+ /** Provider/channel identity used to join a live recording to the active playback request. */
+ val livePlaybackIdentity: LivePlaybackIdentity? = null
) {
init {
require(url.isNotBlank()) { "StreamInfo url must not be blank" }
diff --git a/domain/src/main/java/com/streamvault/domain/util/HttpRequestProperties.kt b/domain/src/main/java/com/streamvault/domain/util/HttpRequestProperties.kt
new file mode 100644
index 00000000..4bae212a
--- /dev/null
+++ b/domain/src/main/java/com/streamvault/domain/util/HttpRequestProperties.kt
@@ -0,0 +1,17 @@
+package com.streamvault.domain.util
+
+/** Applies an explicit User-Agent with the same precedence to every HTTP playback request. */
+fun effectiveHttpRequestProperties(
+ headers: Map<String, String>,
+ userAgent: String?
+): Map<String, String> {
+ val normalizedUserAgent = userAgent?.trim().orEmpty()
+ if (normalizedUserAgent.isBlank()) return headers
+
+ return buildMap(headers.size + 1) {
+ headers.forEach { (name, value) ->
+ if (!name.equals("User-Agent", ignoreCase = true)) put(name, value)
+ }
+ put("User-Agent", normalizedUserAgent)
+ }
+}
diff --git a/domain/src/main/java/com/streamvault/domain/util/LivePlaybackByteTap.kt b/domain/src/main/java/com/streamvault/domain/util/LivePlaybackByteTap.kt
new file mode 100644
index 00000000..dd34417e
--- /dev/null
+++ b/domain/src/main/java/com/streamvault/domain/util/LivePlaybackByteTap.kt
@@ -0,0 +1,592 @@
+package com.streamvault.domain.util
+
+import com.streamvault.domain.model.LivePlaybackIdentity
+import java.io.ByteArrayOutputStream
+import java.io.Closeable
+import java.io.IOException
+import java.security.MessageDigest
+import java.util.concurrent.ScheduledThreadPoolExecutor
+import java.util.concurrent.TimeUnit
+import javax.inject.Inject
+import javax.inject.Singleton
+import kotlinx.coroutines.channels.Channel
+
+private data class LivePlaybackSubscriber(
+ val id: Long,
+ val channel: Channel<ByteArray>,
+ var bytesToPacketBoundary: Int
+)
+
+private data class CachedHlsResource(
+ val id: Long,
+ val url: String,
+ val aliases: Set<HlsResourceKey>,
+ val bytes: ByteArray,
+ val updatedAtMs: Long,
+ val isPlaylist: Boolean
+)
+
+private data class HlsResourceKey(
+ val url: String,
+ val rangeStart: Long,
+ val rangeLength: Long
+)
+
+private fun ByteArray.looksLikeHlsPlaylist(): Boolean {
+ var offset = if (
+ size >= 3 && this[0] == 0xEF.toByte() && this[1] == 0xBB.toByte() && this[2] == 0xBF.toByte()
+ ) {
+ 3
+ } else {
+ 0
+ }
+ while (offset < size && this[offset].toInt() in HLS_WHITESPACE_BYTES) offset++
+ val marker = "#EXTM3U"
+ if (size - offset < marker.length) return false
+ return marker.indices.all { index -> this[offset + index].toInt().toChar() == marker[index] }
+}
+
+private fun ByteArray.looksLikeText(): Boolean = all { byte ->
+ val value = byte.toInt() and 0xFF
+ value in 0x09..0x0D || value in 0x20..0x7E
+}
+
+private val HLS_WHITESPACE_BYTES = setOf(' '.code, '\t'.code, '\n'.code, '\r'.code)
+
+class LivePlaybackCaptureBackpressureException : IOException(
+ "Live playback capture exceeded its bounded buffer."
+)
+
+/**
+ * Shares foreground live data with matching recordings without opening another upstream request.
+ * MPEG-TS uses bounded queues and HLS uses a bounded response cache. Capture failure is explicit
+ * instead of dropping data or making the player wait for the recording output.
+ */
+@Singleton
+class LivePlaybackByteTap @Inject constructor() {
+ private data class SourceKey(
+ val identity: LivePlaybackIdentity,
+ val requestFingerprint: String
+ )
+
+ interface Publisher : Closeable {
+ fun publish(buffer: ByteArray, offset: Int, length: Int)
+ }
+
+ interface Capture : Closeable {
+ suspend fun readChunk(): ByteArray?
+ }
+
+ interface HlsPublisher : Closeable {
+ fun publish(buffer: ByteArray, offset: Int, length: Int)
+ fun complete()
+ }
+
+ interface HlsCapture : Closeable {
+ fun resource(url: String, rangeStart: Long = 0L, rangeLength: Long = -1L): HlsResource?
+ fun newestResource(urls: Collection<String>): HlsResource?
+ fun recordingResource(url: String, rangeStart: Long = 0L, rangeLength: Long = -1L): HlsResource?
+ fun consume(resource: HlsResource)
+ fun isPlaybackActive(): Boolean
+ fun throwIfFailed()
+ }
+
+ data class HlsResource(
+ val resourceId: Long,
+ val url: String,
+ val bytes: ByteArray,
+ val updatedAtMs: Long,
+ val isPlaylist: Boolean,
+ val rangeStart: Long = 0L,
+ val rangeLength: Long = -1L
+ )
+
+ private val activeSources = HashMap<SourceKey, SourceSession>()
+ private val activeHlsSources = HashMap<SourceKey, HlsSourceSession>()
+ private val hlsCleanupExecutor = ScheduledThreadPoolExecutor(1) { task ->
+ Thread(task, "LivePlaybackHlsTapCleanup").apply { isDaemon = true }
+ }
+
+ fun begin(
+ identity: LivePlaybackIdentity,
+ requestFingerprint: String
+ ): Publisher {
+ val key = SourceKey(identity, requestFingerprint)
+ val session = SourceSession(key)
+ val replaced = synchronized(activeSources) { activeSources.put(key, session) }
+ replaced?.finish()
+ return session
+ }
+
+ fun attach(
+ identity: LivePlaybackIdentity,
+ requestFingerprint: String
+ ): Capture? {
+ val session = synchronized(activeSources) {
+ activeSources[SourceKey(identity, requestFingerprint)]
+ } ?: return null
+ return session.attach()
+ }
+
+ /**
+ * Publishes one complete HLS playlist, segment, or key response from foreground playback.
+ * HLS resources are cached because playlist parsing and segment assembly happen at a different
+ * pace from Media3's requests. The cache is bounded and never blocks the player thread.
+ */
+ fun beginHlsResource(
+ identity: LivePlaybackIdentity,
+ requestFingerprint: String,
+ requestedUrl: String,
+ resolvedUrl: String,
+ isPlaylist: Boolean,
+ rangeStart: Long = 0L,
+ rangeLength: Long = -1L
+ ): HlsPublisher {
+ val key = SourceKey(identity, requestFingerprint)
+ val nowMs = elapsedRealtimeMs()
+ val session = synchronized(activeHlsSources) {
+ activeHlsSources.entries.removeAll { (activeKey, activeSession) ->
+ activeKey != key && activeSession.isExpiredForRegistry(nowMs)
+ }
+ activeHlsSources[key]
+ ?.takeIf { it.canReuse(nowMs) }
+ ?: HlsSourceSession(key).also { activeHlsSources[key] = it }
+ }
+ return session.beginResource(
+ requestedUrl = requestedUrl,
+ resolvedUrl = resolvedUrl,
+ isPlaylist = isPlaylist,
+ rangeStart = rangeStart,
+ rangeLength = rangeLength
+ ).also {
+ scheduleHlsCleanup(session)
+ }
+ }
+
+ fun attachHls(
+ identity: LivePlaybackIdentity,
+ requestFingerprint: String
+ ): HlsCapture? {
+ val nowMs = elapsedRealtimeMs()
+ val session = synchronized(activeHlsSources) {
+ activeHlsSources.entries.removeAll { (activeKey, activeSession) ->
+ activeKey != SourceKey(identity, requestFingerprint) &&
+ activeSession.isExpiredForRegistry(nowMs)
+ }
+ activeHlsSources[SourceKey(identity, requestFingerprint)]
+ ?.takeIf { it.isFresh(nowMs) }
+ } ?: return null
+ return session.attach()
+ }
+
+ private fun remove(key: SourceKey, session: SourceSession) {
+ synchronized(activeSources) {
+ if (activeSources[key] === session) activeSources.remove(key)
+ }
+ }
+
+ private fun scheduleHlsCleanup(session: HlsSourceSession) {
+ hlsCleanupExecutor.schedule(
+ {
+ synchronized(activeHlsSources) {
+ if (activeHlsSources[session.sourceKey] === session &&
+ session.isExpiredForRegistry(elapsedRealtimeMs())
+ ) {
+ activeHlsSources.remove(session.sourceKey)
+ }
+ }
+ },
+ HLS_SESSION_IDLE_TTL_MS,
+ TimeUnit.MILLISECONDS
+ )
+ }
+
+ private inner class SourceSession(
+ private val key: SourceKey
+ ) : Publisher {
+ private val subscribers = LinkedHashMap<Long, LivePlaybackSubscriber>()
+ private var nextSubscriberId = 1L
+ private var totalBytesPublished = 0L
+ private var closed = false
+
+ @Synchronized
+ fun attach(): Capture? {
+ if (closed) return null
+ val id = nextSubscriberId++
+ val channel = Channel<ByteArray>(capacity = MAX_BUFFERED_CHUNKS)
+ val offsetWithinPacket = (totalBytesPublished % MPEG_TS_PACKET_SIZE.toLong()).toInt()
+ val bytesToBoundary = if (offsetWithinPacket == 0) 0 else MPEG_TS_PACKET_SIZE - offsetWithinPacket
+ subscribers[id] = LivePlaybackSubscriber(id, channel, bytesToBoundary)
+ return CaptureImpl(id, channel)
+ }
+
+ @Synchronized
+ override fun publish(buffer: ByteArray, offset: Int, length: Int) {
+ if (closed || length <= 0) return
+ require(offset >= 0 && length >= 0 && offset + length <= buffer.size)
+ if (subscribers.isEmpty()) {
+ totalBytesPublished += length
+ return
+ }
+ val payload = buffer.copyOfRange(offset, offset + length)
+ totalBytesPublished += length
+ val iterator = subscribers.values.iterator()
+ while (iterator.hasNext()) {
+ val subscriber = iterator.next()
+ val skip = subscriber.bytesToPacketBoundary.coerceAtMost(payload.size)
+ subscriber.bytesToPacketBoundary -= skip
+ if (skip == payload.size) continue
+
+ val deliver = if (skip == 0) payload else payload.copyOfRange(skip, payload.size)
+ if (subscriber.channel.trySend(deliver).isFailure) {
+ subscriber.channel.close(LivePlaybackCaptureBackpressureException())
+ iterator.remove()
+ }
+ }
+ }
+
+ @Synchronized
+ fun finish() {
+ if (closed) return
+ closed = true
+ subscribers.values.forEach { it.channel.close() }
+ subscribers.clear()
+ remove(key, this)
+ }
+
+ override fun close() = finish()
+
+ private inner class CaptureImpl(
+ private val id: Long,
+ private val channel: Channel<ByteArray>
+ ) : Capture {
+ override suspend fun readChunk(): ByteArray? {
+ val result = channel.receiveCatching()
+ result.exceptionOrNull()?.let { throw it }
+ return result.getOrNull()
+ }
+
+ override fun close() {
+ synchronized(this@SourceSession) {
+ subscribers.remove(id)
+ channel.cancel()
+ }
+ }
+ }
+ }
+
+ private inner class HlsSourceSession(
+ val sourceKey: SourceKey
+ ) {
+ private val resourcesById = LinkedHashMap<Long, CachedHlsResource>()
+ private val resourcesByUrl = HashMap<HlsResourceKey, CachedHlsResource>()
+ private var nextResourceId = 1L
+ private var playlistBytes = 0
+ private var payloadBytes = 0
+ private val captures = LinkedHashSet<HlsCaptureImpl>()
+ private var lastActivityAtMs = elapsedRealtimeMs()
+ private var failure: LivePlaybackCaptureBackpressureException? = null
+
+ @Synchronized
+ fun canReuse(nowMs: Long): Boolean =
+ captures.isNotEmpty() || nowMs - lastActivityAtMs <= HLS_SESSION_IDLE_TTL_MS
+
+ @Synchronized
+ fun isFresh(nowMs: Long): Boolean =
+ nowMs - lastActivityAtMs <= HLS_SESSION_IDLE_TTL_MS
+
+ @Synchronized
+ fun isExpiredForRegistry(nowMs: Long): Boolean =
+ captures.isEmpty() && nowMs - lastActivityAtMs > HLS_SESSION_IDLE_TTL_MS
+
+ @Synchronized
+ fun beginResource(
+ requestedUrl: String,
+ resolvedUrl: String,
+ isPlaylist: Boolean,
+ rangeStart: Long,
+ rangeLength: Long
+ ): HlsPublisher {
+ lastActivityAtMs = elapsedRealtimeMs()
+ return HlsResourcePublisher(requestedUrl, resolvedUrl, isPlaylist, rangeStart, rangeLength)
+ }
+
+ @Synchronized
+ fun attach(): HlsCapture {
+ return HlsCaptureImpl(firstRecordingResourceId = nextResourceId).also { captures.add(it) }
+ }
+
+ @Synchronized
+ fun resource(url: String, rangeStart: Long, rangeLength: Long): HlsResource? {
+ return resourcesByUrl[HlsResourceKey(url, rangeStart, rangeLength)]?.toPublicResource()
+ }
+
+ @Synchronized
+ fun newestResource(urls: Collection<String>): HlsResource? {
+ val nowMs = elapsedRealtimeMs()
+ return urls.asSequence()
+ .mapNotNull { url -> resourcesByUrl[HlsResourceKey(url, 0L, -1L)] }
+ .filter { it.isPlaylist }
+ .filter { nowMs - it.updatedAtMs <= HLS_SESSION_IDLE_TTL_MS }
+ .maxWithOrNull(compareBy<CachedHlsResource> { it.updatedAtMs }.thenBy { it.id })
+ ?.toPublicResource()
+ }
+
+ @Synchronized
+ fun recordingResource(
+ url: String,
+ rangeStart: Long,
+ rangeLength: Long,
+ capture: HlsCaptureImpl
+ ): HlsResource? {
+ val key = HlsResourceKey(url, rangeStart, rangeLength)
+ return resourcesById.values.firstOrNull {
+ it.id >= capture.firstRecordingResourceId &&
+ !it.isPlaylist &&
+ key in it.aliases &&
+ it.id !in capture.consumedResourceIds
+ }
+ ?.toPublicResource()
+ }
+
+ @Synchronized
+ private fun consume(resourceId: Long, capture: HlsCaptureImpl) {
+ val resource = resourcesById[resourceId] ?: return
+ if (capture !in captures || resource.id < capture.firstRecordingResourceId) return
+ capture.consumedResourceIds += resource.id
+ if (!isRequiredByCapture(resource)) removeResource(resource)
+ }
+
+ @Synchronized
+ fun isPlaybackActive(): Boolean =
+ elapsedRealtimeMs() - lastActivityAtMs <= HLS_SESSION_IDLE_TTL_MS
+
+ @Synchronized
+ fun throwIfFailed() {
+ failure?.let { throw it }
+ }
+
+ @Synchronized
+ private fun detach(capture: HlsCaptureImpl) {
+ captures.remove(capture)
+ resourcesById.values.toList()
+ .filterNot(::isRequiredByCapture)
+ .forEach(::removeResource)
+ if (captures.isEmpty()) {
+ failure = null
+ scheduleHlsCleanup(this@HlsSourceSession)
+ }
+ }
+
+ private fun isRequiredByCapture(resource: CachedHlsResource): Boolean =
+ captures.any { capture ->
+ resource.id >= capture.firstRecordingResourceId &&
+ resource.id !in capture.consumedResourceIds
+ }
+
+ @Synchronized
+ private fun store(
+ requestedUrl: String,
+ resolvedUrl: String,
+ bytes: ByteArray,
+ isPlaylist: Boolean,
+ rangeStart: Long,
+ rangeLength: Long
+ ) {
+ lastActivityAtMs = elapsedRealtimeMs()
+ if (bytes.isEmpty()) return
+ val aliases = setOf(
+ HlsResourceKey(requestedUrl, rangeStart, rangeLength),
+ HlsResourceKey(resolvedUrl, rangeStart, rangeLength)
+ )
+ aliases.mapNotNull(resourcesByUrl::get).distinct().forEach { existing ->
+ if (existing.isPlaylist || !isRequiredByCapture(existing)) removeResource(existing)
+ }
+
+ val limit = if (isPlaylist) MAX_HLS_PLAYLIST_BYTES else MAX_HLS_PAYLOAD_BYTES
+ if (bytes.size > MAX_HLS_RESOURCE_BYTES || bytes.size > limit) {
+ if (captures.isNotEmpty()) failure = LivePlaybackCaptureBackpressureException()
+ return
+ }
+
+ val used = if (isPlaylist) playlistBytes else payloadBytes
+ if (captures.isNotEmpty() && used + bytes.size > limit) {
+ // A recording must not silently skip an evicted segment. Fail the capture before
+ // producing a file with gaps; foreground playback remains non-blocking.
+ failure = LivePlaybackCaptureBackpressureException()
+ return
+ }
+ while (captures.isEmpty() &&
+ (if (isPlaylist) playlistBytes else payloadBytes) + bytes.size > limit
+ ) {
+ val oldest = resourcesById.values.firstOrNull { it.isPlaylist == isPlaylist } ?: break
+ removeResource(oldest)
+ }
+
+ val resourceId = nextResourceId++
+ val entry = CachedHlsResource(
+ id = resourceId,
+ url = resolvedUrl,
+ aliases = aliases,
+ bytes = bytes,
+ updatedAtMs = elapsedRealtimeMs(),
+ isPlaylist = isPlaylist
+ )
+ resourcesById[resourceId] = entry
+ aliases.forEach { resourcesByUrl[it] = entry }
+ if (isPlaylist) playlistBytes += bytes.size else payloadBytes += bytes.size
+ }
+
+ private fun CachedHlsResource.toPublicResource() =
+ HlsResource(
+ resourceId = id,
+ url = url,
+ bytes = bytes,
+ updatedAtMs = updatedAtMs,
+ isPlaylist = isPlaylist,
+ rangeStart = aliases.firstOrNull()?.rangeStart ?: 0L,
+ rangeLength = aliases.firstOrNull()?.rangeLength ?: -1L
+ )
+
+ private fun removeResource(resource: CachedHlsResource) {
+ val entry = resourcesById.entries.firstOrNull { it.value === resource } ?: return
+ resourcesById.remove(entry.key)
+ resource.aliases.forEach { alias ->
+ if (resourcesByUrl[alias] === resource) resourcesByUrl.remove(alias)
+ }
+ if (resource.isPlaylist) playlistBytes -= resource.bytes.size else payloadBytes -= resource.bytes.size
+ }
+
+ private inner class HlsResourcePublisher(
+ private val requestedUrl: String,
+ private val resolvedUrl: String,
+ private val isPlaylist: Boolean,
+ private val rangeStart: Long,
+ private val rangeLength: Long
+ ) : HlsPublisher {
+ private var output = ByteArrayOutputStream()
+ private var completed = false
+ private var oversized = false
+
+ override fun publish(buffer: ByteArray, offset: Int, length: Int) {
+ if (completed || length <= 0) return
+ require(offset >= 0 && length >= 0 && offset + length <= buffer.size)
+ synchronized(this@HlsSourceSession) {
+ if (completed || oversized) return
+ lastActivityAtMs = elapsedRealtimeMs()
+ if (output.size() + length > MAX_HLS_RESOURCE_BYTES) {
+ oversized = true
+ output.reset()
+ return
+ }
+ output.write(buffer, offset, length)
+ }
+ }
+
+ override fun complete() {
+ synchronized(this@HlsSourceSession) {
+ if (completed) return
+ completed = true
+ if (oversized) {
+ if (captures.isNotEmpty()) failure = LivePlaybackCaptureBackpressureException()
+ } else {
+ val bytes = output.toByteArray()
+ val bodyIsPlaylist = bytes.looksLikeHlsPlaylist() ||
+ (isPlaylist && bytes.looksLikeText())
+ store(requestedUrl, resolvedUrl, bytes, bodyIsPlaylist, rangeStart, rangeLength)
+ }
+ output = ByteArrayOutputStream()
+ }
+ scheduleHlsCleanup(this@HlsSourceSession)
+ }
+
+ override fun close() {
+ synchronized(this@HlsSourceSession) {
+ if (completed) return
+ completed = true
+ output = ByteArrayOutputStream()
+ }
+ scheduleHlsCleanup(this@HlsSourceSession)
+ }
+ }
+
+ private inner class HlsCaptureImpl(
+ val firstRecordingResourceId: Long
+ ) : HlsCapture {
+ @Volatile
+ private var closed = false
+ val consumedResourceIds = HashSet<Long>()
+
+ override fun resource(url: String, rangeStart: Long, rangeLength: Long): HlsResource? =
+ sessionResource(url, rangeStart, rangeLength)
+
+ override fun newestResource(urls: Collection<String>): HlsResource? =
+ sessionNewestResource(urls)
+
+ override fun recordingResource(url: String, rangeStart: Long, rangeLength: Long): HlsResource? =
+ sessionRecordingResource(url, rangeStart, rangeLength)
+
+ override fun consume(resource: HlsResource) {
+ if (!closed) sessionConsume(resource.resourceId)
+ }
+
+ override fun isPlaybackActive(): Boolean = !closed && sessionIsPlaybackActive()
+
+ override fun throwIfFailed() {
+ if (!closed) sessionThrowIfFailed()
+ }
+
+ override fun close() {
+ synchronized(this@HlsSourceSession) {
+ if (closed) return
+ closed = true
+ detach(this)
+ }
+ }
+
+ private fun sessionResource(url: String, rangeStart: Long, rangeLength: Long) = if (closed) {
+ null
+ } else {
+ [email protected](url, rangeStart, rangeLength)
+ }
+ private fun sessionNewestResource(urls: Collection<String>) =
+ if (closed) null else [email protected](urls)
+ private fun sessionRecordingResource(url: String, rangeStart: Long, rangeLength: Long) =
+ if (closed) null else [email protected](url, rangeStart, rangeLength, this)
+ private fun sessionConsume(resourceId: Long) =
+ [email protected](resourceId, this)
+ private fun sessionIsPlaybackActive() = [email protected]()
+ private fun sessionThrowIfFailed() = [email protected]()
+ }
+ }
+
+ private companion object {
+ const val MAX_BUFFERED_CHUNKS = 64
+ const val MPEG_TS_PACKET_SIZE = 188
+ const val HLS_SESSION_IDLE_TTL_MS = 30_000L
+ const val MAX_HLS_RESOURCE_BYTES = 32 * 1024 * 1024
+ const val MAX_HLS_PLAYLIST_BYTES = 2 * 1024 * 1024
+ const val MAX_HLS_PAYLOAD_BYTES = 32 * 1024 * 1024
+ }
+}
+
+private fun elapsedRealtimeMs(): Long = System.nanoTime() / 1_000_000L
+
+/** A stable opaque key that never stores raw URLs or provider credentials in the tap registry. */
+fun livePlaybackRequestFingerprint(url: String, headers: Map<String, String>): String {
+ val canonical = buildString {
+ append(url)
+ append('\n')
+ headers.entries
+ .sortedBy { it.key.lowercase() }
+ .forEach { (name, value) ->
+ append(name.lowercase())
+ append(':')
+ append(value)
+ append('\n')
+ }
+ }
+ return MessageDigest.getInstance("SHA-256")
+ .digest(canonical.toByteArray(Charsets.UTF_8))
+ .joinToString(separator = "") { byte -> "%02x".format(byte) }
+}
diff --git a/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerContentResolver.kt b/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerContentResolver.kt
index b821d488..111bdbb5 100644
--- a/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerContentResolver.kt
+++ b/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerContentResolver.kt
@@ -4,6 +4,7 @@ import com.streamvault.domain.model.ContentType
import com.streamvault.domain.model.Episode
import com.streamvault.domain.model.Movie
import com.streamvault.domain.model.PlaybackContentKind
+import com.streamvault.domain.model.LivePlaybackIdentity
import com.streamvault.domain.model.Result
import com.streamvault.domain.model.Series
import com.streamvault.domain.model.StreamInfo
@@ -220,7 +221,8 @@ internal suspend fun resolvePlayerPlaybackStreamInfo(
streamType = StreamType.fromContainerExtension(ext),
containerExtension = ext,
expirationTime = resolved.expirationTime,
- playbackContentKind = contentType.toPlaybackContentKind()
+ playbackContentKind = contentType.toPlaybackContentKind(),
+ livePlaybackIdentity = livePlaybackIdentityOrNull(providerId, internalContentId, contentType)
)
)
}
@@ -256,11 +258,22 @@ internal suspend fun resolvePlayerPlaybackStreamInfo(
title = currentTitle,
streamType = StreamType.fromContainerExtension(fallbackContainerExtension),
containerExtension = fallbackContainerExtension,
- playbackContentKind = contentType.toPlaybackContentKind()
+ playbackContentKind = contentType.toPlaybackContentKind(),
+ livePlaybackIdentity = livePlaybackIdentityOrNull(providerId, internalContentId, contentType)
)
}
)
}
+private fun livePlaybackIdentityOrNull(
+ providerId: Long,
+ channelId: Long,
+ contentType: ContentType
+): LivePlaybackIdentity? = if (contentType == ContentType.LIVE && providerId > 0L && channelId > 0L) {
+ LivePlaybackIdentity(providerId, channelId)
+} else {
+ null
+}
+
private fun ContentType.toPlaybackContentKind(): PlaybackContentKind =
if (this == ContentType.LIVE) PlaybackContentKind.LIVE else PlaybackContentKind.ON_DEMAND
diff --git a/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerPreparationCoordinator.kt b/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerPreparationCoordinator.kt
index 6cd8059c..88f67b66 100644
--- a/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerPreparationCoordinator.kt
+++ b/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerPreparationCoordinator.kt
@@ -79,7 +79,8 @@ class PlayerPreparationCoordinator @Inject constructor(
DomainResult.Loading -> Unit
is DomainResult.Success -> preparedStreamInfo = pluginPrepareResult.data.copy(
- playbackContentKind = request.streamInfo.playbackContentKind
+ playbackContentKind = request.streamInfo.playbackContentKind,
+ livePlaybackIdentity = request.streamInfo.livePlaybackIdentity
)
}
@@ -131,7 +132,8 @@ class PlayerPreparationCoordinator @Inject constructor(
is DomainResult.Error -> return null
DomainResult.Loading -> streamInfo
is DomainResult.Success -> result.data.copy(
- playbackContentKind = streamInfo.playbackContentKind
+ playbackContentKind = streamInfo.playbackContentKind,
+ livePlaybackIdentity = streamInfo.livePlaybackIdentity
)
}
val preparedExpiry = prepared.expirationTime
diff --git a/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerViewModel.kt b/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerViewModel.kt
index d07a0381..ee5bb347 100644
--- a/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerViewModel.kt
+++ b/feature/playback/src/main/java/com/streamvault/feature/playback/player/PlayerViewModel.kt
@@ -19,6 +19,7 @@ import com.streamvault.domain.model.LiveChannelObservedQuality
import com.streamvault.domain.model.PlaybackHistory
import com.streamvault.domain.model.RecordingItem
import com.streamvault.domain.model.RecordingRecurrence
+import com.streamvault.domain.model.RecordingFailureReasonCodes
import com.streamvault.domain.model.RecordingStatus
import com.streamvault.domain.model.ProviderType
import com.streamvault.domain.model.Result
@@ -43,6 +44,7 @@ import com.streamvault.player.timeshift.LiveTimeshiftBackend
import com.streamvault.player.timeshift.LiveTimeshiftState
import com.streamvault.player.timeshift.LiveTimeshiftStatus
import com.streamvault.player.timeshift.TimeshiftConfig
+import com.streamvault.feature.playback.R
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -948,7 +950,12 @@ class PlayerViewModel @Inject constructor(
failedNow?.let { item ->
val title = item.programTitle?.takeIf { it.isNotBlank() } ?: item.channelName
- val detail = item.failureReason?.takeIf { it.isNotBlank() } ?: "The provider stopped serving the recording stream."
+ val detail = when (item.failureReason?.takeIf { it.isNotBlank() }) {
+ RecordingFailureReasonCodes.LIVE_CAPTURE_OUTPUT_TOO_SLOW ->
+ appContext.getString(R.string.player_recording_failure_output_too_slow)
+ null -> "The provider stopped serving the recording stream."
+ else -> item.failureReason.orEmpty()
+ }
showPlayerNotice(
message = "Recording failed for $title. $detail",
durationMs = maxOf(playerNoticeTimeoutMs, 8_000L)
diff --git a/feature/playback/src/main/res/values-ar/playback_player_strings.xml b/feature/playback/src/main/res/values-ar/playback_player_strings.xml
index 7ca6a572..53ab71b1 100644
--- a/feature/playback/src/main/res/values-ar/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-ar/playback_player_strings.xml
@@ -263,4 +263,5 @@
<string name="player_diagnostics_bandwidth_estimate">عرض النطاق للشبكة</string>
<string name="player_diagnostics_audio_decoder_mode">وضع فك ترميز الصوت</string>
<string name="player_diagnostics_video_decoder_mode">وضع فك ترميز الفيديو</string>
+ <string name="player_recording_failure_output_too_slow">لم يتمكن موقع حفظ التسجيل من مواكبة البث المباشر.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-bg/playback_player_strings.xml b/feature/playback/src/main/res/values-bg/playback_player_strings.xml
index 2d602661..d6f66437 100644
--- a/feature/playback/src/main/res/values-bg/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-bg/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">Сезони</string>
<string name="settings_recording_status_recording">Записва се</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Дестинацията за запис не успя да се справи с предаването на живо.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-cs/playback_player_strings.xml b/feature/playback/src/main/res/values-cs/playback_player_strings.xml
index ed29ff68..69ac2e55 100644
--- a/feature/playback/src/main/res/values-cs/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-cs/playback_player_strings.xml
@@ -261,4 +261,5 @@
<string name="player_subtitle_delay_action">Zpoždění titulků (%1$+d ms)</string>
<string name="player_subtitle_search_close">Zavřít</string>
<string name="player_diagnostics_video_decoder_mode">Režim video dekodéru</string>
+ <string name="player_recording_failure_output_too_slow">Cílové úložiště záznamu nestíhalo živé přehrávání.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-da/playback_player_strings.xml b/feature/playback/src/main/res/values-da/playback_player_strings.xml
index fdd4692c..9a4a1437 100644
--- a/feature/playback/src/main/res/values-da/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-da/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_video_decoder_mode">Videodekodertilstand</string>
<string name="cast_disconnected">Cast-sessionen er afbrudt.</string>
<string name="epg_catchup_available_unknown">Catch-up tilgængelig</string>
+ <string name="player_recording_failure_output_too_slow">Optagelsesdestinationen kunne ikke følge med liveafspilningen.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-de/playback_player_strings.xml b/feature/playback/src/main/res/values-de/playback_player_strings.xml
index aefc4f19..e1fd29ba 100644
--- a/feature/playback/src/main/res/values-de/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-de/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_skip_recap">Rückblick überspringen</string>
<string name="player_skip_outro">Abspann überspringen</string>
<string name="player_track_live_translation">Echtzeit-Übersetzung</string>
+ <string name="player_recording_failure_output_too_slow">Das Aufnahmeziel konnte nicht mit der Live-Wiedergabe Schritt halten.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-el/playback_player_strings.xml b/feature/playback/src/main/res/values-el/playback_player_strings.xml
index e050204e..ac1737b3 100644
--- a/feature/playback/src/main/res/values-el/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-el/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_bandwidth_estimate">Εύρος ζώνης δικτύου</string>
<string name="player_diagnostics_video_decoder_mode">Λειτουργία αποκωδικοποιητή βίντεο</string>
<string name="player_track_live_translation">Μετάφραση σε πραγματικό χρόνο</string>
+ <string name="player_recording_failure_output_too_slow">Ο προορισμός εγγραφής δεν μπόρεσε να συμβαδίσει με τη ζωντανή αναπαραγωγή.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-es/playback_player_strings.xml b/feature/playback/src/main/res/values-es/playback_player_strings.xml
index 08993763..1c6cad7a 100644
--- a/feature/playback/src/main/res/values-es/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-es/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_skip_recap">Saltar resumen</string>
<string name="player_skip_outro">Saltar cierre</string>
<string name="player_track_live_translation" tools:ignore="MissingTranslation">Traducción en tiempo real</string>
+ <string name="player_recording_failure_output_too_slow">El destino de grabación no pudo seguir el ritmo de la reproducción en directo.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-fa/playback_player_strings.xml b/feature/playback/src/main/res/values-fa/playback_player_strings.xml
index 6aa3067c..a60505ee 100644
--- a/feature/playback/src/main/res/values-fa/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-fa/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">فصلها</string>
<string name="settings_recording_status_recording">در حال ضبط</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">مقصد ضبط نتوانست با پخش زنده همگام بماند.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-fi/playback_player_strings.xml b/feature/playback/src/main/res/values-fi/playback_player_strings.xml
index 46d85b6b..152db566 100644
--- a/feature/playback/src/main/res/values-fi/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-fi/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_subtitle_delay_action">Tekstityksen viive (%1$+d ms)</string>
<string name="player_subtitle_search_close">Sulje</string>
<string name="player_diagnostics_video_decoder_mode">Videodekooderin tila</string>
+ <string name="player_recording_failure_output_too_slow">Tallennuskohde ei pysynyt suoran lähetyksen tahdissa.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-fil/playback_player_strings.xml b/feature/playback/src/main/res/values-fil/playback_player_strings.xml
index 5551dfee..aa081d4e 100644
--- a/feature/playback/src/main/res/values-fil/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-fil/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">Mga Season</string>
<string name="settings_recording_status_recording">Naka-record</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Hindi nakasabay ang lokasyon ng recording sa live playback.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-fr/playback_player_strings.xml b/feature/playback/src/main/res/values-fr/playback_player_strings.xml
index 1b4b0706..8ffe6746 100644
--- a/feature/playback/src/main/res/values-fr/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-fr/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_skip_recap">Passer le récapitulatif</string>
<string name="player_skip_outro">Passer le générique de fin</string>
<string name="player_track_live_translation" tools:ignore="MissingTranslation">Traduction en temps réel</string>
+ <string name="player_recording_failure_output_too_slow">La destination d’enregistrement n’a pas suivi la lecture en direct.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-hi/playback_player_strings.xml b/feature/playback/src/main/res/values-hi/playback_player_strings.xml
index fd7a1979..599fbbff 100644
--- a/feature/playback/src/main/res/values-hi/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-hi/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">सीज़न</string>
<string name="settings_recording_status_recording">रिकॉर्डिंग</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">रिकॉर्डिंग गंतव्य लाइव प्लेबैक की गति के साथ नहीं चल सका।</string>
</resources>
diff --git a/feature/playback/src/main/res/values-hr/playback_player_strings.xml b/feature/playback/src/main/res/values-hr/playback_player_strings.xml
index b7547eeb..af61f1d9 100644
--- a/feature/playback/src/main/res/values-hr/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-hr/playback_player_strings.xml
@@ -260,4 +260,5 @@
<string name="series_seasons">Sezone</string>
<string name="settings_recording_status_recording">Snimanje</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Odredište snimanja nije moglo pratiti reprodukciju uživo.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-hu/playback_player_strings.xml b/feature/playback/src/main/res/values-hu/playback_player_strings.xml
index 778e67f9..b855119b 100644
--- a/feature/playback/src/main/res/values-hu/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-hu/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_stream_bitrate">Stream bitráta</string>
<string name="player_diagnostics_bandwidth_estimate">Hálózati sávszélesség</string>
<string name="player_diagnostics_frame_rate">Képkockasebesség</string>
+ <string name="player_recording_failure_output_too_slow">A felvétel célhelye nem tudta követni az élő lejátszás tempóját.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-in/playback_player_strings.xml b/feature/playback/src/main/res/values-in/playback_player_strings.xml
index 38bd841f..42a3de54 100644
--- a/feature/playback/src/main/res/values-in/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-in/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_subtitle_delay_action">Penundaan subtitle (%1$+d ms)</string>
<string name="player_subtitle_search_close">Tutup</string>
<string name="player_diagnostics_video_decoder_mode">Mode Dekoder Video</string>
+ <string name="player_recording_failure_output_too_slow">Tujuan rekaman tidak dapat mengikuti pemutaran langsung.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-it/playback_player_strings.xml b/feature/playback/src/main/res/values-it/playback_player_strings.xml
index 9d41fee2..2e1475ca 100644
--- a/feature/playback/src/main/res/values-it/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-it/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_skip_recap">Salta riepilogo</string>
<string name="player_skip_outro">Salta outro</string>
<string name="player_track_live_translation" tools:ignore="MissingTranslation">Traduzione in tempo reale</string>
+ <string name="player_recording_failure_output_too_slow">La destinazione della registrazione non è riuscita a tenere il passo con la riproduzione in diretta.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-iw/playback_player_strings.xml b/feature/playback/src/main/res/values-iw/playback_player_strings.xml
index b67495c6..6d4fdb9d 100644
--- a/feature/playback/src/main/res/values-iw/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-iw/playback_player_strings.xml
@@ -260,4 +260,5 @@
<string name="player_skip_opening">דלג על הפתיחה</string>
<string name="player_skip_recap">דלג על התקציר</string>
<string name="player_skip_outro">דלג על הסיום</string>
+ <string name="player_recording_failure_output_too_slow">יעד ההקלטה לא הצליח לעמוד בקצב השידור החי.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-ja/playback_player_strings.xml b/feature/playback/src/main/res/values-ja/playback_player_strings.xml
index 3a1075e3..2738517f 100644
--- a/feature/playback/src/main/res/values-ja/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-ja/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_frame_rate">フレームレート</string>
<string name="player_diagnostics_stream_bitrate">ストリームビットレート</string>
<string name="player_diagnostics_bandwidth_estimate">ネットワーク帯域</string>
+ <string name="player_recording_failure_output_too_slow">録画先がライブ再生の速度に追いつきませんでした。</string>
</resources>
diff --git a/feature/playback/src/main/res/values-ko/playback_player_strings.xml b/feature/playback/src/main/res/values-ko/playback_player_strings.xml
index aac8e648..aa97018c 100644
--- a/feature/playback/src/main/res/values-ko/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-ko/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_audio_decoder_mode">오디오 디코더 모드</string>
<string name="player_diagnostics_video_decoder_mode">비디오 디코더 모드</string>
<string name="player_track_live_translation">실시간 번역</string>
+ <string name="player_recording_failure_output_too_slow">녹화 저장 위치가 실시간 재생 속도를 따라가지 못했습니다.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-mk/playback_player_strings.xml b/feature/playback/src/main/res/values-mk/playback_player_strings.xml
index 456e26d4..47cf1437 100644
--- a/feature/playback/src/main/res/values-mk/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-mk/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">Сезони</string>
<string name="settings_recording_status_recording">Снимање</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Локацијата за снимање не можеше да ја следи репродукцијата во живо.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-ms/playback_player_strings.xml b/feature/playback/src/main/res/values-ms/playback_player_strings.xml
index 88ba0c22..8f31cfb7 100644
--- a/feature/playback/src/main/res/values-ms/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-ms/playback_player_strings.xml
@@ -258,4 +258,5 @@
<string name="series_seasons">Musim</string>
<string name="settings_recording_status_recording">Merakam</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Destinasi rakaman tidak dapat mengikuti main balik langsung.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-nb/playback_player_strings.xml b/feature/playback/src/main/res/values-nb/playback_player_strings.xml
index 032e4954..86f8e22c 100644
--- a/feature/playback/src/main/res/values-nb/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-nb/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_skip_opening">Hopp over åpning</string>
<string name="player_skip_recap">Hopp over oppsummering</string>
<string name="player_track_live_translation">Sanntidsoversettelse</string>
+ <string name="player_recording_failure_output_too_slow">Opptaksmålet klarte ikke å holde tritt med direkteavspillingen.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-nl/playback_player_strings.xml b/feature/playback/src/main/res/values-nl/playback_player_strings.xml
index ade036f6..aec44367 100644
--- a/feature/playback/src/main/res/values-nl/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-nl/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_subtitle_delay_action">Ondertitelvertraging (%1$+d ms)</string>
<string name="player_subtitle_search_close">Sluiten</string>
<string name="player_diagnostics_video_decoder_mode">Videodecodermodus</string>
+ <string name="player_recording_failure_output_too_slow">De opnamelocatie kon het live afspelen niet bijhouden.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-pl/playback_player_strings.xml b/feature/playback/src/main/res/values-pl/playback_player_strings.xml
index 7f50c8d9..e5f174a4 100644
--- a/feature/playback/src/main/res/values-pl/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-pl/playback_player_strings.xml
@@ -261,4 +261,5 @@
<string name="player_skip_recap">Pomiń podsumowanie</string>
<string name="player_skip_outro">Pomiń outro</string>
<string name="player_track_live_translation">Tłumaczenie w czasie rzeczywistym</string>
+ <string name="player_recording_failure_output_too_slow">Miejsce zapisu nie nadążało za odtwarzaniem na żywo.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-pt/playback_player_strings.xml b/feature/playback/src/main/res/values-pt/playback_player_strings.xml
index e7bb22bc..c23b2c54 100644
--- a/feature/playback/src/main/res/values-pt/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-pt/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_skip_outro">Pular encerramento</string>
<string name="player_track_live_translation">Tradução em tempo real</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">O destino da gravação não conseguiu acompanhar a reprodução ao vivo.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-ro/playback_player_strings.xml b/feature/playback/src/main/res/values-ro/playback_player_strings.xml
index e60fb0b9..1bec5493 100644
--- a/feature/playback/src/main/res/values-ro/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-ro/playback_player_strings.xml
@@ -260,4 +260,5 @@
<string name="player_skip_recap">Săriți recapitularea</string>
<string name="player_skip_outro">Săriți finalul</string>
<string name="player_track_live_translation">Traducere în timp real</string>
+ <string name="player_recording_failure_output_too_slow">Destinația înregistrării nu a putut ține pasul cu redarea în direct.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-ru/playback_player_strings.xml b/feature/playback/src/main/res/values-ru/playback_player_strings.xml
index 8c88695e..44d1d260 100644
--- a/feature/playback/src/main/res/values-ru/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-ru/playback_player_strings.xml
@@ -261,4 +261,5 @@
<string name="player_subtitle_delay_action">Задержка субтитров (%1$+d мс)</string>
<string name="player_subtitle_search_close">Закрыть</string>
<string name="player_diagnostics_video_decoder_mode">Режим видеодекодера</string>
+ <string name="player_recording_failure_output_too_slow">Место сохранения записи не успевало за прямой трансляцией.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-sk/playback_player_strings.xml b/feature/playback/src/main/res/values-sk/playback_player_strings.xml
index b402fd8b..6d27b259 100644
--- a/feature/playback/src/main/res/values-sk/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-sk/playback_player_strings.xml
@@ -261,4 +261,5 @@
<string name="series_seasons">Série</string>
<string name="settings_recording_status_recording">Nahrávanie</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Cieľové úložisko záznamu nedokázalo držať krok so živým prehrávaním.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-sq/playback_player_strings.xml b/feature/playback/src/main/res/values-sq/playback_player_strings.xml
index f9c4001e..63c58900 100644
--- a/feature/playback/src/main/res/values-sq/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-sq/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">Sezonet</string>
<string name="settings_recording_status_recording">Duke regjistruar</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Vendndodhja e regjistrimit nuk arriti të përballojë riprodhimin drejtpërdrejt.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-sr/playback_player_strings.xml b/feature/playback/src/main/res/values-sr/playback_player_strings.xml
index 22cf66b4..79c49d84 100644
--- a/feature/playback/src/main/res/values-sr/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-sr/playback_player_strings.xml
@@ -260,4 +260,5 @@
<string name="series_seasons">Сезоне</string>
<string name="settings_recording_status_recording">Снимање</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">Одредиште снимања није могло да прати репродукцију уживо.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-sv/playback_player_strings.xml b/feature/playback/src/main/res/values-sv/playback_player_strings.xml
index bcffe177..72352554 100644
--- a/feature/playback/src/main/res/values-sv/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-sv/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_close_playback_desc">Detta stoppar uppspelningen och återgår till föregående skärm.</string>
<string name="player_close_playback_confirm">Ja</string>
<string name="player_close_playback_cancel">Nej</string>
+ <string name="player_recording_failure_output_too_slow">Inspelningsmålet kunde inte hålla jämna steg med direktsändningen.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-th/playback_player_strings.xml b/feature/playback/src/main/res/values-th/playback_player_strings.xml
index 0a225ac1..c69c8ce0 100644
--- a/feature/playback/src/main/res/values-th/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-th/playback_player_strings.xml
@@ -258,4 +258,5 @@
<string name="series_seasons">ซีซัน</string>
<string name="settings_recording_status_recording">กำลังบันทึก</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">ปลายทางการบันทึกไม่สามารถรับข้อมูลได้ทันการเล่นสด</string>
</resources>
diff --git a/feature/playback/src/main/res/values-tr/playback_player_strings.xml b/feature/playback/src/main/res/values-tr/playback_player_strings.xml
index 485bf558..fca5b282 100644
--- a/feature/playback/src/main/res/values-tr/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-tr/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_track_live_translation">Gerçek zamanlı çeviri</string>
<string name="epg_catchup_available_unknown">Geri sarma mevcut</string>
<string name="cast_disconnected">Cast oturumu kesildi.</string>
+ <string name="player_recording_failure_output_too_slow">Kayıt hedefi canlı oynatmaya yetişemedi.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-uk/playback_player_strings.xml b/feature/playback/src/main/res/values-uk/playback_player_strings.xml
index 414cee58..26123487 100644
--- a/feature/playback/src/main/res/values-uk/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-uk/playback_player_strings.xml
@@ -261,4 +261,5 @@
<string name="player_close_playback_desc">Це зупинить відтворення та поверне до попереднього екрана.</string>
<string name="player_close_playback_confirm">Так</string>
<string name="player_close_playback_cancel">Ні</string>
+ <string name="player_recording_failure_output_too_slow">Місце збереження запису не встигало за прямим ефіром.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-vi/playback_player_strings.xml b/feature/playback/src/main/res/values-vi/playback_player_strings.xml
index b0ba4da9..58a2bf0f 100644
--- a/feature/playback/src/main/res/values-vi/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-vi/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_frame_rate">Tốc độ khung hình</string>
<string name="player_diagnostics_stream_bitrate">Tốc độ bit luồng</string>
<string name="player_diagnostics_bandwidth_estimate">Băng thông mạng</string>
+ <string name="player_recording_failure_output_too_slow">Nơi lưu bản ghi không theo kịp phát trực tiếp.</string>
</resources>
diff --git a/feature/playback/src/main/res/values-zh-rTW/playback_player_strings.xml b/feature/playback/src/main/res/values-zh-rTW/playback_player_strings.xml
index 5e12b0a8..e438c0f1 100644
--- a/feature/playback/src/main/res/values-zh-rTW/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-zh-rTW/playback_player_strings.xml
@@ -258,4 +258,5 @@
<string name="series_seasons">季</string>
<string name="settings_recording_status_recording">錄影中</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">錄影目的地無法跟上直播播放。</string>
</resources>
diff --git a/feature/playback/src/main/res/values-zh/playback_player_strings.xml b/feature/playback/src/main/res/values-zh/playback_player_strings.xml
index 84e21fa7..ed468a79 100644
--- a/feature/playback/src/main/res/values-zh/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values-zh/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="player_diagnostics_stream_bitrate">流比特率</string>
<string name="player_diagnostics_bandwidth_estimate">网络带宽</string>
<string name="player_track_live_translation">实时翻译</string>
+ <string name="player_recording_failure_output_too_slow">录制目标无法跟上直播播放。</string>
</resources>
diff --git a/feature/playback/src/main/res/values/playback_player_strings.xml b/feature/playback/src/main/res/values/playback_player_strings.xml
index f33f0d0b..fd51beb4 100644
--- a/feature/playback/src/main/res/values/playback_player_strings.xml
+++ b/feature/playback/src/main/res/values/playback_player_strings.xml
@@ -259,4 +259,5 @@
<string name="series_seasons">Seasons</string>
<string name="settings_recording_status_recording">Recording</string>
<string name="time_range_format">%1$s – %2$s</string>
+ <string name="player_recording_failure_output_too_slow">The recording destination could not keep up with live playback.</string>
</resources>
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingBrowserDialog.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingBrowserDialog.kt
index c462b586..4061a928 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingBrowserDialog.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingBrowserDialog.kt
@@ -419,7 +419,7 @@ private fun RecordingDetailPanel(
)
}
- item.failureReason?.takeIf { reason -> reason.isNotBlank() }?.let { reason ->
+ localizedRecordingFailureReason(item.failureReason)?.let { reason ->
Text(
text = reason,
style = MaterialTheme.typography.bodySmall,
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt
index 4914b33d..449381f3 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt
@@ -8,13 +8,16 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.tv.material3.*
import com.streamvault.core.ui.design.FocusSpec
import com.streamvault.core.ui.interaction.TvButton
import com.streamvault.core.ui.theme.*
+import com.streamvault.feature.settings.R
import com.streamvault.domain.model.RecordingFailureCategory
+import com.streamvault.domain.model.RecordingFailureReasonCodes
import com.streamvault.domain.model.RecordingSourceType
@Composable
@@ -40,6 +43,16 @@ public fun summarizeRecordingOutputPath(path: String): String {
.ifBlank { decoded }
}
+@Composable
+internal fun localizedRecordingFailureReason(reason: String?): String? {
+ val value = reason?.takeIf { it.isNotBlank() } ?: return null
+ return when (value) {
+ RecordingFailureReasonCodes.LIVE_CAPTURE_OUTPUT_TOO_SLOW ->
+ stringResource(R.string.settings_recording_failure_output_too_slow)
+ else -> value
+ }
+}
+
@Composable
public fun RecordingActionButton(
label: String,
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt
index 719a966b..9cbc21dc 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt
@@ -132,7 +132,7 @@ public fun RecordingItemCard(
)
}
}
- item.failureReason?.takeIf { it.isNotBlank() }?.let { reason ->
+ localizedRecordingFailureReason(item.failureReason)?.let { reason ->
Text(reason, style = MaterialTheme.typography.bodySmall, color = ErrorColor)
}
FlowRow(
diff --git a/feature/settings/src/main/res/values-ar/strings.xml b/feature/settings/src/main/res/values-ar/strings.xml
index afee56cc..c7eec49b 100644
--- a/feature/settings/src/main/res/values-ar/strings.xml
+++ b/feature/settings/src/main/res/values-ar/strings.xml
@@ -855,4 +855,5 @@
<item quantity="many">كل %d ساعة</item>
<item quantity="other">كل %d ساعة</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">لم يتمكن موقع حفظ التسجيل من مواكبة البث المباشر.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-bg/strings.xml b/feature/settings/src/main/res/values-bg/strings.xml
index f29b6516..413865a9 100644
--- a/feature/settings/src/main/res/values-bg/strings.xml
+++ b/feature/settings/src/main/res/values-bg/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">На всеки %d час</item>
<item quantity="other">На всеки %d часа</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Дестинацията за запис не успя да се справи с предаването на живо.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-cs/strings.xml b/feature/settings/src/main/res/values-cs/strings.xml
index 4ac51ee3..b0c84a31 100644
--- a/feature/settings/src/main/res/values-cs/strings.xml
+++ b/feature/settings/src/main/res/values-cs/strings.xml
@@ -849,4 +849,5 @@
<string name="settings_sync_background_note">Zastavením této aktualizace zůstane již zařazená práce na knihovně a průvodci běžet.</string>
<string name="settings_sync_section_queued">Aktualizace %1$s zařazena do fronty</string>
<string name="settings_sync_stopped_queued">Aktualizace zastavena. Již zařazená práce na knihovně a průvodci bude pokračovat.</string>
+ <string name="settings_recording_failure_output_too_slow">Cílové úložiště záznamu nestíhalo živé přehrávání.</string>
</resources>
\ No newline at end of file
diff --git a/feature/settings/src/main/res/values-da/strings.xml b/feature/settings/src/main/res/values-da/strings.xml
index b685cc9d..a2391cbf 100644
--- a/feature/settings/src/main/res/values-da/strings.xml
+++ b/feature/settings/src/main/res/values-da/strings.xml
@@ -843,4 +843,5 @@
<string name="settings_opensubtitles_connect">Tilslut konto (valgfrit)</string>
<string name="settings_live_clock_position">Urposition</string>
<string name="settings_theme_classic_blue">Klassisk blå</string>
+ <string name="settings_recording_failure_output_too_slow">Optagelsesdestinationen kunne ikke følge med liveafspilningen.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-de/strings.xml b/feature/settings/src/main/res/values-de/strings.xml
index 230af09d..03d83144 100644
--- a/feature/settings/src/main/res/values-de/strings.xml
+++ b/feature/settings/src/main/res/values-de/strings.xml
@@ -839,4 +839,5 @@
<item quantity="one">Jede %d Stunde</item>
<item quantity="other">Alle %d Stunden</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Das Aufnahmeziel konnte nicht mit der Live-Wiedergabe Schritt halten.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-el/strings.xml b/feature/settings/src/main/res/values-el/strings.xml
index 1acad224..0404f635 100644
--- a/feature/settings/src/main/res/values-el/strings.xml
+++ b/feature/settings/src/main/res/values-el/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Κάθε %d ώρα</item>
<item quantity="other">Κάθε %d ώρες</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Ο προορισμός εγγραφής δεν μπόρεσε να συμβαδίσει με τη ζωντανή αναπαραγωγή.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-es/strings.xml b/feature/settings/src/main/res/values-es/strings.xml
index 5d291468..84124ec9 100644
--- a/feature/settings/src/main/res/values-es/strings.xml
+++ b/feature/settings/src/main/res/values-es/strings.xml
@@ -839,4 +839,5 @@
<item quantity="one">Cada %d hora</item>
<item quantity="other">Cada %d horas</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">El destino de grabación no pudo seguir el ritmo de la reproducción en directo.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-fa/strings.xml b/feature/settings/src/main/res/values-fa/strings.xml
index f3e76208..225b385b 100644
--- a/feature/settings/src/main/res/values-fa/strings.xml
+++ b/feature/settings/src/main/res/values-fa/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">هر %d ساعت</item>
<item quantity="other">هر %d ساعت</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">مقصد ضبط نتوانست با پخش زنده همگام بماند.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-fi/strings.xml b/feature/settings/src/main/res/values-fi/strings.xml
index a90b7aff..2d7a4e16 100644
--- a/feature/settings/src/main/res/values-fi/strings.xml
+++ b/feature/settings/src/main/res/values-fi/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">%d tallennettu palveluntarjoaja</item>
<item quantity="other">%d tallennettua palveluntarjoajaa</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Tallennuskohde ei pysynyt suoran lähetyksen tahdissa.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-fil/strings.xml b/feature/settings/src/main/res/values-fil/strings.xml
index 9509acab..ae208f96 100644
--- a/feature/settings/src/main/res/values-fil/strings.xml
+++ b/feature/settings/src/main/res/values-fil/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Bawat %d oras</item>
<item quantity="other">Bawat %d oras</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Hindi nakasabay ang lokasyon ng recording sa live playback.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-fr/strings.xml b/feature/settings/src/main/res/values-fr/strings.xml
index 28ec15c3..2d8af06e 100644
--- a/feature/settings/src/main/res/values-fr/strings.xml
+++ b/feature/settings/src/main/res/values-fr/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Toutes les %d heures</item>
<item quantity="other">Toutes les %d heures</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">La destination d’enregistrement n’a pas suivi la lecture en direct.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-hi/strings.xml b/feature/settings/src/main/res/values-hi/strings.xml
index 794521e3..8b132505 100644
--- a/feature/settings/src/main/res/values-hi/strings.xml
+++ b/feature/settings/src/main/res/values-hi/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">हर %d घंटा</item>
<item quantity="other">हर %d घंटे</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">रिकॉर्डिंग गंतव्य लाइव प्लेबैक की गति के साथ नहीं चल सका।</string>
</resources>
diff --git a/feature/settings/src/main/res/values-hr/strings.xml b/feature/settings/src/main/res/values-hr/strings.xml
index 5e7bad04..c626d488 100644
--- a/feature/settings/src/main/res/values-hr/strings.xml
+++ b/feature/settings/src/main/res/values-hr/strings.xml
@@ -846,4 +846,5 @@
<item quantity="few">Svaka %d sata</item>
<item quantity="other">Svakih %d sati</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Odredište snimanja nije moglo pratiti reprodukciju uživo.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-hu/strings.xml b/feature/settings/src/main/res/values-hu/strings.xml
index ac4b2811..1385914f 100644
--- a/feature/settings/src/main/res/values-hu/strings.xml
+++ b/feature/settings/src/main/res/values-hu/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Minden %d órában</item>
<item quantity="other">Minden %d órában</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">A felvétel célhelye nem tudta követni az élő lejátszás tempóját.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-in/strings.xml b/feature/settings/src/main/res/values-in/strings.xml
index eb97ea14..be87470b 100644
--- a/feature/settings/src/main/res/values-in/strings.xml
+++ b/feature/settings/src/main/res/values-in/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Setiap %d jam</item>
<item quantity="other">Setiap %d jam</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Tujuan rekaman tidak dapat mengikuti pemutaran langsung.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-it/strings.xml b/feature/settings/src/main/res/values-it/strings.xml
index 07194d71..2d24108e 100644
--- a/feature/settings/src/main/res/values-it/strings.xml
+++ b/feature/settings/src/main/res/values-it/strings.xml
@@ -839,4 +839,5 @@
<item quantity="one">Ogni %d ora</item>
<item quantity="other">Ogni %d ore</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">La destinazione della registrazione non è riuscita a tenere il passo con la riproduzione in diretta.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-iw/strings.xml b/feature/settings/src/main/res/values-iw/strings.xml
index 2d409c7a..b5e165e5 100644
--- a/feature/settings/src/main/res/values-iw/strings.xml
+++ b/feature/settings/src/main/res/values-iw/strings.xml
@@ -846,4 +846,5 @@
<string name="settings_live_clock_position">מיקום השעון</string>
<string name="settings_theme_classic_blue">כחול קלאסי</string>
<string name="settings_title">הגדרות</string>
+ <string name="settings_recording_failure_output_too_slow">יעד ההקלטה לא הצליח לעמוד בקצב השידור החי.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-ja/strings.xml b/feature/settings/src/main/res/values-ja/strings.xml
index 34424868..f6b0f317 100644
--- a/feature/settings/src/main/res/values-ja/strings.xml
+++ b/feature/settings/src/main/res/values-ja/strings.xml
@@ -841,4 +841,5 @@
<plurals name="settings_auto_sync_hours">
<item quantity="other">%d 時間ごと</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">録画先がライブ再生の速度に追いつきませんでした。</string>
</resources>
diff --git a/feature/settings/src/main/res/values-ko/strings.xml b/feature/settings/src/main/res/values-ko/strings.xml
index 798979a4..121a84b8 100644
--- a/feature/settings/src/main/res/values-ko/strings.xml
+++ b/feature/settings/src/main/res/values-ko/strings.xml
@@ -839,4 +839,5 @@
<item quantity="one">%d시간마다</item>
<item quantity="other">%d시간마다</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">녹화 저장 위치가 실시간 재생 속도를 따라가지 못했습니다.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-mk/strings.xml b/feature/settings/src/main/res/values-mk/strings.xml
index 21c03a48..6d08f4aa 100644
--- a/feature/settings/src/main/res/values-mk/strings.xml
+++ b/feature/settings/src/main/res/values-mk/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">На секој %d час</item>
<item quantity="other">На секои %d часа</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Локацијата за снимање не можеше да ја следи репродукцијата во живо.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-ms/strings.xml b/feature/settings/src/main/res/values-ms/strings.xml
index 9318d8ac..3836180a 100644
--- a/feature/settings/src/main/res/values-ms/strings.xml
+++ b/feature/settings/src/main/res/values-ms/strings.xml
@@ -840,4 +840,5 @@
<plurals name="settings_auto_sync_hours">
<item quantity="other">Setiap %d jam</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Destinasi rakaman tidak dapat mengikuti main balik langsung.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-nb/strings.xml b/feature/settings/src/main/res/values-nb/strings.xml
index a81591a2..74ec1c3e 100644
--- a/feature/settings/src/main/res/values-nb/strings.xml
+++ b/feature/settings/src/main/res/values-nb/strings.xml
@@ -843,4 +843,5 @@
<string name="settings_provider_diagnostics_show">Vis diagnostikk</string>
<string name="settings_provider_diagnostics_hide">Skjul diagnostikk</string>
<string name="settings_backup_credentials_notice">Sikkerhetskopifiler inneholder leverandørpassord i lesbar form, slik at gjenopprettede kontoer kan koble til på nytt. Oppbevar og del dem bare med folk du stoler på.</string>
+ <string name="settings_recording_failure_output_too_slow">Opptaksmålet klarte ikke å holde tritt med direkteavspillingen.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-nl/strings.xml b/feature/settings/src/main/res/values-nl/strings.xml
index 8b43c6c4..8572e1bd 100644
--- a/feature/settings/src/main/res/values-nl/strings.xml
+++ b/feature/settings/src/main/res/values-nl/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Elk uur</item>
<item quantity="other">Elke %d uur</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">De opnamelocatie kon het live afspelen niet bijhouden.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-pl/strings.xml b/feature/settings/src/main/res/values-pl/strings.xml
index 1ee35d6f..46a3e679 100644
--- a/feature/settings/src/main/res/values-pl/strings.xml
+++ b/feature/settings/src/main/res/values-pl/strings.xml
@@ -849,4 +849,5 @@
<item quantity="many">Co %d godzin</item>
<item quantity="other">Co %d godziny</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Miejsce zapisu nie nadążało za odtwarzaniem na żywo.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-pt/strings.xml b/feature/settings/src/main/res/values-pt/strings.xml
index 28c3802f..50e2dcac 100644
--- a/feature/settings/src/main/res/values-pt/strings.xml
+++ b/feature/settings/src/main/res/values-pt/strings.xml
@@ -839,4 +839,5 @@
<item quantity="one">A cada %d hora</item>
<item quantity="other">A cada %d horas</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">O destino da gravação não conseguiu acompanhar a reprodução ao vivo.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-ro/strings.xml b/feature/settings/src/main/res/values-ro/strings.xml
index b8d0ef38..4e589c34 100644
--- a/feature/settings/src/main/res/values-ro/strings.xml
+++ b/feature/settings/src/main/res/values-ro/strings.xml
@@ -846,4 +846,5 @@
<string name="settings_vod_portal_search_off">Folosiți catalogul VOD indexat local pentru căutare.</string>
<string name="settings_vod_portal_search_on">Cere portalurilor Stalker să caute VOD înainte ca întregul catalog să fie indexat.</string>
<string name="settings_backup_credentials_notice">Fișierele de backup includ parolele furnizorilor în formă lizibilă, astfel încât conturile restaurate să se poată reconecta. Păstrați-le și partajați-le doar cu persoane de încredere.</string>
+ <string name="settings_recording_failure_output_too_slow">Destinația înregistrării nu a putut ține pasul cu redarea în direct.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-ru/strings.xml b/feature/settings/src/main/res/values-ru/strings.xml
index 35e7c87d..bac1d09a 100644
--- a/feature/settings/src/main/res/values-ru/strings.xml
+++ b/feature/settings/src/main/res/values-ru/strings.xml
@@ -849,4 +849,5 @@
<item quantity="many">Каждые %d часов</item>
<item quantity="other">Каждые %d часов</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Место сохранения записи не успевало за прямой трансляцией.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-sk/strings.xml b/feature/settings/src/main/res/values-sk/strings.xml
index 89f3f25f..c4629ec2 100644
--- a/feature/settings/src/main/res/values-sk/strings.xml
+++ b/feature/settings/src/main/res/values-sk/strings.xml
@@ -849,4 +849,5 @@
<item quantity="many">Každých %d hodín</item>
<item quantity="other">Každých %d hodiny</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Cieľové úložisko záznamu nedokázalo držať krok so živým prehrávaním.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-sq/strings.xml b/feature/settings/src/main/res/values-sq/strings.xml
index 4c3e43e6..cdeae7ee 100644
--- a/feature/settings/src/main/res/values-sq/strings.xml
+++ b/feature/settings/src/main/res/values-sq/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Çdo %d orë</item>
<item quantity="other">Çdo %d orë</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Vendndodhja e regjistrimit nuk arriti të përballojë riprodhimin drejtpërdrejt.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-sr/strings.xml b/feature/settings/src/main/res/values-sr/strings.xml
index 1647d50c..424931f4 100644
--- a/feature/settings/src/main/res/values-sr/strings.xml
+++ b/feature/settings/src/main/res/values-sr/strings.xml
@@ -846,4 +846,5 @@
<item quantity="few">Свака %d сата</item>
<item quantity="other">Сваких %d сати</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Одредиште снимања није могло да прати репродукцију уживо.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-sv/strings.xml b/feature/settings/src/main/res/values-sv/strings.xml
index d964afdf..2f7dcb50 100644
--- a/feature/settings/src/main/res/values-sv/strings.xml
+++ b/feature/settings/src/main/res/values-sv/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Varje timme</item>
<item quantity="other">Var %d:e timme</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Inspelningsmålet kunde inte hålla jämna steg med direktsändningen.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-th/strings.xml b/feature/settings/src/main/res/values-th/strings.xml
index a33c2af6..519799d5 100644
--- a/feature/settings/src/main/res/values-th/strings.xml
+++ b/feature/settings/src/main/res/values-th/strings.xml
@@ -840,4 +840,5 @@
<plurals name="settings_auto_sync_hours">
<item quantity="other">ทุก %d ชั่วโมง</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">ปลายทางการบันทึกไม่สามารถรับข้อมูลได้ทันการเล่นสด</string>
</resources>
diff --git a/feature/settings/src/main/res/values-tr/strings.xml b/feature/settings/src/main/res/values-tr/strings.xml
index 0f058fd1..910338c7 100644
--- a/feature/settings/src/main/res/values-tr/strings.xml
+++ b/feature/settings/src/main/res/values-tr/strings.xml
@@ -843,4 +843,5 @@
<item quantity="one">Her %d saat</item>
<item quantity="other">Her %d saat</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Kayıt hedefi canlı oynatmaya yetişemedi.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-uk/strings.xml b/feature/settings/src/main/res/values-uk/strings.xml
index 32df8333..e3433849 100644
--- a/feature/settings/src/main/res/values-uk/strings.xml
+++ b/feature/settings/src/main/res/values-uk/strings.xml
@@ -849,4 +849,5 @@
<item quantity="many">Кожні %d годин</item>
<item quantity="other">Кожні %d години</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Місце збереження запису не встигало за прямим ефіром.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-vi/strings.xml b/feature/settings/src/main/res/values-vi/strings.xml
index ecfec9c4..b1aa1beb 100644
--- a/feature/settings/src/main/res/values-vi/strings.xml
+++ b/feature/settings/src/main/res/values-vi/strings.xml
@@ -840,4 +840,5 @@
<plurals name="settings_auto_sync_hours">
<item quantity="other">Mỗi %d giờ</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">Nơi lưu bản ghi không theo kịp phát trực tiếp.</string>
</resources>
diff --git a/feature/settings/src/main/res/values-zh-rTW/strings.xml b/feature/settings/src/main/res/values-zh-rTW/strings.xml
index 911e3251..5adaf53f 100644
--- a/feature/settings/src/main/res/values-zh-rTW/strings.xml
+++ b/feature/settings/src/main/res/values-zh-rTW/strings.xml
@@ -840,4 +840,5 @@
<plurals name="settings_auto_sync_hours">
<item quantity="other">每 %d 小時</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">錄影目的地無法跟上直播播放。</string>
</resources>
diff --git a/feature/settings/src/main/res/values-zh/strings.xml b/feature/settings/src/main/res/values-zh/strings.xml
index 6d5144a6..b27891fe 100644
--- a/feature/settings/src/main/res/values-zh/strings.xml
+++ b/feature/settings/src/main/res/values-zh/strings.xml
@@ -839,4 +839,5 @@
<string name="settings_recording_smb_password_hint">留空以复用同一 URL 和用户名已保存的密码</string>
<string name="settings_recording_smb_save">验证并保存</string>
<string name="settings_recording_smb_saving">正在验证…</string>
+ <string name="settings_recording_failure_output_too_slow">录制目标无法跟上直播播放。</string>
</resources>
diff --git a/feature/settings/src/main/res/values/strings.xml b/feature/settings/src/main/res/values/strings.xml
index 050fefad..6880ec99 100644
--- a/feature/settings/src/main/res/values/strings.xml
+++ b/feature/settings/src/main/res/values/strings.xml
@@ -849,4 +849,5 @@
<item quantity="one">Every %d hour</item>
<item quantity="other">Every %d hours</item>
</plurals>
+ <string name="settings_recording_failure_output_too_slow">The recording destination could not keep up with live playback.</string>
</resources>
diff --git a/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt b/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt
index efd1323f..67b71bb8 100644
--- a/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt
+++ b/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt
@@ -44,6 +44,7 @@ import com.streamvault.domain.model.PlaybackCompatibilityKey
import com.streamvault.domain.model.PlaybackCompatibilityRecord
import com.streamvault.domain.model.PlayerSurfaceMode
import com.streamvault.domain.model.StreamInfo
+import com.streamvault.domain.util.LivePlaybackByteTap
import com.streamvault.domain.settings.VodTrackPreferences
import com.streamvault.domain.model.VideoFormat
import com.streamvault.domain.repository.PlaybackCompatibilityRepository
@@ -136,9 +137,25 @@ class Media3PlayerEngine @Inject constructor(
private val okHttpClient: OkHttpClient,
private val playbackCompatibilityRepository: PlaybackCompatibilityRepository,
private val audioCompatibilityMemoryStore: AudioCompatibilityMemoryStore,
- private val playbackSupportSnapshotStore: PlaybackSupportSnapshotStore
+ private val playbackSupportSnapshotStore: PlaybackSupportSnapshotStore,
+ private val livePlaybackByteTap: LivePlaybackByteTap
) : PlayerEngine {
+ constructor(
+ context: Context,
+ okHttpClient: OkHttpClient,
+ playbackCompatibilityRepository: PlaybackCompatibilityRepository,
+ audioCompatibilityMemoryStore: AudioCompatibilityMemoryStore,
+ playbackSupportSnapshotStore: PlaybackSupportSnapshotStore
+ ) : this(
+ context,
+ okHttpClient,
+ playbackCompatibilityRepository,
+ audioCompatibilityMemoryStore,
+ playbackSupportSnapshotStore,
+ LivePlaybackByteTap()
+ )
+
companion object {
private const val TAG = "Media3PlayerEngine"
private const val LEGACY_TEXTURE_VIEW_MAX_SDK = Build.VERSION_CODES.N_MR1
@@ -353,7 +370,8 @@ class Media3PlayerEngine @Inject constructor(
PlayerDataSourceFactoryProvider(
context = context,
baseClient = okHttpClient,
- transferListener = transferByteCounter
+ transferListener = transferByteCounter,
+ livePlaybackByteTap = livePlaybackByteTap
)
private val mediaSourceFactory = PlayerMediaSourceFactory(dataSourceFactoryProvider)
private var preloadWindowManager: Media3PreloadWindowManager? = null
diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt
index 7571194d..f85b880d 100644
--- a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt
+++ b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceFactoryProvider.kt
@@ -9,8 +9,12 @@ import androidx.media3.datasource.TransferListener
import androidx.media3.datasource.okhttp.OkHttpDataSource
import com.streamvault.domain.model.VodHttpProtocolMode
import com.streamvault.domain.model.PlaybackTransportPolicy
+import com.streamvault.domain.model.PlaybackContentKind
import com.streamvault.domain.model.StreamInfo
import com.streamvault.domain.util.BoundedExpiringCache
+import com.streamvault.domain.util.LivePlaybackByteTap
+import com.streamvault.domain.util.effectiveHttpRequestProperties
+import com.streamvault.domain.util.livePlaybackRequestFingerprint
import java.net.InetSocketAddress
import java.net.Proxy
import java.net.URI
@@ -24,7 +28,8 @@ class PlayerDataSourceFactoryProvider(
private val context: Context,
private val baseClient: OkHttpClient,
/** Receives byte counts for foreground (non-preload) playback; used for measured bitrate stats. */
- private val transferListener: TransferListener? = null
+ private val transferListener: TransferListener? = null,
+ private val livePlaybackByteTap: LivePlaybackByteTap? = null
) {
private companion object {
private const val TAG = "PlayerDataSource"
@@ -115,7 +120,17 @@ class PlayerDataSourceFactoryProvider(
PlayerDataSourceReadStatsFactory(
upstream = defaultFactory,
resolvedStreamType = resolvedStreamType,
- initialTargetUrl = streamInfo.url
+ initialTargetUrl = streamInfo.url,
+ livePlaybackByteTap = livePlaybackByteTap.takeIf {
+ !preload && resolvedStreamType in setOf(
+ ResolvedStreamType.MPEG_TS_LIVE,
+ ResolvedStreamType.HLS
+ )
+ },
+ livePlaybackIdentity = streamInfo.livePlaybackIdentity.takeIf {
+ streamInfo.playbackContentKind == PlaybackContentKind.LIVE
+ },
+ livePlaybackRequestFingerprint = livePlaybackRequestFingerprint(streamInfo.url, headers)
)
} else {
defaultFactory
@@ -166,20 +181,7 @@ class PlayerDataSourceFactoryProvider(
internal fun effectivePlaybackRequestProperties(
headers: Map<String, String>,
userAgent: String?
-): Map<String, String> {
- val normalizedUserAgent = userAgent?.trim().orEmpty()
- if (normalizedUserAgent.isBlank()) {
- return headers
- }
- return buildMap(headers.size + 1) {
- headers.forEach { (name, value) ->
- if (!name.equals("User-Agent", ignoreCase = true)) {
- put(name, value)
- }
- }
- put("User-Agent", normalizedUserAgent)
- }
-}
+): Map<String, String> = effectiveHttpRequestProperties(headers, userAgent)
private object StalkerPlaybackRequestLoggingInterceptor : Interceptor {
private const val TAG = "PlayerDataSource"
diff --git a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceReadStats.kt b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceReadStats.kt
index 4c550fb9..25848f86 100644
--- a/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceReadStats.kt
+++ b/player/src/main/java/com/streamvault/player/playback/PlayerDataSourceReadStats.kt
@@ -3,10 +3,13 @@ package com.streamvault.player.playback
import android.net.Uri
import android.os.SystemClock
import android.util.Log
+import androidx.media3.common.C
import androidx.media3.common.util.UnstableApi
import androidx.media3.datasource.DataSource
import androidx.media3.datasource.DataSpec
import androidx.media3.datasource.TransferListener
+import com.streamvault.domain.model.LivePlaybackIdentity
+import com.streamvault.domain.util.LivePlaybackByteTap
import java.io.IOException
@UnstableApi
@@ -14,14 +17,20 @@ internal class PlayerDataSourceReadStatsFactory(
private val upstream: DataSource.Factory,
private val resolvedStreamType: ResolvedStreamType,
private val initialTargetUrl: String,
- private val clockMs: () -> Long = SystemClock::elapsedRealtime
+ private val clockMs: () -> Long = SystemClock::elapsedRealtime,
+ private val livePlaybackByteTap: LivePlaybackByteTap? = null,
+ private val livePlaybackIdentity: LivePlaybackIdentity? = null,
+ private val livePlaybackRequestFingerprint: String? = null
) : DataSource.Factory {
override fun createDataSource(): DataSource =
PlayerDataSourceReadStatsDataSource(
upstream = upstream.createDataSource(),
resolvedStreamType = resolvedStreamType,
initialTargetUrl = initialTargetUrl,
- clockMs = clockMs
+ clockMs = clockMs,
+ livePlaybackByteTap = livePlaybackByteTap,
+ livePlaybackIdentity = livePlaybackIdentity,
+ livePlaybackRequestFingerprint = livePlaybackRequestFingerprint
)
}
@@ -34,11 +43,18 @@ private class PlayerDataSourceReadStatsDataSource(
private val upstream: DataSource,
private val resolvedStreamType: ResolvedStreamType,
initialTargetUrl: String,
- private val clockMs: () -> Long
+ private val clockMs: () -> Long,
+ private val livePlaybackByteTap: LivePlaybackByteTap?,
+ private val livePlaybackIdentity: LivePlaybackIdentity?,
+ private val livePlaybackRequestFingerprint: String?
) : DataSource {
private val tracker = PlayerDataSourceReadStatsTracker()
private var target = PlaybackLogSanitizer.sanitizeUrl(initialTargetUrl)
private var opened = false
+ private var livePlaybackPublisher: LivePlaybackByteTap.Publisher? = null
+ private var livePlaybackHlsPublisher: LivePlaybackByteTap.HlsPublisher? = null
+ private var livePlaybackHlsExpectedLength: Long? = null
+ private var livePlaybackHlsBytesRead = 0L
override fun addTransferListener(transferListener: TransferListener) {
upstream.addTransferListener(transferListener)
@@ -47,9 +63,44 @@ private class PlayerDataSourceReadStatsDataSource(
@Throws(IOException::class)
override fun open(dataSpec: DataSpec): Long {
target = PlaybackLogSanitizer.sanitizeUrl(dataSpec.uri.toString())
+ livePlaybackPublisher?.close()
+ livePlaybackPublisher = null
+ livePlaybackHlsPublisher?.close()
+ livePlaybackHlsPublisher = null
+ livePlaybackHlsExpectedLength = null
+ livePlaybackHlsBytesRead = 0L
val length = upstream.open(dataSpec)
tracker.open(clockMs())
opened = true
+ if ((resolvedStreamType == ResolvedStreamType.HLS ||
+ (resolvedStreamType == ResolvedStreamType.MPEG_TS_LIVE && dataSpec.position == 0L)) &&
+ (dataSpec.uri.scheme.equals("http", ignoreCase = true) ||
+ dataSpec.uri.scheme.equals("https", ignoreCase = true))
+ ) {
+ val identity = livePlaybackIdentity
+ val fingerprint = livePlaybackRequestFingerprint
+ if (identity != null && fingerprint != null) {
+ if (resolvedStreamType == ResolvedStreamType.MPEG_TS_LIVE) {
+ livePlaybackPublisher = livePlaybackByteTap?.begin(identity, fingerprint)
+ } else {
+ val requestedUrl = dataSpec.uri.toString()
+ val resolvedUrl = upstream.uri?.toString() ?: requestedUrl
+ livePlaybackHlsPublisher = livePlaybackByteTap?.beginHlsResource(
+ identity = identity,
+ requestFingerprint = fingerprint,
+ requestedUrl = requestedUrl,
+ resolvedUrl = resolvedUrl,
+ isPlaylist = isHlsPlaylist(dataSpec),
+ rangeStart = dataSpec.position,
+ rangeLength = dataSpec.length.takeIf { it >= 0L }
+ ?: length.takeIf { dataSpec.position > 0L && it >= 0L }
+ ?: -1L
+ )
+ livePlaybackHlsExpectedLength = dataSpec.length.takeIf { it >= 0L }
+ ?: length.takeIf { it >= 0L }
+ }
+ }
+ }
if (readStatsLoggingEnabled()) {
Log.d(
TAG,
@@ -62,6 +113,26 @@ private class PlayerDataSourceReadStatsDataSource(
@Throws(IOException::class)
override fun read(buffer: ByteArray, offset: Int, length: Int): Int {
val bytesRead = upstream.read(buffer, offset, length)
+ if (bytesRead > 0) {
+ livePlaybackPublisher?.publish(buffer, offset, bytesRead)
+ livePlaybackHlsPublisher?.publish(buffer, offset, bytesRead)
+ if (livePlaybackHlsPublisher != null) {
+ livePlaybackHlsBytesRead += bytesRead
+ livePlaybackHlsExpectedLength?.let { expectedLength ->
+ when {
+ livePlaybackHlsBytesRead == expectedLength -> livePlaybackHlsPublisher?.complete()
+ livePlaybackHlsBytesRead > expectedLength -> livePlaybackHlsPublisher?.close()
+ }
+ }
+ }
+ } else if (bytesRead == C.RESULT_END_OF_INPUT) {
+ val expectedLength = livePlaybackHlsExpectedLength
+ if (expectedLength == null || livePlaybackHlsBytesRead == expectedLength) {
+ livePlaybackHlsPublisher?.complete()
+ } else {
+ livePlaybackHlsPublisher?.close()
+ }
+ }
if (bytesRead > 0 && readStatsLoggingEnabled()) {
tracker.recordRead(bytesRead, clockMs())?.let(::logProgress)
}
@@ -77,6 +148,12 @@ private class PlayerDataSourceReadStatsDataSource(
try {
upstream.close()
} finally {
+ livePlaybackPublisher?.close()
+ livePlaybackPublisher = null
+ livePlaybackHlsPublisher?.close()
+ livePlaybackHlsPublisher = null
+ livePlaybackHlsExpectedLength = null
+ livePlaybackHlsBytesRead = 0L
if (opened && readStatsLoggingEnabled()) {
logClose(tracker.snapshot(clockMs()))
}
@@ -104,6 +181,17 @@ private class PlayerDataSourceReadStatsDataSource(
private fun readStatsLoggingEnabled(): Boolean = Log.isLoggable(TAG, Log.DEBUG)
+ private fun isHlsPlaylist(dataSpec: DataSpec): Boolean {
+ val contentType = upstream.responseHeaders.entries
+ .firstOrNull { it.key.equals("Content-Type", ignoreCase = true) }
+ ?.value
+ .orEmpty()
+ .joinToString(" ")
+ .lowercase()
+ val path = dataSpec.uri.path.orEmpty().lowercase()
+ return "mpegurl" in contentType || path.endsWith(".m3u8") || path.endsWith(".m3u")
+ }
+
private companion object {
const val TAG = "PlayerDataReadStats"
}