StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Release 1.0.2
David Nashashd89391813cae
diff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex 6a8fff90..0cf69011 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -24,8 +24,8 @@ android {applicationId = "com.streamvault.app"minSdk = 28targetSdk = 36- versionCode = 2- versionName = "1.0.1"+ versionCode = 3+ versionName = "1.0.2"testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"}diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xmlindex 0f169c68..70e31540 100644--- a/app/src/main/AndroidManifest.xml+++ b/app/src/main/AndroidManifest.xml@@ -4,6 +4,7 @@<uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />+ <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /><uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" /><uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" /><uses-permission android:name="android.permission.BIND_TV_INPUT" />@@ -107,6 +108,16 @@android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"android:value="com.streamvault.app.cast.StreamVaultCastOptionsProvider" />+ <provider+ android:name="androidx.core.content.FileProvider"+ android:authorities="${applicationId}.fileprovider"+ android:exported="false"+ android:grantUriPermissions="true">+ <meta-data+ android:name="android.support.FILE_PROVIDER_PATHS"+ android:resource="@xml/file_paths" />+ </provider>+</application>diff --git a/app/src/main/java/com/streamvault/app/StreamVaultApp.kt b/app/src/main/java/com/streamvault/app/StreamVaultApp.ktindex 648cc48a..b02aee0f 100644--- a/app/src/main/java/com/streamvault/app/StreamVaultApp.kt+++ b/app/src/main/java/com/streamvault/app/StreamVaultApp.kt@@ -8,9 +8,16 @@ import coil3.disk.DiskCacheimport coil3.memory.MemoryCacheimport coil3.request.crossfadeimport com.streamvault.app.diagnostics.RuntimeDiagnosticsManager+import com.streamvault.app.update.GitHubReleaseCheckerimport com.streamvault.app.ui.accessibility.isReducedMotionEnabled+import com.streamvault.data.preferences.PreferencesRepository+import com.streamvault.domain.model.Resultimport dagger.hilt.android.HiltAndroidApp+import kotlinx.coroutines.CoroutineScopeimport kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.launchimport okio.Path.Companion.toOkioPathimport androidx.work.Constraints@@ -18,14 +25,25 @@ import androidx.work.ExistingPeriodicWorkPolicyimport androidx.work.NetworkTypeimport androidx.work.PeriodicWorkRequestBuilderimport androidx.work.WorkManager+import javax.inject.Inject@HiltAndroidAppclass StreamVaultApp : Application(), SingletonImageLoader.Factory {private val runtimeDiagnosticsManager by lazy { RuntimeDiagnosticsManager(this) }+ private val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)++ @Inject+ lateinit var preferencesRepository: PreferencesRepository++ @Inject+ lateinit var gitHubReleaseChecker: GitHubReleaseCheckeroverride fun onCreate() {super.onCreate()runtimeDiagnosticsManager.start()+ applicationScope.launch {+ refreshCachedAppUpdateIfNeeded()+ }// Schedule daily data maintenance: EPG pruning, stale-favorite cleanup, and DB compaction checks.// BLD-H02: Require network + device idle so the worker doesn't drain battery.@@ -51,6 +69,35 @@ class StreamVaultApp : Application(), SingletonImageLoader.Factory {super.onTerminate()}+ private suspend fun refreshCachedAppUpdateIfNeeded() {+ val autoCheckEnabled = preferencesRepository.autoCheckAppUpdates.first()+ if (!autoCheckEnabled) {+ return+ }++ val lastCheckedAt = preferencesRepository.lastAppUpdateCheckTimestamp.first()+ val now = System.currentTimeMillis()+ val checkIntervalMs = 24L * 60L * 60L * 1000L+ if (lastCheckedAt != null && now - lastCheckedAt < checkIntervalMs) {+ return+ }++ preferencesRepository.setLastAppUpdateCheckTimestamp(now)+ when (val result = gitHubReleaseChecker.fetchLatestRelease()) {+ is Result.Success -> {+ preferencesRepository.setCachedAppUpdateRelease(+ versionName = result.data.versionName,+ versionCode = result.data.versionCode,+ releaseUrl = result.data.releaseUrl,+ downloadUrl = result.data.downloadUrl,+ releaseNotes = result.data.releaseNotes,+ publishedAt = result.data.publishedAt+ )+ }+ else -> Unit+ }+ }+override fun newImageLoader(context: PlatformContext): ImageLoader {return ImageLoader.Builder(context).memoryCache {diff --git a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt b/app/src/main/java/com/streamvault/app/di/DatabaseModule.ktindex 2ce767c3..2621fb80 100644--- a/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt+++ b/app/src/main/java/com/streamvault/app/di/DatabaseModule.kt@@ -51,7 +51,8 @@ object DatabaseModule {StreamVaultDatabase.MIGRATION_23_24,StreamVaultDatabase.MIGRATION_24_25,StreamVaultDatabase.MIGRATION_25_26,- StreamVaultDatabase.MIGRATION_26_27+ StreamVaultDatabase.MIGRATION_26_27,+ StreamVaultDatabase.MIGRATION_27_28)// NOTE: fallbackToDestructiveMigration() intentionally removed.// All future schema changes MUST add a corresponding Migration in StreamVaultDatabase.diff --git a/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.ktindex 2ab40b8c..c01d3605 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt@@ -18,8 +18,11 @@ import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.SnackbarHost+import androidx.compose.material3.SnackbarHostStateimport androidx.lifecycle.compose.collectAsStateWithLifecycleimport androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffectimport androidx.lifecycle.compose.collectAsStateWithLifecycleimport androidx.compose.runtime.collectAsStateimport androidx.lifecycle.compose.collectAsStateWithLifecycle@@ -95,51 +98,69 @@ fun DashboardScreen() {val uiState by viewModel.uiState.collectAsStateWithLifecycle()val provider = uiState.provider+ val snackbarHostState = remember { SnackbarHostState() }- AppScreenScaffold(- currentRoute = currentRoute,- onNavigate = onNavigate,- title = stringResource(R.string.nav_home),- subtitle = provider?.name,- navigationChrome = AppNavigationChrome.TopBar,- compactHeader = true,- showScreenHeader = false- ) {- if (provider == null) {- EmptyDashboard(- onAddProvider = onAddProvider,- onOpenSettings = { onNavigate(Routes.SETTINGS) }- )- return@AppScreenScaffold+ LaunchedEffect(uiState.userMessage) {+ uiState.userMessage?.let { message ->+ snackbarHostState.showSnackbar(message)+ viewModel.userMessageShown()}- val orderedSections = rememberDashboardSections(uiState)+ }- androidx.compose.foundation.lazy.LazyColumn(- modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(bottom = 28.dp)+ Box(modifier = Modifier.fillMaxSize()) {+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.nav_home),+ subtitle = provider?.name,+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false) {- if (uiState.isLoading && orderedSections.isEmpty()) {- item(key = "dashboard_loading") {- Box(- modifier = Modifier- .fillMaxWidth()- .padding(top = 28.dp, bottom = 12.dp),- contentAlignment = Alignment.Center- ) {- CircularProgressIndicator(color = Primary)+ if (provider == null) {+ EmptyDashboard(+ onAddProvider = onAddProvider,+ onOpenSettings = { onNavigate(Routes.SETTINGS) }+ )+ return@AppScreenScaffold+ }+ val orderedSections = rememberDashboardSections(uiState)++ androidx.compose.foundation.lazy.LazyColumn(+ modifier = Modifier.fillMaxSize(),+ contentPadding = PaddingValues(bottom = 28.dp)+ ) {+ if (uiState.isLoading && orderedSections.isEmpty()) {+ item(key = "dashboard_loading") {+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .padding(top = 28.dp, bottom = 12.dp),+ contentAlignment = Alignment.Center+ ) {+ CircularProgressIndicator(color = Primary)+ }}}- }- if (uiState.providerWarnings.isNotEmpty()) {- item(key = "provider_warnings") {- DashboardProviderWarningCard(- warnings = uiState.providerWarnings,- onOpenSettings = { onNavigate(Routes.SETTINGS) }- )+ if (uiState.providerWarnings.isNotEmpty()) {+ item(key = "provider_warnings") {+ DashboardProviderWarningCard(+ warnings = uiState.providerWarnings,+ onOpenSettings = { onNavigate(Routes.SETTINGS) }+ )+ }}- }- items(orderedSections, key = { it.name }) { section ->- when (section) {+ uiState.updateNotice?.let { updateNotice ->+ item(key = "update_notice") {+ DashboardUpdateCard(+ notice = updateNotice,+ onOpenSettings = { onNavigate(Routes.SETTINGS) },+ onInstallUpdate = viewModel::installDownloadedUpdate+ )+ }+ }+ items(orderedSections, key = { it.name }) { section ->+ when (section) {DashboardHomeSection.LIVE_SHORTCUTS -> DashboardShortcutRow(title = stringResource(R.string.dashboard_live_shortcuts),subtitle = stringResource(R.string.dashboard_live_shortcuts_subtitle),@@ -201,8 +222,15 @@ fun DashboardScreen(}}}-+ }}++ SnackbarHost(+ hostState = snackbarHostState,+ modifier = Modifier+ .align(Alignment.BottomCenter)+ .padding(bottom = 16.dp)+ )}}@@ -622,6 +650,62 @@ private fun DashboardProviderWarningCard(}}+@Composable+private fun DashboardUpdateCard(+ notice: DashboardUpdateNotice,+ onOpenSettings: () -> Unit,+ onInstallUpdate: () -> Unit+) {+ Surface(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 48.dp, vertical = 6.dp),+ shape = RoundedCornerShape(20.dp),+ colors = SurfaceDefaults.colors(containerColor = Primary.copy(alpha = 0.16f)),+ border = Border(BorderStroke(1.dp, Primary.copy(alpha = 0.45f)))+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 22.dp, vertical = 18.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Text(+ text = stringResource(R.string.dashboard_update_title, notice.latestVersionName),+ style = MaterialTheme.typography.titleMedium,+ color = TextPrimary+ )+ Text(+ text = stringResource(+ if (notice.installReady) {+ R.string.dashboard_update_install_ready+ } else {+ R.string.dashboard_update_available+ }+ ),+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurfaceDim+ )+ Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ DashboardActionButton(+ label = stringResource(+ if (notice.installReady) {+ R.string.dashboard_update_open_installer+ } else {+ R.string.dashboard_update_open_settings+ }+ ),+ onClick = {+ if (notice.installReady) {+ onInstallUpdate()+ } else {+ onOpenSettings()+ }+ }+ )+ }+ }+ }+}+@Composableprivate fun EmptyDashboard(onAddProvider: () -> Unit,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardViewModel.ktindex d593e7e1..388d0154 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardViewModel.kt@@ -2,8 +2,10 @@ package com.streamvault.app.ui.screens.dashboardimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScope+import com.streamvault.app.BuildConfigimport com.streamvault.data.preferences.PreferencesRepositoryimport com.streamvault.data.sync.SyncManager+import com.streamvault.app.update.AppUpdateInstallerimport com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.ContentType@@ -57,7 +59,8 @@ class DashboardViewModel @Inject constructor(private val preferencesRepository: PreferencesRepository,private val getContinueWatching: GetContinueWatching,private val getCustomCategories: GetCustomCategories,- private val syncManager: SyncManager+ private val syncManager: SyncManager,+ private val appUpdateInstaller: AppUpdateInstaller) : ViewModel() {private companion object {const val FAVORITE_CHANNEL_LIMIT = 12@@ -118,8 +121,11 @@ class DashboardViewModel @Inject constructor(liveContext = liveContext,liveChannelCount = liveChannelCount,movieCount = movieCount,- seriesCount = seriesCount+ seriesCount = seriesCount,+ updateNotice = null)+ }.combine(observeUpdateNotice().onStart { emit(null) }) { snapshot, updateNotice ->+ snapshot.copy(updateNotice = updateNotice)}.combine(syncManager.syncStateForProvider(provider.id).onStart { emit(SyncState.Idle) }) { snapshot, syncState ->DashboardUiState(provider = provider,@@ -157,6 +163,7 @@ class DashboardViewModel @Inject constructor(is SyncState.Error -> listOf(syncState.message)else -> emptyList()},+ updateNotice = snapshot.updateNotice,isLoading = false)}@@ -264,6 +271,31 @@ class DashboardViewModel @Inject constructor(}}+ private fun observeUpdateNotice(): Flow<DashboardUpdateNotice?> = combine(+ preferencesRepository.cachedAppUpdateVersionName,+ preferencesRepository.cachedAppUpdateVersionCode,+ preferencesRepository.downloadedAppUpdateVersionName+ ) { latestVersionName, latestVersionCode, downloadedVersionName ->+ if (latestVersionName.isNullOrBlank()) {+ return@combine null+ }++ val updateAvailable = if (latestVersionCode != null && latestVersionCode > BuildConfig.VERSION_CODE) {+ true+ } else {+ compareVersionNames(latestVersionName, BuildConfig.VERSION_NAME) > 0+ }++ if (!updateAvailable) {+ return@combine null+ }++ DashboardUpdateNotice(+ latestVersionName = latestVersionName,+ installReady = downloadedVersionName == latestVersionName+ )+ }+private fun buildFeature(providerName: String,recentChannels: List<Channel>,@@ -372,6 +404,40 @@ class DashboardViewModel @Inject constructor(Year.parse(raw, DateTimeFormatter.ofPattern("yyyy")).atDay(1).toEpochDay()}.getOrNull()}++ private fun compareVersionNames(left: String, right: String): Int {+ val leftParts = left.removePrefix("v").split('.')+ val rightParts = right.removePrefix("v").split('.')+ val length = maxOf(leftParts.size, rightParts.size)+ for (index in 0 until length) {+ val leftValue = leftParts.getOrNull(index)?.toIntOrNull() ?: 0+ val rightValue = rightParts.getOrNull(index)?.toIntOrNull() ?: 0+ if (leftValue != rightValue) {+ return leftValue.compareTo(rightValue)+ }+ }+ return 0+ }++ fun installDownloadedUpdate() {+ viewModelScope.launch {+ when (val result = appUpdateInstaller.installDownloadedUpdate()) {+ is com.streamvault.domain.model.Result.Error -> {+ _uiState.value = _uiState.value.copy(userMessage = result.message)+ }+ is com.streamvault.domain.model.Result.Success -> {+ _uiState.value = _uiState.value.copy(+ userMessage = appContext.getString(R.string.settings_update_install_started)+ )+ }+ else -> Unit+ }+ }+ }++ fun userMessageShown() {+ _uiState.value = _uiState.value.copy(userMessage = null)+ }}private data class DashboardLiveContext(@@ -392,7 +458,8 @@ private data class DashboardSnapshot(val liveContext: DashboardLiveContext,val liveChannelCount: Int,val movieCount: Int,- val seriesCount: Int+ val seriesCount: Int,+ val updateNotice: DashboardUpdateNotice?)data class DashboardUiState(@@ -407,10 +474,17 @@ data class DashboardUiState(val feature: DashboardFeature = DashboardFeature(),val providerHealth: DashboardProviderHealth = DashboardProviderHealth(),val providerWarnings: List<String> = emptyList(),+ val updateNotice: DashboardUpdateNotice? = null,val stats: DashboardStats = DashboardStats(),+ val userMessage: String? = null,val isLoading: Boolean = true)+data class DashboardUpdateNotice(+ val latestVersionName: String,+ val installReady: Boolean+)+data class DashboardProviderHealth(val status: ProviderStatus = ProviderStatus.UNKNOWN,val type: ProviderType = ProviderType.M3U,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex 72dcb045..0ed48c61 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -253,6 +253,11 @@ class PlayerViewModel @Inject constructor(private var pendingCatchUpUrls: List<String> = emptyList()private var channelNumberingMode: ChannelNumberingMode = ChannelNumberingMode.GROUPprivate var activeEpgRequestKey: EpgRequestKey? = null+ private var playerControlsTimeoutMs: Long = 5_000L+ private var liveOverlayTimeoutMs: Long = 4_000L+ private var playerNoticeTimeoutMs: Long = 6_000L+ private var diagnosticsTimeoutMs: Long = 15_000L+ private var preferredDecoderMode: DecoderMode = DecoderMode.AUTOprivate data class EpgRequestKey(val providerId: Long,@@ -325,8 +330,47 @@ class PlayerViewModel @Inject constructor()}.collect(playerEngine::setSubtitleStyle)}+ viewModelScope.launch {+ combine(+ preferencesRepository.playerControlsTimeoutSeconds,+ preferencesRepository.playerLiveOverlayTimeoutSeconds,+ preferencesRepository.playerNoticeTimeoutSeconds,+ preferencesRepository.playerDiagnosticsTimeoutSeconds+ ) { controlsSeconds, liveOverlaySeconds, noticeSeconds, diagnosticsSeconds ->+ PlayerUiTimeouts(+ controlsMs = controlsSeconds * 1000L,+ liveOverlayMs = liveOverlaySeconds * 1000L,+ noticeMs = noticeSeconds * 1000L,+ diagnosticsMs = diagnosticsSeconds * 1000L+ )+ }.collect { timeouts ->+ playerControlsTimeoutMs = timeouts.controlsMs+ liveOverlayTimeoutMs = timeouts.liveOverlayMs+ playerNoticeTimeoutMs = timeouts.noticeMs+ diagnosticsTimeoutMs = timeouts.diagnosticsMs+ }+ }+ viewModelScope.launch {+ preferencesRepository.playerMediaSessionEnabled.collect(playerEngine::setMediaSessionEnabled)+ }+ viewModelScope.launch {+ preferencesRepository.playerDecoderMode.collect { mode ->+ preferredDecoderMode = mode+ if (!hasRetriedWithSoftwareDecoder) {+ playerEngine.setDecoderMode(mode)+ updateDecoderMode(mode)+ }+ }+ }}+ private data class PlayerUiTimeouts(+ val controlsMs: Long,+ val liveOverlayMs: Long,+ val noticeMs: Long,+ val diagnosticsMs: Long+ )+private fun handlePlaybackError(error: PlayerError) {val requestVersion = prepareRequestVersionval playbackUrl = currentPlaybackIdentityUrl()@@ -926,8 +970,8 @@ class PlayerViewModel @Inject constructor(_lastVisitedCategory.value = null}hasRetriedWithSoftwareDecoder = false- playerEngine.setDecoderMode(DecoderMode.AUTO)- updateDecoderMode(DecoderMode.AUTO)+ playerEngine.setDecoderMode(preferredDecoderMode)+ updateDecoderMode(preferredDecoderMode)updateStreamClass(currentStreamClassLabel)// Reset tried streams for manual switch@@ -2251,7 +2295,7 @@ class PlayerViewModel @Inject constructor(message: String,recoveryType: PlayerRecoveryType = PlayerRecoveryType.UNKNOWN,actions: List<PlayerNoticeAction> = emptyList(),- durationMs: Long = if (actions.isNotEmpty()) 6500L else 3200L,+ durationMs: Long = playerNoticeTimeoutMs,isRetryNotice: Boolean = false) {playerNoticeHideJob?.cancel()@@ -2275,7 +2319,7 @@ class PlayerViewModel @Inject constructor(showPlayerNotice(message = message,recoveryType = PlayerRecoveryType.NETWORK,- durationMs = status.delayMs + 1500L,+ durationMs = maxOf(playerNoticeTimeoutMs, status.delayMs + 1500L),isRetryNotice = true)}@@ -2300,7 +2344,7 @@ class PlayerViewModel @Inject constructor(// Cancel previous job to prevent race conditioncontrolsHideJob?.cancel()controlsHideJob = viewModelScope.launch {- delay(5000)+ delay(playerControlsTimeoutMs)_showControls.value = false}}@@ -2319,7 +2363,7 @@ class PlayerViewModel @Inject constructor(private fun hideZapOverlayAfterDelay() {zapOverlayJob?.cancel()zapOverlayJob = viewModelScope.launch {- delay(4000)+ delay(liveOverlayTimeoutMs)_showZapOverlay.value = false}}@@ -2346,7 +2390,7 @@ class PlayerViewModel @Inject constructor(}liveOverlayHideJob?.cancel()liveOverlayHideJob = viewModelScope.launch {- delay(4000)+ delay(liveOverlayTimeoutMs)_showChannelInfoOverlay.value = false_showChannelListOverlay.value = false_showEpgOverlay.value = false@@ -2360,7 +2404,7 @@ class PlayerViewModel @Inject constructor(}diagnosticsHideJob?.cancel()diagnosticsHideJob = viewModelScope.launch {- delay(15000)+ delay(diagnosticsTimeoutMs)_showDiagnostics.value = false}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.ktindex f4c6e497..44b4ba5d 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt@@ -247,6 +247,7 @@ fun ProviderSetupScreen(onLoginXtream = { viewModel.loginXtream(serverUrl, username, password, name) },onAddM3u = { viewModel.addM3u(m3uUrl, name) },onToggleFastSync = { viewModel.updateXtreamFastSyncEnabled(!uiState.xtreamFastSyncEnabled) },+ onToggleM3uVodClassification = { viewModel.updateM3uVodClassificationEnabled(!uiState.m3uVodClassificationEnabled) },onSelectEpgSyncMode = viewModel::updateEpgSyncMode,modifier = Modifier.weight(1f).fillMaxHeight())@@ -275,6 +276,7 @@ fun ProviderSetupScreen(onLoginXtream = { viewModel.loginXtream(serverUrl, username, password, name) },onAddM3u = { viewModel.addM3u(m3uUrl, name) },onToggleFastSync = { viewModel.updateXtreamFastSyncEnabled(!uiState.xtreamFastSyncEnabled) },+ onToggleM3uVodClassification = { viewModel.updateM3uVodClassificationEnabled(!uiState.m3uVodClassificationEnabled) },onSelectEpgSyncMode = viewModel::updateEpgSyncMode,modifier = Modifier.weight(1f).fillMaxWidth())@@ -305,6 +307,7 @@ private fun ProviderFormContent(onLoginXtream: () -> Unit,onAddM3u: () -> Unit,onToggleFastSync: () -> Unit,+ onToggleM3uVodClassification: () -> Unit,onSelectEpgSyncMode: (ProviderEpgSyncMode) -> Unit,modifier: Modifier = Modifier) {@@ -371,6 +374,7 @@ private fun ProviderFormContent(sourceType = sourceType,uiState = uiState,onToggleFastSync = onToggleFastSync,+ onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode)FormErrors(uiState.validationError, uiState.error)@@ -395,6 +399,7 @@ private fun ProviderFormContent(sourceType = sourceType,uiState = uiState,onToggleFastSync = onToggleFastSync,+ onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode)FormErrors(uiState.validationError, uiState.error)@@ -424,6 +429,7 @@ private fun ProviderFormContent(sourceType = sourceType,uiState = uiState,onToggleFastSync = onToggleFastSync,+ onToggleM3uVodClassification = onToggleM3uVodClassification,onSelectEpgSyncMode = onSelectEpgSyncMode)FormErrors(uiState.validationError, uiState.error)@@ -447,13 +453,15 @@ private fun AdvancedProviderOptionsSection(sourceType: SourceType,uiState: ProviderSetupState,onToggleFastSync: () -> Unit,+ onToggleM3uVodClassification: () -> Unit,onSelectEpgSyncMode: (ProviderEpgSyncMode) -> Unit) {var showAdvancedOptions by rememberSaveable(sourceType) { mutableStateOf(false) }LaunchedEffect(uiState.isEditing, uiState.epgSyncMode, uiState.xtreamFastSyncEnabled, sourceType) {- val hasNonDefaultSelection = uiState.epgSyncMode != ProviderEpgSyncMode.UPFRONT ||- (sourceType == SourceType.XTREAM && !uiState.xtreamFastSyncEnabled)+ val hasNonDefaultSelection = (sourceType == SourceType.XTREAM && uiState.epgSyncMode != ProviderEpgSyncMode.UPFRONT) ||+ (sourceType == SourceType.XTREAM && !uiState.xtreamFastSyncEnabled) ||+ (sourceType != SourceType.XTREAM && !uiState.m3uVodClassificationEnabled)if (uiState.isEditing && hasNonDefaultSelection) {showAdvancedOptions = true}@@ -562,30 +570,79 @@ private fun AdvancedProviderOptionsSection(}}- Column(- modifier = Modifier- .fillMaxWidth()- .background(Surface, RoundedCornerShape(12.dp))- .border(1.dp, SurfaceHighlight, RoundedCornerShape(12.dp))- .padding(horizontal = 16.dp, vertical = 12.dp),- verticalArrangement = Arrangement.spacedBy(10.dp)- ) {- Text(- text = androidx.compose.ui.res.stringResource(R.string.setup_epg_sync_mode_label),- style = MaterialTheme.typography.titleSmall,- color = TextPrimary- )- Text(- text = androidx.compose.ui.res.stringResource(R.string.setup_epg_sync_mode_helper),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- ProviderEpgSyncMode.entries.forEach { mode ->- EpgSyncModeOptionRow(- mode = mode,- selected = uiState.epgSyncMode == mode,- onSelect = { onSelectEpgSyncMode(mode) }+ if (sourceType != SourceType.XTREAM) {+ Surface(+ onClick = onToggleM3uVodClassification,+ modifier = Modifier+ .fillMaxWidth()+ .mouseClickable(onClick = onToggleM3uVodClassification),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (uiState.m3uVodClassificationEnabled) Primary.copy(alpha = 0.1f) else Surface,+ focusedContainerColor = Primary.copy(alpha = 0.22f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ BorderStroke(+ 1.dp,+ if (uiState.m3uVodClassificationEnabled) Primary.copy(alpha = 0.4f) else SurfaceHighlight+ )+ ),+ focusedBorder = Border(BorderStroke(3.dp, PrimaryLight))+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_m3u_vod_classification_label),+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_m3u_vod_classification_helper),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ Switch(+ checked = uiState.m3uVodClassificationEnabled,+ onCheckedChange = { onToggleM3uVodClassification() }+ )+ }+ }+ }++ if (sourceType == SourceType.XTREAM) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(Surface, RoundedCornerShape(12.dp))+ .border(1.dp, SurfaceHighlight, RoundedCornerShape(12.dp))+ .padding(horizontal = 16.dp, vertical = 12.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_epg_sync_mode_label),+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary)+ Text(+ text = androidx.compose.ui.res.stringResource(R.string.setup_epg_sync_mode_helper),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ ProviderEpgSyncMode.entries.forEach { mode ->+ EpgSyncModeOptionRow(+ mode = mode,+ selected = uiState.epgSyncMode == mode,+ onSelect = { onSelectEpgSyncMode(mode) }+ )+ }}}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.ktindex 5f09395c..cebb04e0 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupViewModel.kt@@ -62,6 +62,7 @@ class ProviderSetupViewModel @Inject constructor(m3uUrl = provider.m3uUrl,epgSyncMode = provider.epgSyncMode,xtreamFastSyncEnabled = provider.xtreamFastSyncEnabled,+ m3uVodClassificationEnabled = provider.m3uVodClassificationEnabled,selectedTab = if (provider.type == ProviderType.M3U) 1 else 0,m3uTab = if (provider.m3uUrl.startsWith("file://")) 1 else 0)@@ -78,6 +79,10 @@ class ProviderSetupViewModel @Inject constructor(_uiState.update { it.copy(xtreamFastSyncEnabled = enabled) }}+ fun updateM3uVodClassificationEnabled(enabled: Boolean) {+ _uiState.update { it.copy(m3uVodClassificationEnabled = enabled) }+ }+fun updateEpgSyncMode(mode: ProviderEpgSyncMode) {_uiState.update { it.copy(epgSyncMode = mode) }}@@ -165,6 +170,7 @@ class ProviderSetupViewModel @Inject constructor(url = url,name = name,epgSyncMode = _uiState.value.epgSyncMode,+ m3uVodClassificationEnabled = _uiState.value.m3uVodClassificationEnabled,existingProviderId = existingId),onProgress = { msg -> _uiState.update { it.copy(syncProgress = msg) } }@@ -217,5 +223,6 @@ data class ProviderSetupState(val password: String = "",val m3uUrl: String = "",val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,- val xtreamFastSyncEnabled: Boolean = true+ val xtreamFastSyncEnabled: Boolean = true,+ val m3uVodClassificationEnabled: Boolean = true)diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.ktindex 984f4abc..9a855a02 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.kt@@ -28,6 +28,10 @@ import androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.platform.LocalUriHandlerimport androidx.compose.ui.text.TextRangeimport androidx.compose.ui.text.input.TextFieldValue+import androidx.compose.ui.text.input.ImeAction+import androidx.compose.foundation.text.KeyboardActions+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.ui.text.input.KeyboardTypeimport androidx.compose.ui.unit.dpimport androidx.hilt.lifecycle.viewmodel.compose.hiltViewModelimport androidx.tv.material3.*@@ -68,6 +72,7 @@ import com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.CategorySortModeimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.DecoderModeimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderTypeimport com.streamvault.domain.model.ProviderStatus@@ -82,7 +87,9 @@ import androidx.compose.ui.text.style.TextAlignimport com.streamvault.app.Rimport java.util.Localeimport com.streamvault.app.BuildConfig+import com.streamvault.app.ui.screens.settings.AppUpdateUiModelimport com.streamvault.app.ui.interaction.mouseClickable+import java.text.DateFormat@Composable@@ -108,6 +115,21 @@ fun SettingsScreen(val playbackSpeedLabel = remember(uiState.playerPlaybackSpeed) {formatPlaybackSpeedLabel(uiState.playerPlaybackSpeed)}+ val decoderModeLabel = remember(uiState.playerDecoderMode, context) {+ formatDecoderModeLabel(uiState.playerDecoderMode, context)+ }+ val controlsTimeoutLabel = remember(uiState.playerControlsTimeoutSeconds, context) {+ formatTimeoutSecondsLabel(uiState.playerControlsTimeoutSeconds, context)+ }+ val liveOverlayTimeoutLabel = remember(uiState.playerLiveOverlayTimeoutSeconds, context) {+ formatTimeoutSecondsLabel(uiState.playerLiveOverlayTimeoutSeconds, context)+ }+ val noticeTimeoutLabel = remember(uiState.playerNoticeTimeoutSeconds, context) {+ formatTimeoutSecondsLabel(uiState.playerNoticeTimeoutSeconds, context)+ }+ val diagnosticsTimeoutLabel = remember(uiState.playerDiagnosticsTimeoutSeconds, context) {+ formatTimeoutSecondsLabel(uiState.playerDiagnosticsTimeoutSeconds, context)+ }val subtitleSizeLabel = remember(uiState.subtitleTextScale, context) {formatSubtitleSizeLabel(uiState.subtitleTextScale, context)}@@ -155,6 +177,11 @@ fun SettingsScreen(var showLiveChannelNumberingDialog by rememberSaveable { mutableStateOf(false) }var showVodViewModeDialog by rememberSaveable { mutableStateOf(false) }var showPlaybackSpeedDialog by rememberSaveable { mutableStateOf(false) }+ var showDecoderModeDialog by rememberSaveable { mutableStateOf(false) }+ var showControlsTimeoutDialog by rememberSaveable { mutableStateOf(false) }+ var showLiveOverlayTimeoutDialog by rememberSaveable { mutableStateOf(false) }+ var showNoticeTimeoutDialog by rememberSaveable { mutableStateOf(false) }+ var showDiagnosticsTimeoutDialog by rememberSaveable { mutableStateOf(false) }var showLiveTvFiltersDialog by rememberSaveable { mutableStateOf(false) }var showAudioLanguageDialog by rememberSaveable { mutableStateOf(false) }var showSubtitleSizeDialog by rememberSaveable { mutableStateOf(false) }@@ -315,7 +342,13 @@ fun SettingsScreen(},onDelete = { viewModel.deleteProvider(selectedProvider.id) },onEdit = { onEditProvider(selectedProvider) },- onParentalControl = { onNavigateToParentalControl(selectedProvider.id) }+ onParentalControl = { onNavigateToParentalControl(selectedProvider.id) },+ onToggleM3uVodClassification = { enabled ->+ viewModel.setM3uVodClassificationEnabled(selectedProvider.id, enabled)+ },+ onRefreshM3uClassification = {+ viewModel.refreshProviderClassification(selectedProvider.id)+ })}}@@ -373,6 +406,34 @@ fun SettingsScreen(}}HorizontalDivider(color = Color.White.copy(alpha = 0.07f), modifier = Modifier.padding(vertical = 4.dp))+ TvClickableSurface(+ onClick = { viewModel.setPlayerMediaSessionEnabled(!uiState.playerMediaSessionEnabled) },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.15f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(text = stringResource(R.string.settings_media_session), style = MaterialTheme.typography.bodyMedium, color = OnSurface)+ Text(text = stringResource(R.string.settings_media_session_subtitle), style = MaterialTheme.typography.bodySmall, color = OnBackground.copy(alpha = 0.6f))+ }+ Switch(checked = uiState.playerMediaSessionEnabled, onCheckedChange = { viewModel.setPlayerMediaSessionEnabled(it) })+ }+ }+ ClickableSettingsRow(+ label = stringResource(R.string.settings_decoder_mode),+ value = decoderModeLabel,+ onClick = { showDecoderModeDialog = true }+ )+ HorizontalDivider(color = Color.White.copy(alpha = 0.07f), modifier = Modifier.padding(vertical = 4.dp))ClickableSettingsRow(label = stringResource(R.string.settings_live_tv_channel_mode),value = stringResource(uiState.liveTvChannelMode.labelResId()),@@ -440,6 +501,26 @@ fun SettingsScreen(value = playbackSpeedLabel,onClick = { showPlaybackSpeedDialog = true })+ ClickableSettingsRow(+ label = stringResource(R.string.settings_player_controls_timeout),+ value = controlsTimeoutLabel,+ onClick = { showControlsTimeoutDialog = true }+ )+ ClickableSettingsRow(+ label = stringResource(R.string.settings_live_overlay_timeout),+ value = liveOverlayTimeoutLabel,+ onClick = { showLiveOverlayTimeoutDialog = true }+ )+ ClickableSettingsRow(+ label = stringResource(R.string.settings_player_notice_timeout),+ value = noticeTimeoutLabel,+ onClick = { showNoticeTimeoutDialog = true }+ )+ ClickableSettingsRow(+ label = stringResource(R.string.settings_player_diagnostics_timeout),+ value = diagnosticsTimeoutLabel,+ onClick = { showDiagnosticsTimeoutDialog = true }+ )ClickableSettingsRow(label = stringResource(R.string.settings_preferred_audio_language),value = preferredAudioLanguageLabel,@@ -970,7 +1051,71 @@ fun SettingsScreen(// ── 6: About ──────────────────────────────────────────────else {item {+ SettingsSectionHeader(+ title = stringResource(R.string.settings_updates_title),+ subtitle = stringResource(R.string.settings_updates_subtitle)+ )SettingsRow(label = stringResource(R.string.settings_app_version), value = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")+ SwitchSettingsRow(+ label = stringResource(R.string.settings_update_auto_check),+ value = stringResource(+ if (uiState.autoCheckAppUpdates) R.string.settings_enabled else R.string.settings_disabled+ ),+ checked = uiState.autoCheckAppUpdates,+ onCheckedChange = viewModel::setAutoCheckAppUpdates+ )+ SettingsRow(+ label = stringResource(R.string.settings_update_latest_release),+ value = formatLatestReleaseLabel(uiState.appUpdate, context)+ )+ SettingsRow(+ label = stringResource(R.string.settings_update_status),+ value = formatUpdateStatusLabel(uiState.appUpdate, context)+ )+ SettingsRow(+ label = stringResource(R.string.settings_update_last_checked),+ value = formatUpdateCheckTimeLabel(uiState.appUpdate.lastCheckedAt, context)+ )+ ClickableSettingsRow(+ label = stringResource(R.string.settings_update_check_now),+ value = stringResource(+ if (uiState.isCheckingForUpdates) R.string.settings_update_checking else R.string.settings_update_check_action+ ),+ onClick = {+ if (!uiState.isCheckingForUpdates) {+ viewModel.checkForAppUpdates()+ }+ }+ )+ if (shouldShowUpdateDownloadAction(uiState.appUpdate)) {+ ClickableSettingsRow(+ label = stringResource(R.string.settings_update_download),+ value = formatUpdateDownloadLabel(uiState.appUpdate, context),+ onClick = {+ if (uiState.appUpdate.downloadStatus == com.streamvault.app.update.AppUpdateDownloadStatus.Downloaded) {+ viewModel.installDownloadedUpdate()+ } else if (uiState.appUpdate.downloadStatus != com.streamvault.app.update.AppUpdateDownloadStatus.Downloading) {+ viewModel.downloadLatestUpdate()+ }+ }+ )+ }+ if (!uiState.appUpdate.releaseUrl.isNullOrBlank()) {+ ClickableSettingsRow(+ label = stringResource(R.string.settings_update_view_release),+ value = uiState.appUpdate.latestVersionName ?: stringResource(R.string.settings_update_release_notes),+ onClick = { uriHandler.openUri(uiState.appUpdate.releaseUrl.orEmpty()) }+ )+ }+ if (!uiState.appUpdate.errorMessage.isNullOrBlank()) {+ SettingsRow(+ label = stringResource(R.string.settings_update_error),+ value = uiState.appUpdate.errorMessage.orEmpty()+ )+ }+ }++ item {SettingsRow(label = stringResource(R.string.settings_build), value = stringResource(R.string.settings_build_desc))SettingsRow(label = stringResource(R.string.settings_developed_by), value = stringResource(R.string.settings_developer_name))ClickableSettingsRow(@@ -1102,6 +1247,80 @@ fun SettingsScreen(}}+ if (showDecoderModeDialog) {+ val decoderOptions = remember(context) {+ listOf(+ DecoderMode.AUTO to context.getString(R.string.settings_decoder_auto),+ DecoderMode.HARDWARE to context.getString(R.string.settings_decoder_hardware),+ DecoderMode.SOFTWARE to context.getString(R.string.settings_decoder_software)+ )+ }+ PremiumSelectionDialog(+ title = stringResource(R.string.settings_select_decoder_mode),+ onDismiss = { showDecoderModeDialog = false }+ ) {+ decoderOptions.forEachIndexed { index, option ->+ LevelOption(+ level = index,+ text = option.second,+ currentLevel = if (uiState.playerDecoderMode == option.first) index else -1,+ onSelect = {+ viewModel.setPlayerDecoderMode(option.first)+ showDecoderModeDialog = false+ }+ )+ }+ }+ }++ if (showControlsTimeoutDialog) {+ TimeoutValueDialog(+ title = stringResource(R.string.settings_player_controls_timeout),+ subtitle = stringResource(R.string.settings_timeout_vod_controls_subtitle),+ initialValue = uiState.playerControlsTimeoutSeconds,+ onDismiss = { showControlsTimeoutDialog = false }+ ) { seconds ->+ viewModel.setPlayerControlsTimeoutSeconds(seconds)+ showControlsTimeoutDialog = false+ }+ }++ if (showLiveOverlayTimeoutDialog) {+ TimeoutValueDialog(+ title = stringResource(R.string.settings_live_overlay_timeout),+ subtitle = stringResource(R.string.settings_timeout_live_overlays_subtitle),+ initialValue = uiState.playerLiveOverlayTimeoutSeconds,+ onDismiss = { showLiveOverlayTimeoutDialog = false }+ ) { seconds ->+ viewModel.setPlayerLiveOverlayTimeoutSeconds(seconds)+ showLiveOverlayTimeoutDialog = false+ }+ }++ if (showNoticeTimeoutDialog) {+ TimeoutValueDialog(+ title = stringResource(R.string.settings_player_notice_timeout),+ subtitle = stringResource(R.string.settings_timeout_notices_subtitle),+ initialValue = uiState.playerNoticeTimeoutSeconds,+ onDismiss = { showNoticeTimeoutDialog = false }+ ) { seconds ->+ viewModel.setPlayerNoticeTimeoutSeconds(seconds)+ showNoticeTimeoutDialog = false+ }+ }++ if (showDiagnosticsTimeoutDialog) {+ TimeoutValueDialog(+ title = stringResource(R.string.settings_player_diagnostics_timeout),+ subtitle = stringResource(R.string.settings_timeout_diagnostics_subtitle),+ initialValue = uiState.playerDiagnosticsTimeoutSeconds,+ onDismiss = { showDiagnosticsTimeoutDialog = false }+ ) { seconds ->+ viewModel.setPlayerDiagnosticsTimeoutSeconds(seconds)+ showDiagnosticsTimeoutDialog = false+ }+ }+if (showLiveTvFiltersDialog) {LiveTvQuickFiltersDialog(filters = uiState.liveTvCategoryFilters,@@ -1625,6 +1844,65 @@ private fun PremiumSelectionDialog(}}+@Composable+private fun TimeoutValueDialog(+ title: String,+ subtitle: String,+ initialValue: Int,+ onDismiss: () -> Unit,+ onConfirm: (Int) -> Unit+) {+ var value by rememberSaveable(initialValue) { mutableStateOf(initialValue.toString()) }+ val parsedValue = value.toIntOrNull()+ val isValid = parsedValue != null && parsedValue in 2..60++ PremiumDialog(+ title = title,+ subtitle = subtitle,+ onDismissRequest = onDismiss,+ widthFraction = 0.42f,+ content = {+ Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {+ Text(+ text = stringResource(R.string.settings_timeout_seconds_label),+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurface+ )+ NumericSettingsTextField(+ value = value,+ onValueChange = { updated -> value = updated.filter(Char::isDigit).take(2) },+ placeholder = stringResource(R.string.settings_timeout_seconds_placeholder)+ )+ Text(+ text = if (isValid) {+ formatTimeoutSecondsLabel(parsedValue ?: initialValue, androidx.compose.ui.platform.LocalContext.current)+ } else {+ stringResource(R.string.settings_timeout_validation)+ },+ style = MaterialTheme.typography.bodySmall,+ color = if (isValid) OnSurfaceDim else Color(0xFFFF8A80)+ )+ }+ },+ footer = {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.End)+ ) {+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss+ )+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_timeout_apply),+ onClick = { parsedValue?.let(onConfirm) },+ enabled = isValid+ )+ }+ }+ )+}+@Composableprivate fun LevelOption(level: Int, text: String, currentLevel: Int, onSelect: () -> Unit) {Row(@@ -1643,6 +1921,106 @@ private fun LevelOption(level: Int, text: String, currentLevel: Int, onSelect: (}}+@Composable+private fun NumericSettingsTextField(+ value: String,+ onValueChange: (String) -> Unit,+ placeholder: String+) {+ val isTelevisionDevice = com.streamvault.app.device.rememberIsTelevisionDevice()+ val focusRequester = remember { FocusRequester() }+ val keyboardController = LocalSoftwareKeyboardController.current+ var hasContainerFocus by remember { mutableStateOf(false) }+ var hasInputFocus by remember { mutableStateOf(false) }+ var acceptsInput by remember(isTelevisionDevice) { mutableStateOf(!isTelevisionDevice) }+ var pendingInputActivation by remember { mutableStateOf(false) }+ var fieldValue by remember {+ mutableStateOf(TextFieldValue(text = value, selection = TextRange(value.length)))+ }+ val isFocused = hasContainerFocus || hasInputFocus++ LaunchedEffect(value) {+ if (value != fieldValue.text) {+ fieldValue = TextFieldValue(text = value, selection = TextRange(value.length))+ }+ }++ LaunchedEffect(acceptsInput, pendingInputActivation) {+ if (!isTelevisionDevice || !acceptsInput || !pendingInputActivation) return@LaunchedEffect+ focusRequester.requestFocus()+ keyboardController?.show()+ pendingInputActivation = false+ }++ TvClickableSurface(+ onClick = {+ if (!isTelevisionDevice) {+ focusRequester.requestFocus()+ keyboardController?.show()+ return@TvClickableSurface+ }+ acceptsInput = true+ pendingInputActivation = true+ },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ focusedContainerColor = Color.White.copy(alpha = 0.12f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier+ .fillMaxWidth()+ .onFocusChanged { hasContainerFocus = it.isFocused }+ ) {+ Box(modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp)) {+ if (value.isEmpty() && !isFocused) {+ Text(placeholder, style = MaterialTheme.typography.bodyMedium, color = OnSurfaceDim)+ }+ BasicTextField(+ value = fieldValue,+ onValueChange = { updatedValue ->+ val digitsOnly = updatedValue.text.filter(Char::isDigit).take(2)+ fieldValue = updatedValue.copy(+ text = digitsOnly,+ selection = TextRange(digitsOnly.length.coerceAtMost(digitsOnly.length))+ )+ if (digitsOnly != value) {+ onValueChange(digitsOnly)+ }+ },+ textStyle = MaterialTheme.typography.bodyMedium.copy(color = Color.White),+ singleLine = true,+ cursorBrush = SolidColor(Primary),+ keyboardOptions = KeyboardOptions(+ keyboardType = KeyboardType.Number,+ imeAction = ImeAction.Done+ ),+ keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }),+ modifier = Modifier+ .fillMaxWidth()+ .focusRequester(focusRequester)+ .focusProperties {+ canFocus = !isTelevisionDevice || acceptsInput+ if (isTelevisionDevice && acceptsInput) {+ left = FocusRequester.Cancel+ right = FocusRequester.Cancel+ }+ }+ .onFocusChanged {+ hasInputFocus = it.isFocused+ if (!it.isFocused) {+ if (isTelevisionDevice) {+ acceptsInput = false+ }+ keyboardController?.hide()+ }+ },+ readOnly = isTelevisionDevice && !acceptsInput+ )+ }+ }+}+@Composableprivate fun QualityCapSelectionDialog(title: String,@@ -1817,7 +2195,9 @@ private fun ProviderSettingsCard(onRefresh: () -> Unit,onDelete: () -> Unit,onEdit: () -> Unit,- onParentalControl: () -> Unit+ onParentalControl: () -> Unit,+ onToggleM3uVodClassification: (Boolean) -> Unit,+ onRefreshM3uClassification: () -> Unit) {val context = androidx.compose.ui.platform.LocalContext.current// Use Column layout - provider info + buttons below as separate focusable items@@ -1906,6 +2286,62 @@ private fun ProviderSettingsCard()}+ if (provider.type == ProviderType.M3U) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(Surface, RoundedCornerShape(10.dp))+ .border(1.dp, SurfaceHighlight, RoundedCornerShape(10.dp))+ .padding(12.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(4.dp)+ ) {+ Text(+ text = stringResource(R.string.settings_m3u_vod_classification_title),+ style = MaterialTheme.typography.titleSmall,+ color = OnBackground+ )+ Text(+ text = stringResource(R.string.settings_m3u_vod_classification_summary),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ Switch(+ checked = provider.m3uVodClassificationEnabled,+ onCheckedChange = onToggleM3uVodClassification+ )+ }+ Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {+ TvClickableSurface(+ onClick = onRefreshM3uClassification,+ enabled = !isSyncing,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(6.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Primary.copy(alpha = 0.15f),+ focusedContainerColor = Primary.copy(alpha = 0.3f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Text(+ text = stringResource(R.string.settings_m3u_vod_classification_refresh),+ style = MaterialTheme.typography.labelMedium,+ color = Primary,+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)+ )+ }+ }+ }+ }+if (syncWarnings.isNotEmpty()) {val hasEpgWarning = syncWarnings.any { it.contains("EPG", ignoreCase = true) }val hasMoviesWarning = syncWarnings.any { it.contains("Movies", ignoreCase = true) }@@ -2667,6 +3103,96 @@ private fun ClickableSettingsRow(label: String, value: String, onClick: () -> Un}}+@Composable+private fun SwitchSettingsRow(label: String, value: String, checked: Boolean, onCheckedChange: (Boolean) -> Unit) {+ val focusRequester = remember { FocusRequester() }+ TvClickableSurface(+ onClick = { onCheckedChange(!checked) },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.15f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier+ .fillMaxWidth()+ .focusRequester(focusRequester)+ .mouseClickable(+ focusRequester = focusRequester,+ onClick = { onCheckedChange(!checked) }+ )+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {+ Text(text = label, style = MaterialTheme.typography.bodyMedium, color = OnSurface)+ Text(text = value, style = MaterialTheme.typography.bodySmall, color = OnSurfaceDim)+ }+ Switch(+ checked = checked,+ onCheckedChange = { onCheckedChange(it) }+ )+ }+ }+}++private fun formatLatestReleaseLabel(update: AppUpdateUiModel, context: android.content.Context): String {+ val versionName = update.latestVersionName ?: return context.getString(R.string.settings_update_not_checked)+ val versionCodeSuffix = update.latestVersionCode?.let { " ($it)" }.orEmpty()+ return "$versionName$versionCodeSuffix"+}++private fun formatUpdateStatusLabel(update: AppUpdateUiModel, context: android.content.Context): String {+ val downloadedReleaseMatchesLatest = update.downloadedVersionName != null &&+ (update.latestVersionName == null || update.downloadedVersionName == update.latestVersionName)+ return when {+ update.errorMessage != null -> context.getString(R.string.settings_update_status_check_failed)+ update.downloadStatus == com.streamvault.app.update.AppUpdateDownloadStatus.Downloading -> context.getString(R.string.settings_update_status_downloading)+ update.downloadStatus == com.streamvault.app.update.AppUpdateDownloadStatus.Downloaded && downloadedReleaseMatchesLatest -> context.getString(R.string.settings_update_status_ready_to_install)+ update.latestVersionName == null -> context.getString(R.string.settings_update_not_checked)+ update.isUpdateAvailable -> context.getString(R.string.settings_update_status_available)+ else -> context.getString(R.string.settings_update_status_current)+ }+}++private fun formatUpdateCheckTimeLabel(timestamp: Long?, context: android.content.Context): String {+ if (timestamp == null || timestamp <= 0L) {+ return context.getString(R.string.settings_update_not_checked)+ }+ return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(java.util.Date(timestamp))+}++private fun shouldShowUpdateDownloadAction(update: AppUpdateUiModel): Boolean {+ val downloadedReleaseMatchesLatest = update.downloadedVersionName != null &&+ (update.latestVersionName == null || update.downloadedVersionName == update.latestVersionName)+ return when (update.downloadStatus) {+ com.streamvault.app.update.AppUpdateDownloadStatus.Downloading,+ com.streamvault.app.update.AppUpdateDownloadStatus.Downloaded -> downloadedReleaseMatchesLatest || (update.isUpdateAvailable && !update.downloadUrl.isNullOrBlank())+ else -> update.isUpdateAvailable && !update.downloadUrl.isNullOrBlank()+ }+}++private fun formatUpdateDownloadLabel(update: AppUpdateUiModel, context: android.content.Context): String {+ val downloadedReleaseMatchesLatest = update.downloadedVersionName != null &&+ (update.latestVersionName == null || update.downloadedVersionName == update.latestVersionName)+ return when (update.downloadStatus) {+ com.streamvault.app.update.AppUpdateDownloadStatus.Downloading -> context.getString(R.string.settings_update_download_in_progress)+ com.streamvault.app.update.AppUpdateDownloadStatus.Downloaded -> {+ if (downloadedReleaseMatchesLatest) {+ context.getString(R.string.settings_update_install_action)+ } else {+ context.getString(R.string.settings_update_download_action)+ }+ }+ else -> context.getString(R.string.settings_update_download_action)+ }+}+@Composableprivate fun InternetSpeedTestCard(valueLabel: String,@@ -3535,6 +4061,24 @@ private fun formatPlaybackSpeedLabel(speed: Float): String {}}+private fun playerTimeoutOptions(): List<Int> = listOf(2, 3, 4, 5, 6, 8, 10, 15, 20, 30)++private fun formatDecoderModeLabel(mode: DecoderMode, context: android.content.Context): String {+ return when (mode) {+ DecoderMode.AUTO -> context.getString(R.string.settings_decoder_auto)+ DecoderMode.HARDWARE -> context.getString(R.string.settings_decoder_hardware)+ DecoderMode.SOFTWARE -> context.getString(R.string.settings_decoder_software)+ }+}++private fun formatTimeoutSecondsLabel(seconds: Int, context: android.content.Context): String {+ return context.resources.getQuantityString(+ R.plurals.settings_timeout_seconds,+ seconds,+ seconds+ )+}+private fun formatSubtitleSizeLabel(scale: Float, context: android.content.Context): String {return subtitleSizeOptions().firstOrNull { it.scale == scale }?.label?.invoke(context)?: context.getString(R.string.settings_subtitle_size_default)diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.ktindex 8fdcfdc0..dafe36a2 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt@@ -4,10 +4,16 @@ import android.app.Applicationimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScopeimport com.streamvault.app.R+import com.streamvault.app.BuildConfigimport com.streamvault.app.tvinput.TvInputChannelSyncManagerimport com.streamvault.app.ui.model.LiveTvChannelModeimport com.streamvault.app.ui.model.LiveTvQuickFilterVisibilityModeimport com.streamvault.app.ui.model.VodViewMode+import com.streamvault.app.update.AppUpdateDownloadState+import com.streamvault.app.update.AppUpdateDownloadStatus+import com.streamvault.app.update.AppUpdateInstaller+import com.streamvault.app.update.GitHubReleaseChecker+import com.streamvault.app.update.GitHubReleaseInfoimport com.streamvault.data.preferences.PreferencesRepositoryimport com.streamvault.data.sync.SyncManagerimport com.streamvault.data.sync.SyncRepairSection@@ -20,6 +26,7 @@ import com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.CategorySortModeimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.DecoderModeimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.ProviderStatusimport com.streamvault.domain.model.ProviderType@@ -46,6 +53,7 @@ import dagger.hilt.android.lifecycle.HiltViewModelimport kotlinx.coroutines.ExperimentalCoroutinesApiimport kotlinx.coroutines.flow.*import kotlinx.coroutines.launch+import kotlin.math.maximport javax.inject.Injectenum class ProviderWarningAction {@@ -70,7 +78,13 @@ private data class SettingsPreferenceSnapshot(val hasParentalPin: Boolean,val appLanguage: String,val preferredAudioLanguage: String,+ val playerMediaSessionEnabled: Boolean,+ val playerDecoderMode: DecoderMode,val playerPlaybackSpeed: Float,+ val playerControlsTimeoutSeconds: Int,+ val playerLiveOverlayTimeoutSeconds: Int,+ val playerNoticeTimeoutSeconds: Int,+ val playerDiagnosticsTimeoutSeconds: Int,val subtitleTextScale: Float,val subtitleTextColor: Int,val subtitleBackgroundColor: Int,@@ -88,7 +102,29 @@ private data class SettingsPreferenceSnapshot(val liveTvQuickFilterVisibilityMode: LiveTvQuickFilterVisibilityMode,val liveChannelNumberingMode: ChannelNumberingMode,val vodViewMode: VodViewMode,- val preventStandbyDuringPlayback: Boolean+ val preventStandbyDuringPlayback: Boolean,+ val autoCheckAppUpdates: Boolean,+ val lastAppUpdateCheckAt: Long?,+ val cachedAppUpdateVersionName: String?,+ val cachedAppUpdateVersionCode: Int?,+ val cachedAppUpdateReleaseUrl: String?,+ val cachedAppUpdateDownloadUrl: String?,+ val cachedAppUpdateReleaseNotes: String,+ val cachedAppUpdatePublishedAt: String?+)++data class AppUpdateUiModel(+ val latestVersionName: String? = null,+ val latestVersionCode: Int? = null,+ val releaseUrl: String? = null,+ val downloadUrl: String? = null,+ val releaseNotes: String = "",+ val publishedAt: String? = null,+ val isUpdateAvailable: Boolean = false,+ val lastCheckedAt: Long? = null,+ val errorMessage: String? = null,+ val downloadStatus: AppUpdateDownloadStatus = AppUpdateDownloadStatus.Idle,+ val downloadedVersionName: String? = null)@HiltViewModel@@ -106,11 +142,14 @@ class SettingsViewModel @Inject constructor(private val playbackHistoryRepository: com.streamvault.domain.repository.PlaybackHistoryRepository,private val tvInputChannelSyncManager: TvInputChannelSyncManager,private val syncProvider: SyncProvider,- private val epgSourceRepository: com.streamvault.domain.repository.EpgSourceRepository+ private val epgSourceRepository: com.streamvault.domain.repository.EpgSourceRepository,+ private val gitHubReleaseChecker: GitHubReleaseChecker,+ private val appUpdateInstaller: AppUpdateInstaller) : ViewModel() {private val appContext = applicationprivate val exportBackup = ExportBackup(backupManager)private val importBackup = ImportBackup(backupManager)+ private var updateCheckInFlight = falseprivate val _uiState = MutableStateFlow(SettingsUiState())val uiState: StateFlow<SettingsUiState> = _uiState.asStateFlow()@@ -131,7 +170,13 @@ class SettingsViewModel @Inject constructor(hasParentalPin = hasParentalPin,appLanguage = "system",preferredAudioLanguage = "auto",+ playerMediaSessionEnabled = true,+ playerDecoderMode = DecoderMode.AUTO,playerPlaybackSpeed = 1f,+ playerControlsTimeoutSeconds = 5,+ playerLiveOverlayTimeoutSeconds = 4,+ playerNoticeTimeoutSeconds = 6,+ playerDiagnosticsTimeoutSeconds = 15,subtitleTextScale = 1f,subtitleTextColor = 0xFFFFFFFF.toInt(),subtitleBackgroundColor = 0x80000000.toInt(),@@ -149,14 +194,34 @@ class SettingsViewModel @Inject constructor(liveTvQuickFilterVisibilityMode = LiveTvQuickFilterVisibilityMode.ALWAYS_VISIBLE,liveChannelNumberingMode = ChannelNumberingMode.GROUP,vodViewMode = VodViewMode.MODERN,- preventStandbyDuringPlayback = true+ preventStandbyDuringPlayback = true,+ autoCheckAppUpdates = true,+ lastAppUpdateCheckAt = null,+ cachedAppUpdateVersionName = null,+ cachedAppUpdateVersionCode = null,+ cachedAppUpdateReleaseUrl = null,+ cachedAppUpdateDownloadUrl = null,+ cachedAppUpdateReleaseNotes = "",+ cachedAppUpdatePublishedAt = null)}.combine(preferencesRepository.appLanguage) { snapshot, language ->snapshot.copy(appLanguage = language)}.combine(preferencesRepository.preferredAudioLanguage) { snapshot, preferredAudioLanguage ->snapshot.copy(preferredAudioLanguage = preferredAudioLanguage ?: "auto")+ }.combine(preferencesRepository.playerMediaSessionEnabled) { snapshot, mediaSessionEnabled ->+ snapshot.copy(playerMediaSessionEnabled = mediaSessionEnabled)+ }.combine(preferencesRepository.playerDecoderMode) { snapshot, decoderMode ->+ snapshot.copy(playerDecoderMode = decoderMode)}.combine(preferencesRepository.playerPlaybackSpeed) { snapshot, playerPlaybackSpeed ->snapshot.copy(playerPlaybackSpeed = playerPlaybackSpeed)+ }.combine(preferencesRepository.playerControlsTimeoutSeconds) { snapshot, timeoutSeconds ->+ snapshot.copy(playerControlsTimeoutSeconds = timeoutSeconds)+ }.combine(preferencesRepository.playerLiveOverlayTimeoutSeconds) { snapshot, timeoutSeconds ->+ snapshot.copy(playerLiveOverlayTimeoutSeconds = timeoutSeconds)+ }.combine(preferencesRepository.playerNoticeTimeoutSeconds) { snapshot, timeoutSeconds ->+ snapshot.copy(playerNoticeTimeoutSeconds = timeoutSeconds)+ }.combine(preferencesRepository.playerDiagnosticsTimeoutSeconds) { snapshot, timeoutSeconds ->+ snapshot.copy(playerDiagnosticsTimeoutSeconds = timeoutSeconds)}.combine(preferencesRepository.playerSubtitleTextScale) { snapshot, subtitleTextScale ->snapshot.copy(subtitleTextScale = subtitleTextScale)}.combine(preferencesRepository.playerSubtitleTextColor) { snapshot, subtitleTextColor ->@@ -195,7 +260,24 @@ class SettingsViewModel @Inject constructor(snapshot.copy(vodViewMode = VodViewMode.fromStorage(vodViewMode))}.combine(preferencesRepository.preventStandbyDuringPlayback) { snapshot, preventStandby ->snapshot.copy(preventStandbyDuringPlayback = preventStandby)+ }.combine(preferencesRepository.autoCheckAppUpdates) { snapshot, autoCheckAppUpdates ->+ snapshot.copy(autoCheckAppUpdates = autoCheckAppUpdates)+ }.combine(preferencesRepository.lastAppUpdateCheckTimestamp) { snapshot, lastAppUpdateCheckAt ->+ snapshot.copy(lastAppUpdateCheckAt = lastAppUpdateCheckAt)+ }.combine(preferencesRepository.cachedAppUpdateVersionName) { snapshot, versionName ->+ snapshot.copy(cachedAppUpdateVersionName = versionName)+ }.combine(preferencesRepository.cachedAppUpdateVersionCode) { snapshot, versionCode ->+ snapshot.copy(cachedAppUpdateVersionCode = versionCode)+ }.combine(preferencesRepository.cachedAppUpdateReleaseUrl) { snapshot, releaseUrl ->+ snapshot.copy(cachedAppUpdateReleaseUrl = releaseUrl)+ }.combine(preferencesRepository.cachedAppUpdateDownloadUrl) { snapshot, downloadUrl ->+ snapshot.copy(cachedAppUpdateDownloadUrl = downloadUrl)+ }.combine(preferencesRepository.cachedAppUpdateReleaseNotes) { snapshot, releaseNotes ->+ snapshot.copy(cachedAppUpdateReleaseNotes = releaseNotes)+ }.combine(preferencesRepository.cachedAppUpdatePublishedAt) { snapshot, publishedAt ->+ snapshot.copy(cachedAppUpdatePublishedAt = publishedAt)}.collect { snapshot ->+ val cachedAppUpdate = snapshot.toCachedAppUpdateUiModel()_uiState.update {it.copy(providers = snapshot.providers,@@ -204,7 +286,13 @@ class SettingsViewModel @Inject constructor(hasParentalPin = snapshot.hasParentalPin,appLanguage = snapshot.appLanguage,preferredAudioLanguage = snapshot.preferredAudioLanguage,+ playerMediaSessionEnabled = snapshot.playerMediaSessionEnabled,+ playerDecoderMode = snapshot.playerDecoderMode,playerPlaybackSpeed = snapshot.playerPlaybackSpeed,+ playerControlsTimeoutSeconds = snapshot.playerControlsTimeoutSeconds,+ playerLiveOverlayTimeoutSeconds = snapshot.playerLiveOverlayTimeoutSeconds,+ playerNoticeTimeoutSeconds = snapshot.playerNoticeTimeoutSeconds,+ playerDiagnosticsTimeoutSeconds = snapshot.playerDiagnosticsTimeoutSeconds,subtitleTextScale = snapshot.subtitleTextScale,subtitleTextColor = snapshot.subtitleTextColor,subtitleBackgroundColor = snapshot.subtitleBackgroundColor,@@ -226,12 +314,43 @@ class SettingsViewModel @Inject constructor(liveTvQuickFilterVisibilityMode = snapshot.liveTvQuickFilterVisibilityMode,liveChannelNumberingMode = snapshot.liveChannelNumberingMode,vodViewMode = snapshot.vodViewMode,- preventStandbyDuringPlayback = snapshot.preventStandbyDuringPlayback+ preventStandbyDuringPlayback = snapshot.preventStandbyDuringPlayback,+ autoCheckAppUpdates = snapshot.autoCheckAppUpdates,+ appUpdate = cachedAppUpdate.copy(+ downloadStatus = it.appUpdate.downloadStatus,+ downloadedVersionName = it.appUpdate.downloadedVersionName,+ errorMessage = it.appUpdate.errorMessage+ ))}}}+ viewModelScope.launch {+ combine(+ preferencesRepository.autoCheckAppUpdates,+ preferencesRepository.lastAppUpdateCheckTimestamp+ ) { autoCheckEnabled, lastCheckedAt ->+ autoCheckEnabled to lastCheckedAt+ }.distinctUntilChanged().collect { (autoCheckEnabled, lastCheckedAt) ->+ if (autoCheckEnabled && shouldAutoCheckForUpdates(lastCheckedAt)) {+ checkForAppUpdates(manual = false)+ }+ }+ }++ viewModelScope.launch {+ appUpdateInstaller.downloadState.collect { downloadState ->+ _uiState.update {+ it.copy(appUpdate = it.appUpdate.withDownloadState(downloadState))+ }+ }+ }++ viewModelScope.launch {+ appUpdateInstaller.refreshState()+ }+viewModelScope.launch {providerRepository.getProviders().flatMapLatest { providers ->@@ -365,6 +484,37 @@ class SettingsViewModel @Inject constructor(}}+ fun setM3uVodClassificationEnabled(providerId: Long, enabled: Boolean) {+ viewModelScope.launch {+ val provider = providerRepository.getProvider(providerId) ?: return@launch+ if (provider.type != ProviderType.M3U) return@launch+ when (+ val result = providerRepository.updateProvider(+ provider.copy(m3uVodClassificationEnabled = enabled)+ )+ ) {+ is Result.Error -> {+ _uiState.update { it.copy(userMessage = "Could not save provider setting: ${result.message}") }+ }+ else -> {+ _uiState.update {+ it.copy(+ userMessage = if (enabled) {+ "M3U VOD classification enabled. Refresh the playlist to reclassify content."+ } else {+ "M3U VOD classification disabled. Refresh the playlist to reclassify content."+ }+ )+ }+ }+ }+ }+ }++ fun refreshProviderClassification(providerId: Long) {+ refreshProvider(providerId)+ }+fun setParentalControlLevel(level: Int) {viewModelScope.launch {preferencesRepository.setParentalControlLevel(level)@@ -442,6 +592,51 @@ class SettingsViewModel @Inject constructor(}}+ fun setAutoCheckAppUpdates(enabled: Boolean) {+ viewModelScope.launch {+ preferencesRepository.setAutoCheckAppUpdates(enabled)+ }+ }++ fun checkForAppUpdates() {+ checkForAppUpdates(manual = true)+ }++ fun downloadLatestUpdate() {+ val latestRelease = _uiState.value.appUpdate.toReleaseInfoOrNull() ?: run {+ _uiState.update {+ it.copy(userMessage = appContext.getString(R.string.settings_update_download_unavailable))+ }+ return+ }++ viewModelScope.launch {+ when (val result = appUpdateInstaller.startDownload(latestRelease)) {+ is Result.Error -> _uiState.update {+ it.copy(userMessage = result.message)+ }+ is Result.Success -> _uiState.update {+ it.copy(userMessage = appContext.getString(R.string.settings_update_download_started))+ }+ else -> Unit+ }+ }+ }++ fun installDownloadedUpdate() {+ viewModelScope.launch {+ when (val result = appUpdateInstaller.installDownloadedUpdate()) {+ is Result.Error -> _uiState.update {+ it.copy(userMessage = result.message)+ }+ is Result.Success -> _uiState.update {+ it.copy(userMessage = appContext.getString(R.string.settings_update_install_started))+ }+ else -> Unit+ }+ }+ }+fun setCategorySortMode(type: ContentType, mode: CategorySortMode) {val providerId = _uiState.value.activeProviderId ?: returnviewModelScope.launch {@@ -468,6 +663,42 @@ class SettingsViewModel @Inject constructor(}}+ fun setPlayerMediaSessionEnabled(enabled: Boolean) {+ viewModelScope.launch {+ preferencesRepository.setPlayerMediaSessionEnabled(enabled)+ }+ }++ fun setPlayerDecoderMode(mode: DecoderMode) {+ viewModelScope.launch {+ preferencesRepository.setPlayerDecoderMode(mode)+ }+ }++ fun setPlayerControlsTimeoutSeconds(seconds: Int) {+ viewModelScope.launch {+ preferencesRepository.setPlayerControlsTimeoutSeconds(seconds)+ }+ }++ fun setPlayerLiveOverlayTimeoutSeconds(seconds: Int) {+ viewModelScope.launch {+ preferencesRepository.setPlayerLiveOverlayTimeoutSeconds(seconds)+ }+ }++ fun setPlayerNoticeTimeoutSeconds(seconds: Int) {+ viewModelScope.launch {+ preferencesRepository.setPlayerNoticeTimeoutSeconds(seconds)+ }+ }++ fun setPlayerDiagnosticsTimeoutSeconds(seconds: Int) {+ viewModelScope.launch {+ preferencesRepository.setPlayerDiagnosticsTimeoutSeconds(seconds)+ }+ }+fun setPreferredAudioLanguage(languageTag: String?) {viewModelScope.launch {preferencesRepository.setPreferredAudioLanguage(languageTag)@@ -773,6 +1004,107 @@ class SettingsViewModel @Inject constructor(_uiState.update { it.copy(userMessage = null) }}+ private fun checkForAppUpdates(manual: Boolean) {+ if (updateCheckInFlight) return+ updateCheckInFlight = true+ viewModelScope.launch {+ val checkedAt = System.currentTimeMillis()+ _uiState.update {+ it.copy(+ isCheckingForUpdates = true,+ appUpdate = it.appUpdate.copy(errorMessage = null)+ )+ }+ preferencesRepository.setLastAppUpdateCheckTimestamp(checkedAt)+ when (val result = gitHubReleaseChecker.fetchLatestRelease()) {+ is Result.Error -> {+ _uiState.update {+ it.copy(+ isCheckingForUpdates = false,+ userMessage = if (manual) result.message else it.userMessage,+ appUpdate = it.appUpdate.copy(+ lastCheckedAt = checkedAt,+ errorMessage = result.message+ )+ )+ }+ }+ is Result.Success -> {+ val release = result.data+ preferencesRepository.setCachedAppUpdateRelease(+ versionName = release.versionName,+ versionCode = release.versionCode,+ releaseUrl = release.releaseUrl,+ downloadUrl = release.downloadUrl,+ releaseNotes = release.releaseNotes,+ publishedAt = release.publishedAt+ )+ val updateAvailable = isRemoteVersionNewer(+ remoteVersionCode = release.versionCode,+ remoteVersionName = release.versionName+ )+ _uiState.update {+ it.copy(+ isCheckingForUpdates = false,+ userMessage = if (manual) {+ if (updateAvailable) {+ appContext.getString(R.string.settings_update_available_message, release.versionName)+ } else {+ appContext.getString(R.string.settings_update_current_message)+ }+ } else {+ it.userMessage+ },+ appUpdate = AppUpdateUiModel(+ latestVersionName = release.versionName,+ latestVersionCode = release.versionCode,+ releaseUrl = release.releaseUrl,+ downloadUrl = release.downloadUrl,+ releaseNotes = release.releaseNotes,+ publishedAt = release.publishedAt,+ isUpdateAvailable = updateAvailable,+ lastCheckedAt = checkedAt,+ errorMessage = null+ ).withDownloadState(it.appUpdate.toDownloadState())+ )+ }+ appUpdateInstaller.refreshState()+ }+ else -> {+ _uiState.update { it.copy(isCheckingForUpdates = false) }+ }+ }+ updateCheckInFlight = false+ }+ }++ private fun shouldAutoCheckForUpdates(lastCheckedAt: Long?): Boolean {+ val now = System.currentTimeMillis()+ val checkIntervalMs = 24L * 60L * 60L * 1000L+ return lastCheckedAt == null || now - lastCheckedAt >= checkIntervalMs+ }++ private fun isRemoteVersionNewer(remoteVersionCode: Int?, remoteVersionName: String): Boolean {+ if (remoteVersionCode != null && remoteVersionCode > BuildConfig.VERSION_CODE) {+ return true+ }+ return compareVersionNames(remoteVersionName, BuildConfig.VERSION_NAME) > 0+ }++ private fun compareVersionNames(left: String, right: String): Int {+ val leftParts = left.removePrefix("v").split('.')+ val rightParts = right.removePrefix("v").split('.')+ val length = max(leftParts.size, rightParts.size)+ for (index in 0 until length) {+ val leftValue = leftParts.getOrNull(index)?.toIntOrNull() ?: 0+ val rightValue = rightParts.getOrNull(index)?.toIntOrNull() ?: 0+ if (leftValue != rightValue) {+ return leftValue.compareTo(rightValue)+ }+ }+ return 0+ }+fun exportConfig(uriString: String) {viewModelScope.launch {_uiState.update { it.copy(isSyncing = true) }@@ -1102,7 +1434,13 @@ data class SettingsUiState(val hasParentalPin: Boolean = false,val appLanguage: String = "system",val preferredAudioLanguage: String = "auto",+ val playerMediaSessionEnabled: Boolean = true,+ val playerDecoderMode: DecoderMode = DecoderMode.AUTO,val playerPlaybackSpeed: Float = 1f,+ val playerControlsTimeoutSeconds: Int = 5,+ val playerLiveOverlayTimeoutSeconds: Int = 4,+ val playerNoticeTimeoutSeconds: Int = 6,+ val playerDiagnosticsTimeoutSeconds: Int = 15,val subtitleTextScale: Float = 1f,val subtitleTextColor: Int = 0xFFFFFFFF.toInt(),val subtitleBackgroundColor: Int = 0x80000000.toInt(),@@ -1127,9 +1465,73 @@ data class SettingsUiState(val hiddenCategories: List<Category> = emptyList(),val epgSources: List<com.streamvault.domain.model.EpgSource> = emptyList(),val epgSourceAssignments: Map<Long, List<com.streamvault.domain.model.ProviderEpgSourceAssignment>> = emptyMap(),- val epgResolutionSummaries: Map<Long, EpgResolutionSummary> = emptyMap()+ val epgResolutionSummaries: Map<Long, EpgResolutionSummary> = emptyMap(),+ val autoCheckAppUpdates: Boolean = true,+ val isCheckingForUpdates: Boolean = false,+ val appUpdate: AppUpdateUiModel = AppUpdateUiModel())+private fun AppUpdateUiModel.toReleaseInfoOrNull(): GitHubReleaseInfo? {+ val versionName = latestVersionName ?: return null+ val releaseUrl = releaseUrl ?: return null+ return GitHubReleaseInfo(+ versionName = versionName,+ versionCode = latestVersionCode,+ releaseUrl = releaseUrl,+ downloadUrl = downloadUrl,+ releaseNotes = releaseNotes,+ publishedAt = publishedAt+ )+}++private fun AppUpdateUiModel.withDownloadState(downloadState: AppUpdateDownloadState): AppUpdateUiModel {+ return copy(+ downloadStatus = downloadState.status,+ downloadedVersionName = downloadState.versionName+ )+}++private fun AppUpdateUiModel.toDownloadState(): AppUpdateDownloadState {+ return AppUpdateDownloadState(+ status = downloadStatus,+ versionName = downloadedVersionName+ )+}++private fun SettingsPreferenceSnapshot.toCachedAppUpdateUiModel(): AppUpdateUiModel {+ val versionName = cachedAppUpdateVersionName+ return AppUpdateUiModel(+ latestVersionName = versionName,+ latestVersionCode = cachedAppUpdateVersionCode,+ releaseUrl = cachedAppUpdateReleaseUrl,+ downloadUrl = cachedAppUpdateDownloadUrl,+ releaseNotes = cachedAppUpdateReleaseNotes,+ publishedAt = cachedAppUpdatePublishedAt,+ isUpdateAvailable = versionName?.let {+ if (cachedAppUpdateVersionCode != null && cachedAppUpdateVersionCode > BuildConfig.VERSION_CODE) {+ true+ } else {+ compareVersionNamesStatic(it, BuildConfig.VERSION_NAME) > 0+ }+ } ?: false,+ lastCheckedAt = lastAppUpdateCheckAt+ )+}++private fun compareVersionNamesStatic(left: String, right: String): Int {+ val leftParts = left.removePrefix("v").split('.')+ val rightParts = right.removePrefix("v").split('.')+ val length = max(leftParts.size, rightParts.size)+ for (index in 0 until length) {+ val leftValue = leftParts.getOrNull(index)?.toIntOrNull() ?: 0+ val rightValue = rightParts.getOrNull(index)?.toIntOrNull() ?: 0+ if (leftValue != rightValue) {+ return leftValue.compareTo(rightValue)+ }+ }+ return 0+}+private fun ProviderSyncSelection.label(application: Application): String = when (this) {ProviderSyncSelection.ALL -> application.getString(R.string.settings_sync_option_all)ProviderSyncSelection.FAST -> application.getString(R.string.settings_sync_option_fast)diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.ktindex a8726b6c..ff5bd58c 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.kt@@ -172,7 +172,10 @@ fun ParentalControlGroupScreen(onReset = viewModel::resetProtectionChanges)CategoryControlsMode.VISIBILITY -> VisibilitySummaryCard(- hiddenCount = uiState.hiddenCategoryCount+ hiddenCount = uiState.hiddenCategoryCount,+ visibleCount = uiState.visibleCategoryCount,+ onHideAll = viewModel::hideAllCategories,+ onUnhideAll = viewModel::unhideAllCategories)}}@@ -343,7 +346,12 @@ private fun ProtectionSummaryCard(}@Composable-private fun VisibilitySummaryCard(hiddenCount: Int) {+private fun VisibilitySummaryCard(+ hiddenCount: Int,+ visibleCount: Int,+ onHideAll: () -> Unit,+ onUnhideAll: () -> Unit+) {Column(modifier = Modifier.fillMaxWidth()@@ -361,6 +369,23 @@ private fun VisibilitySummaryCard(hiddenCount: Int) {style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant)+ Row(+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ SettingsActionButton(+ label = stringResource(R.string.settings_hide_all_categories),+ enabled = visibleCount > 0,+ emphasized = true,+ onClick = onHideAll+ )+ SettingsActionButton(+ label = stringResource(R.string.settings_unhide_all_categories),+ enabled = hiddenCount > 0,+ emphasized = false,+ onClick = onUnhideAll+ )+ }}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupViewModel.ktindex a1e0f496..2a0a6c66 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupViewModel.kt@@ -15,6 +15,7 @@ import kotlinx.coroutines.flow.SharingStartedimport kotlinx.coroutines.flow.StateFlowimport kotlinx.coroutines.flow.asStateFlowimport kotlinx.coroutines.flow.combine+import kotlinx.coroutines.flow.firstimport kotlinx.coroutines.flow.stateInimport kotlinx.coroutines.flow.updateimport kotlinx.coroutines.launch@@ -37,6 +38,7 @@ data class ParentalControlGroupUiState(val hasPendingProtectionChanges: Boolean = false,val pendingProtectionChangeCount: Int = 0,val hiddenCategoryCount: Int = 0,+ val visibleCategoryCount: Int = 0,val userMessage: String? = null)@@ -136,6 +138,43 @@ class ParentalControlGroupViewModel @Inject constructor(}}+ fun hideAllCategories() {+ viewModelScope.launch {+ val categoriesByType = categoryRepository.getCategories(providerId)+ .first()+ .groupBy(Category::type)+ ContentType.entries+ .filter { it != ContentType.SERIES_EPISODE }+ .forEach { type ->+ val categoryIds = categoriesByType[type]+ .orEmpty()+ .map(Category::id)+ .toSet()+ preferencesRepository.setHiddenCategoryIds(+ providerId = providerId,+ type = type,+ categoryIds = categoryIds+ )+ }+ _userMessage.value = "All categories hidden."+ }+ }++ fun unhideAllCategories() {+ viewModelScope.launch {+ ContentType.entries+ .filter { it != ContentType.SERIES_EPISODE }+ .forEach { type ->+ preferencesRepository.setHiddenCategoryIds(+ providerId = providerId,+ type = type,+ categoryIds = emptySet()+ )+ }+ _userMessage.value = "All categories restored."+ }+ }+suspend fun verifyPin(pin: String): Boolean = preferencesRepository.verifyParentalPin(pin)fun setParentalPin(pin: String) {@@ -226,6 +265,9 @@ private fun buildUiState(hiddenCategoryCount = inputs.categories.count { category ->category.id in inputs.hiddenByType[category.type].orEmpty()},+ visibleCategoryCount = inputs.categories.count { category ->+ category.id !in inputs.hiddenByType[category.type].orEmpty()+ },userMessage = inputs.userMessage)}diff --git a/app/src/main/java/com/streamvault/app/update/AppUpdateInstaller.kt b/app/src/main/java/com/streamvault/app/update/AppUpdateInstaller.ktnew file mode 100644index 00000000..00ea9d8f--- /dev/null+++ b/app/src/main/java/com/streamvault/app/update/AppUpdateInstaller.kt@@ -0,0 +1,223 @@+package com.streamvault.app.update++import android.app.DownloadManager+import android.content.ActivityNotFoundException+import android.content.Context+import android.content.Intent+import android.net.Uri+import android.os.Build+import android.os.Environment+import android.provider.Settings+import androidx.core.content.FileProvider+import com.streamvault.app.BuildConfig+import com.streamvault.data.preferences.PreferencesRepository+import com.streamvault.domain.model.Result+import dagger.hilt.android.qualifiers.ApplicationContext+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import java.io.File+import java.io.IOException+import javax.inject.Inject+import javax.inject.Singleton++data class AppUpdateDownloadState(+ val status: AppUpdateDownloadStatus = AppUpdateDownloadStatus.Idle,+ val versionName: String? = null,+ val downloadId: Long? = null+)++enum class AppUpdateDownloadStatus {+ Idle,+ Downloading,+ Downloaded,+ Failed+}++@Singleton+class AppUpdateInstaller @Inject constructor(+ @ApplicationContext private val context: Context,+ private val preferencesRepository: PreferencesRepository+) {+ private val downloadManager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+ private val _downloadState = MutableStateFlow(AppUpdateDownloadState())++ val downloadState: StateFlow<AppUpdateDownloadState> = _downloadState.asStateFlow()++ init {+ scope.launch {+ refreshState()+ }+ }++ suspend fun refreshState(): AppUpdateDownloadState = withContext(Dispatchers.IO) {+ val downloadId = preferencesRepository.appUpdateDownloadId.first()+ val downloadedVersionName = preferencesRepository.downloadedAppUpdateVersionName.first()+ val apkFile = downloadedVersionName?.let(::apkFileForVersion)++ if (downloadId == null) {+ val restoredState = if (downloadedVersionName != null && apkFile?.exists() == true) {+ AppUpdateDownloadState(+ status = AppUpdateDownloadStatus.Downloaded,+ versionName = downloadedVersionName,+ downloadId = null+ )+ } else {+ if (downloadedVersionName != null) {+ preferencesRepository.setDownloadedAppUpdateVersionName(null)+ }+ AppUpdateDownloadState()+ }+ _downloadState.value = restoredState+ return@withContext restoredState+ }++ val query = DownloadManager.Query().setFilterById(downloadId)+ downloadManager.query(query).use { cursor ->+ if (!cursor.moveToFirst()) {+ preferencesRepository.setAppUpdateDownloadId(null)+ val fallbackState = if (downloadedVersionName != null && apkFile?.exists() == true) {+ AppUpdateDownloadState(+ status = AppUpdateDownloadStatus.Downloaded,+ versionName = downloadedVersionName+ )+ } else {+ preferencesRepository.setDownloadedAppUpdateVersionName(null)+ AppUpdateDownloadState(status = AppUpdateDownloadStatus.Failed)+ }+ _downloadState.value = fallbackState+ return@withContext fallbackState+ }++ val statusColumn = cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)+ val status = cursor.getInt(statusColumn)+ val state = when (status) {+ DownloadManager.STATUS_PENDING,+ DownloadManager.STATUS_PAUSED,+ DownloadManager.STATUS_RUNNING -> AppUpdateDownloadState(+ status = AppUpdateDownloadStatus.Downloading,+ versionName = downloadedVersionName,+ downloadId = downloadId+ )++ DownloadManager.STATUS_SUCCESSFUL -> {+ preferencesRepository.setAppUpdateDownloadId(null)+ AppUpdateDownloadState(+ status = AppUpdateDownloadStatus.Downloaded,+ versionName = downloadedVersionName,+ downloadId = null+ )+ }++ else -> {+ preferencesRepository.setAppUpdateDownloadId(null)+ AppUpdateDownloadState(+ status = AppUpdateDownloadStatus.Failed,+ versionName = downloadedVersionName,+ downloadId = null+ )+ }+ }+ _downloadState.value = state+ return@withContext state+ }+ }++ suspend fun startDownload(releaseInfo: GitHubReleaseInfo): Result<Unit> = withContext(Dispatchers.IO) {+ val downloadUrl = releaseInfo.downloadUrl+ ?: return@withContext Result.error("Update download is unavailable for this release")++ try {+ val targetFile = apkFileForVersion(releaseInfo.versionName)+ targetFile.parentFile?.mkdirs()+ if (targetFile.exists()) {+ targetFile.delete()+ }++ val existingVersion = preferencesRepository.downloadedAppUpdateVersionName.first()+ if (existingVersion != null && existingVersion != releaseInfo.versionName) {+ apkFileForVersion(existingVersion).delete()+ }++ val request = DownloadManager.Request(Uri.parse(downloadUrl))+ .setTitle("StreamVault ${releaseInfo.versionName}")+ .setDescription("Downloading the latest StreamVault update")+ .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)+ .setMimeType("application/vnd.android.package-archive")+ .setAllowedOverMetered(true)+ .setAllowedOverRoaming(true)+ .setDestinationUri(Uri.fromFile(targetFile))++ val downloadId = downloadManager.enqueue(request)+ preferencesRepository.setDownloadedAppUpdateVersionName(releaseInfo.versionName)+ preferencesRepository.setAppUpdateDownloadId(downloadId)+ _downloadState.value = AppUpdateDownloadState(+ status = AppUpdateDownloadStatus.Downloading,+ versionName = releaseInfo.versionName,+ downloadId = downloadId+ )+ Result.success(Unit)+ } catch (error: IllegalArgumentException) {+ Result.error("Failed to start update download", error)+ } catch (error: SecurityException) {+ Result.error("Update download requires additional permissions", error)+ }+ }++ suspend fun installDownloadedUpdate(): Result<Unit> = withContext(Dispatchers.IO) {+ val currentState = refreshState()+ if (currentState.status != AppUpdateDownloadStatus.Downloaded || currentState.versionName.isNullOrBlank()) {+ return@withContext Result.error("No downloaded update is ready to install")+ }++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !context.packageManager.canRequestPackageInstalls()) {+ val settingsIntent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).apply {+ data = Uri.parse("package:${context.packageName}")+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }+ context.startActivity(settingsIntent)+ return@withContext Result.error("Allow installs from this app, then try Install update again")+ }++ val apkFile = apkFileForVersion(currentState.versionName)+ if (!apkFile.exists()) {+ preferencesRepository.setDownloadedAppUpdateVersionName(null)+ return@withContext Result.error("Downloaded update file is missing")+ }++ val apkUri = FileProvider.getUriForFile(+ context,+ "${BuildConfig.APPLICATION_ID}.fileprovider",+ apkFile+ )++ val installIntent = Intent(Intent.ACTION_VIEW).apply {+ setDataAndType(apkUri, "application/vnd.android.package-archive")+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ }++ try {+ context.startActivity(installIntent)+ Result.success(Unit)+ } catch (error: ActivityNotFoundException) {+ Result.error("No package installer is available on this device", error)+ } catch (error: SecurityException) {+ Result.error("The package installer could not be launched", error)+ }+ }++ private fun apkFileForVersion(versionName: String): File {+ val sanitizedVersion = versionName.replace(Regex("[^A-Za-z0-9._-]"), "_")+ val downloadsDir = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)+ ?: File(context.cacheDir, "downloads")+ return File(downloadsDir, "StreamVault-$sanitizedVersion.apk")+ }+}\ No newline at end of filediff --git a/app/src/main/java/com/streamvault/app/update/GitHubReleaseChecker.kt b/app/src/main/java/com/streamvault/app/update/GitHubReleaseChecker.ktnew file mode 100644index 00000000..4330766c--- /dev/null+++ b/app/src/main/java/com/streamvault/app/update/GitHubReleaseChecker.kt@@ -0,0 +1,93 @@+package com.streamvault.app.update++import com.streamvault.domain.model.Result+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.withContext+import okhttp3.OkHttpClient+import okhttp3.Request+import org.json.JSONObject+import java.io.IOException+import javax.inject.Inject+import javax.inject.Singleton++data class GitHubReleaseInfo(+ val versionName: String,+ val versionCode: Int?,+ val releaseUrl: String,+ val downloadUrl: String?,+ val releaseNotes: String,+ val publishedAt: String?+)++@Singleton+class GitHubReleaseChecker @Inject constructor(+ private val okHttpClient: OkHttpClient+) {+ private companion object {+ private const val RELEASES_LATEST_URL = "https://api.github.com/repos/Davidona/StreamVault-IPTV/releases/latest"+ private val VERSION_CODE_REGEX = Regex("""code\s*`?(\d+)`?""", RegexOption.IGNORE_CASE)+ }++ suspend fun fetchLatestRelease(): Result<GitHubReleaseInfo> = withContext(Dispatchers.IO) {+ try {+ val request = Request.Builder()+ .url(RELEASES_LATEST_URL)+ .header("Accept", "application/vnd.github+json")+ .header("User-Agent", "StreamVault-Update-Checker")+ .build()++ okHttpClient.newCall(request).execute().use { response ->+ if (!response.isSuccessful) {+ return@withContext Result.error("Update check failed: HTTP ${response.code}")+ }++ val body = response.body?.string().orEmpty()+ if (body.isBlank()) {+ return@withContext Result.error("Update check failed: empty GitHub release response")+ }++ val json = JSONObject(body)+ val tagName = json.optString("tag_name").removePrefix("v").trim()+ if (tagName.isBlank()) {+ return@withContext Result.error("Update check failed: latest release tag is missing")+ }++ val notes = json.optString("body").trim()+ val assets = json.optJSONArray("assets")+ val downloadUrl = findApkAssetUrl(assets)++ return@withContext Result.success(+ GitHubReleaseInfo(+ versionName = tagName,+ versionCode = VERSION_CODE_REGEX.find(notes)?.groupValues?.getOrNull(1)?.toIntOrNull(),+ releaseUrl = json.optString("html_url"),+ downloadUrl = downloadUrl,+ releaseNotes = notes,+ publishedAt = json.optString("published_at").takeIf { it.isNotBlank() }+ )+ )+ }+ } catch (error: IOException) {+ Result.error("Update check failed: network error", error)+ } catch (error: Exception) {+ Result.error("Update check failed: ${error.message}", error)+ }+ }++ private fun findApkAssetUrl(assets: org.json.JSONArray?): String? {+ if (assets == null) return null+ var fallback: String? = null+ for (index in 0 until assets.length()) {+ val asset = assets.optJSONObject(index) ?: continue+ val name = asset.optString("name")+ val url = asset.optString("browser_download_url").takeIf { it.isNotBlank() } ?: continue+ if (name.equals("StreamVault.apk", ignoreCase = true)) {+ return url+ }+ if (fallback == null && name.endsWith(".apk", ignoreCase = true)) {+ fallback = url+ }+ }+ return fallback+ }+}\ No newline at end of filediff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 1e2d8a3b..b1a5d8fd 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -110,6 +110,11 @@<string name="dashboard_provider_no_expiry">No expiry reported</string><string name="dashboard_warning_title">Provider Needs Attention</string><string name="dashboard_warning_review">Open Provider Details</string>+ <string name="dashboard_update_title">StreamVault %1$s is available</string>+ <string name="dashboard_update_available">A newer app release is cached and ready to review from Settings.</string>+ <string name="dashboard_update_install_ready">The latest update has already been downloaded. Open Settings to install it.</string>+ <string name="dashboard_update_open_settings">Open Updates</string>+ <string name="dashboard_update_open_installer">Install From Settings</string><string name="dashboard_updated_series_badge">Updated series</string><string name="dashboard_stat_live">%1$d live</string><string name="dashboard_stat_favorites">%1$d favorites</string>@@ -259,6 +264,9 @@<string name="settings_provider_category_controls_title">Category Controls</string><string name="settings_provider_category_controls_subtitle">Lock, unlock, hide, and restore categories for the current playlist from one place.</string><string name="settings_provider_category_controls_search">Search categories...</string>+ <string name="settings_m3u_vod_classification_title">M3U VOD Classification</string>+ <string name="settings_m3u_vod_classification_summary">Uses the M3U URL and group-title rules to move matching entries into Movies. Refresh after changing this to rearrange the playlist.</string>+ <string name="settings_m3u_vod_classification_refresh">Refresh Classification</string><string name="settings_categories_title">Category Preferences</string><string name="settings_categories_subtitle">Hide provider categories and keep their sort order exactly how you want it.</string><string name="settings_category_sorting_title">Category Sorting</string>@@ -273,6 +281,8 @@<string name="settings_hidden_categories_empty">No hidden categories right now.</string><string name="settings_unhide_category">Unhide</string><string name="settings_hide_category">Hide</string>+ <string name="settings_hide_all_categories">Hide All</string>+ <string name="settings_unhide_all_categories">Unhide All</string><string name="settings_category_sort_default">Provider Order</string><string name="settings_category_sort_az">A-Z</string><string name="settings_category_sort_za">Z-A</string>@@ -313,6 +323,20 @@<string name="settings_live_channel_numbering_mode">Live TV Channel Numbering</string><string name="settings_live_channel_numbering_mode_subtitle">Choose whether live channels use their position in the current group or keep the original numbers from the provider.</string><string name="settings_default_playback_speed">Default Playback Speed</string>+ <string name="settings_media_session">System Media Session</string>+ <string name="settings_media_session_subtitle">Expose playback to Android system media controls. Disable this if playback crashes on a specific device when opening the player.</string>+ <string name="settings_player_controls_timeout">VOD Controls Auto-Hide</string>+ <string name="settings_live_overlay_timeout">Live TV Overlays Auto-Hide</string>+ <string name="settings_player_notice_timeout">Playback Notices Auto-Hide</string>+ <string name="settings_player_diagnostics_timeout">Diagnostics Overlay Auto-Hide</string>+ <string name="settings_timeout_vod_controls_subtitle">How long the movie and series playback controls stay visible after the last interaction.</string>+ <string name="settings_timeout_live_overlays_subtitle">How long Live TV overlays like channel info, channel list, and EPG stay visible after the last interaction.</string>+ <string name="settings_timeout_notices_subtitle">How long temporary playback notices stay visible before they disappear.</string>+ <string name="settings_timeout_diagnostics_subtitle">How long the diagnostics overlay stays visible before it closes automatically.</string>+ <string name="settings_timeout_seconds_label">Seconds</string>+ <string name="settings_timeout_seconds_placeholder">Enter 2-60</string>+ <string name="settings_timeout_apply">Apply</string>+ <string name="settings_timeout_validation">Enter a value between 2 and 60 seconds.</string><string name="settings_preferred_audio_language">Preferred Audio Language</string><string name="settings_audio_language_auto">Automatic (App or Device Language)</string><string name="settings_subtitle_size">Subtitle Size</string>@@ -342,6 +366,10 @@<string name="settings_speed_test_transport_other">Other network</string><string name="settings_speed_test_transport_unknown">Unknown network</string><string name="settings_select_playback_speed">Select Default Playback Speed</string>+ <plurals name="settings_timeout_seconds">+ <item quantity="one">%d second</item>+ <item quantity="other">%d seconds</item>+ </plurals><string name="settings_select_audio_language">Select Preferred Audio Language</string><string name="settings_select_subtitle_size">Select Subtitle Size</string><string name="settings_select_subtitle_text_color">Select Subtitle Text Color</string>@@ -385,6 +413,9 @@<string name="vod_classic_empty_category">No titles found in this section.</string><string name="settings_decoder_mode">Decoder Mode</string><string name="settings_decoder_auto">Auto (HW preferred)</string>+ <string name="settings_decoder_hardware">Hardware Only</string>+ <string name="settings_decoder_software">Prefer Software Extensions</string>+ <string name="settings_select_decoder_mode">Select Decoder Mode</string><string name="settings_buffer_duration">Buffer Duration</string><string name="settings_buffer_5s">5 seconds</string><string name="settings_about">About</string>@@ -392,12 +423,41 @@<string name="settings_app_version">App Version</string><string name="settings_build">Build</string><string name="settings_build_desc">StreamVault for Android TV</string>+ <string name="settings_enabled">Enabled</string>+ <string name="settings_disabled">Disabled</string><string name="settings_developed_by">Developed by</string><string name="settings_developer_name">David Nashash</string><string name="settings_github">GitHub</string><string name="settings_github_url">https://github.com/Davidona</string><string name="settings_donate">Support on Ko-fi</string><string name="settings_donate_url">https://ko-fi.com/davidona</string>+ <string name="settings_updates_title">Updates</string>+ <string name="settings_updates_subtitle">Check GitHub Releases for newer StreamVault versions without leaving the app.</string>+ <string name="settings_update_auto_check">Automatically check for updates</string>+ <string name="settings_update_latest_release">Latest release</string>+ <string name="settings_update_status">Update status</string>+ <string name="settings_update_last_checked">Last checked</string>+ <string name="settings_update_check_now">Check for updates</string>+ <string name="settings_update_check_action">Check now</string>+ <string name="settings_update_checking">Checking...</string>+ <string name="settings_update_download">Update package</string>+ <string name="settings_update_download_action">Download update</string>+ <string name="settings_update_download_in_progress">Downloading...</string>+ <string name="settings_update_download_started">Update download started. Install will be available when it finishes.</string>+ <string name="settings_update_download_unavailable">No downloadable update package is available for this release.</string>+ <string name="settings_update_install_action">Install update</string>+ <string name="settings_update_install_started">Opening the package installer.</string>+ <string name="settings_update_view_release">Open latest release</string>+ <string name="settings_update_release_notes">Release page</string>+ <string name="settings_update_error">Update check</string>+ <string name="settings_update_not_checked">Not checked yet</string>+ <string name="settings_update_status_available">Update available</string>+ <string name="settings_update_status_current">Up to date</string>+ <string name="settings_update_status_check_failed">Last check failed</string>+ <string name="settings_update_status_downloading">Downloading update</string>+ <string name="settings_update_status_ready_to_install">Ready to install</string>+ <string name="settings_update_available_message">StreamVault %1$s is available.</string>+ <string name="settings_update_current_message">You already have the latest StreamVault release.</string><string name="settings_syncing">Syncing data, please wait...</string><string name="settings_syncing_title">Syncing data...</string><string name="settings_syncing_subtitle">Please wait while your playlist is imported.</string>@@ -662,6 +722,8 @@<string name="setup_advanced_options_hide">Hide</string><string name="setup_xtream_fast_sync_label">Fast Sync</string><string name="setup_xtream_fast_sync_helper">Xtream only. Loads VOD categories first and fetches movie rows on demand. Recommended for very large providers.</string>+ <string name="setup_m3u_vod_classification_label">M3U VOD Classification</string>+ <string name="setup_m3u_vod_classification_helper">M3U only. Use playlist URL and group-title heuristics to sort matching entries into Movies instead of Live TV.</string><string name="setup_epg_sync_mode_label">EPG Sync</string><string name="setup_epg_sync_mode_helper">Upfront keeps today’s behavior. Background finishes setup first, and Skip leaves guide refresh for later.</string><string name="setup_epg_sync_mode_upfront_title">Full EPG now</string>diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xmlnew file mode 100644index 00000000..e3d5a603--- /dev/null+++ b/app/src/main/res/xml/file_paths.xml@@ -0,0 +1,9 @@+<?xml version="1.0" encoding="utf-8"?>+<paths>+ <external-files-path+ name="downloads"+ path="Download/" />+ <cache-path+ name="cache"+ path="." />+</paths>\ No newline at end of filediff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/28.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/28.jsonnew file mode 100644index 00000000..2963dddb--- /dev/null+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/28.json@@ -0,0 +1,3007 @@+{+ "formatVersion": 1,+ "database": {+ "version": 28,+ "identityHash": "fd8d94065bb029a29761e1f4b77dbaf8",+ "entities": [+ {+ "tableName": "providers",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `server_url` TEXT NOT NULL, `username` TEXT NOT NULL, `password` TEXT NOT NULL, `m3u_url` TEXT NOT NULL, `epg_url` TEXT NOT NULL, `is_active` INTEGER NOT NULL, `max_connections` INTEGER NOT NULL, `expiration_date` INTEGER, `api_version` TEXT, `allowed_output_formats_json` TEXT NOT NULL, `epg_sync_mode` TEXT NOT NULL, `xtream_fast_sync_enabled` INTEGER NOT NULL, `m3u_vod_classification_enabled` INTEGER NOT NULL, `status` TEXT NOT NULL, `last_synced_at` INTEGER NOT NULL, `created_at` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "serverUrl",+ "columnName": "server_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "username",+ "columnName": "username",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "password",+ "columnName": "password",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "m3uUrl",+ "columnName": "m3u_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgUrl",+ "columnName": "epg_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isActive",+ "columnName": "is_active",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "maxConnections",+ "columnName": "max_connections",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "expirationDate",+ "columnName": "expiration_date",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "apiVersion",+ "columnName": "api_version",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "allowedOutputFormatsJson",+ "columnName": "allowed_output_formats_json",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgSyncMode",+ "columnName": "epg_sync_mode",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "xtreamFastSyncEnabled",+ "columnName": "xtream_fast_sync_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "m3uVodClassificationEnabled",+ "columnName": "m3u_vod_classification_enabled",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSyncedAt",+ "columnName": "last_synced_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "created_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_providers_server_url_username",+ "unique": true,+ "columnNames": [+ "server_url",+ "username"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_providers_server_url_username` ON `${TABLE_NAME}` (`server_url`, `username`)"+ }+ ]+ },+ {+ "tableName": "channels",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `quality_options_json` TEXT, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "qualityOptionsJson",+ "columnName": "quality_options_json",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_channels_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`)"+ },+ {+ "name": "index_channels_provider_id_stream_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "stream_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_channels_provider_id_stream_id` ON `${TABLE_NAME}` (`provider_id`, `stream_id`)"+ },+ {+ "name": "index_channels_logical_group_id",+ "unique": false,+ "columnNames": [+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_logical_group_id` ON `${TABLE_NAME}` (`logical_group_id`)"+ },+ {+ "name": "index_channels_provider_id_category_id_logical_group_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "category_id",+ "logical_group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channels_provider_id_category_id_logical_group_id` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `logical_group_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_preferences",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `channel_id` INTEGER NOT NULL, `aspect_ratio` TEXT, `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": "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, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "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": "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+ }+ ],+ "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`)"+ }+ ],+ "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, `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, 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": "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+ }+ ],+ "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`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "series_fts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`name` TEXT NOT NULL, content=`series`)",+ "fields": [+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": []+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "simple",+ "tokenizerArgs": [],+ "contentTable": "series",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_UPDATE BEFORE UPDATE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_BEFORE_DELETE BEFORE DELETE ON `series` BEGIN DELETE FROM `series_fts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_UPDATE AFTER UPDATE ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_series_fts_AFTER_INSERT AFTER INSERT ON `series` BEGIN INSERT INTO `series_fts`(`docid`, `name`) VALUES (NEW.`rowid`, NEW.`name`); END"+ ]+ },+ {+ "tableName": "episodes",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `episode_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `episode_number` INTEGER NOT NULL, `season_number` INTEGER NOT NULL, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `cover_url` TEXT, `plot` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `release_date` TEXT, `series_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `watch_progress` INTEGER NOT NULL, `last_watched_at` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`series_id`) REFERENCES `series`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "episodeId",+ "columnName": "episode_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "episodeNumber",+ "columnName": "episode_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "seasonNumber",+ "columnName": "season_number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "containerExtension",+ "columnName": "container_extension",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "coverUrl",+ "columnName": "cover_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "plot",+ "columnName": "plot",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "duration",+ "columnName": "duration",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "duration_seconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "REAL",+ "notNull": true+ },+ {+ "fieldPath": "releaseDate",+ "columnName": "release_date",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "seriesId",+ "columnName": "series_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "watchProgress",+ "columnName": "watch_progress",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastWatchedAt",+ "columnName": "last_watched_at",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_episodes_series_id",+ "unique": false,+ "columnNames": [+ "series_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_series_id` ON `${TABLE_NAME}` (`series_id`)"+ },+ {+ "name": "index_episodes_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_episodes_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_episodes_provider_id_episode_id",+ "unique": true,+ "columnNames": [+ "provider_id",+ "episode_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_episodes_provider_id_episode_id` ON `${TABLE_NAME}` (`provider_id`, `episode_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ },+ {+ "table": "series",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "series_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "categories",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `provider_id` INTEGER NOT NULL, `is_adult` INTEGER NOT NULL, `is_user_protected` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isUserProtected",+ "columnName": "is_user_protected",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_categories_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_categories_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_categories_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ },+ {+ "name": "index_categories_provider_id_category_id_type",+ "unique": true,+ "columnNames": [+ "provider_id",+ "category_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_provider_id_category_id_type` ON `${TABLE_NAME}` (`provider_id`, `category_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "channel_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `logo_url` TEXT, `group_title` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `epg_channel_id` TEXT, `number` INTEGER NOT NULL, `catch_up_supported` INTEGER NOT NULL, `catch_up_days` INTEGER NOT NULL, `catchUpSource` TEXT, `is_adult` INTEGER NOT NULL, `logical_group_id` TEXT NOT NULL, `error_count` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `stream_id`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "streamId",+ "columnName": "stream_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "logoUrl",+ "columnName": "logo_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "groupTitle",+ "columnName": "group_title",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "categoryName",+ "columnName": "category_name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "streamUrl",+ "columnName": "stream_url",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "epgChannelId",+ "columnName": "epg_channel_id",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "number",+ "columnName": "number",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSupported",+ "columnName": "catch_up_supported",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpDays",+ "columnName": "catch_up_days",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "catchUpSource",+ "columnName": "catchUpSource",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "logicalGroupId",+ "columnName": "logical_group_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "errorCount",+ "columnName": "error_count",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "stream_id"+ ]+ },+ "indices": [+ {+ "name": "index_channel_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_channel_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_channel_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "movie_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `poster_url` TEXT, `backdrop_url` TEXT, `category_id` INTEGER, `category_name` TEXT, `stream_url` TEXT NOT NULL, `container_extension` TEXT, `plot` TEXT, `cast` TEXT, `director` TEXT, `genre` TEXT, `release_date` TEXT, `duration` TEXT, `duration_seconds` INTEGER NOT NULL, `rating` REAL NOT NULL, `year` TEXT, `tmdb_id` INTEGER, `youtube_trailer` TEXT, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, 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+ }+ ],+ "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, `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`, `series_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": "seriesId",+ "columnName": "series_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": "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",+ "series_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_series_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "category_import_stage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`session_id` INTEGER NOT NULL, `provider_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `parent_id` INTEGER, `type` TEXT NOT NULL, `is_adult` INTEGER NOT NULL, `sync_fingerprint` TEXT NOT NULL, PRIMARY KEY(`session_id`, `provider_id`, `category_id`, `type`), FOREIGN KEY(`provider_id`) REFERENCES `providers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",+ "fields": [+ {+ "fieldPath": "sessionId",+ "columnName": "session_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "categoryId",+ "columnName": "category_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentId",+ "columnName": "parent_id",+ "affinity": "INTEGER"+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isAdult",+ "columnName": "is_adult",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "syncFingerprint",+ "columnName": "sync_fingerprint",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "session_id",+ "provider_id",+ "category_id",+ "type"+ ]+ },+ "indices": [+ {+ "name": "index_category_import_stage_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_category_import_stage_session_id_provider_id",+ "unique": false,+ "columnNames": [+ "session_id",+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_session_id_provider_id` ON `${TABLE_NAME}` (`session_id`, `provider_id`)"+ },+ {+ "name": "index_category_import_stage_provider_id_type",+ "unique": false,+ "columnNames": [+ "provider_id",+ "type"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_category_import_stage_provider_id_type` ON `${TABLE_NAME}` (`provider_id`, `type`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "programs",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `provider_id` INTEGER NOT NULL, `channel_id` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `end_time` INTEGER NOT NULL, `lang` TEXT NOT NULL, `rating` TEXT, `image_url` TEXT, `genre` TEXT, `category` TEXT, `has_archive` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "providerId",+ "columnName": "provider_id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "channelId",+ "columnName": "channel_id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "title",+ "columnName": "title",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "description",+ "columnName": "description",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "start_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endTime",+ "columnName": "end_time",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lang",+ "columnName": "lang",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "rating",+ "columnName": "rating",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "imageUrl",+ "columnName": "image_url",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "genre",+ "columnName": "genre",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "category",+ "columnName": "category",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "hasArchive",+ "columnName": "has_archive",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_programs_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ },+ {+ "name": "index_programs_provider_id_channel_id",+ "unique": false,+ "columnNames": [+ "provider_id",+ "channel_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_programs_provider_id_channel_id` ON `${TABLE_NAME}` (`provider_id`, `channel_id`)"+ },+ {+ "name": "index_programs_provider_id_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, `content_id` INTEGER NOT NULL, `content_type` TEXT NOT NULL, `position` INTEGER NOT NULL, `group_id` INTEGER, `added_at` INTEGER NOT NULL, 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": "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": "addedAt",+ "columnName": "added_at",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_favorites_content_id_content_type_group_id",+ "unique": true,+ "columnNames": [+ "content_id",+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_content_id_content_type_group_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `group_id`)"+ },+ {+ "name": "index_favorites_content_type_group_id",+ "unique": false,+ "columnNames": [+ "content_type",+ "group_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_content_type_group_id` ON `${TABLE_NAME}` (`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": "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, `name` TEXT NOT NULL, `icon_emoji` TEXT, `position` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `content_type` TEXT NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "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_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`)"+ }+ ]+ },+ {+ "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`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "sync_metadata",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`provider_id` INTEGER NOT NULL, `last_live_sync` INTEGER NOT NULL, `last_movie_sync` INTEGER NOT NULL, `last_series_sync` INTEGER NOT NULL, `last_epg_sync` 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": "lastMovieSync",+ "columnName": "last_movie_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastSeriesSync",+ "columnName": "last_series_sync",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastEpgSync",+ "columnName": "last_epg_sync",+ "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, 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"+ }+ ],+ "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, 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"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "provider_id",+ "category_id"+ ]+ },+ "indices": [+ {+ "name": "index_series_category_hydration_provider_id",+ "unique": false,+ "columnNames": [+ "provider_id"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_series_category_hydration_provider_id` ON `${TABLE_NAME}` (`provider_id`)"+ }+ ],+ "foreignKeys": [+ {+ "table": "providers",+ "onDelete": "CASCADE",+ "onUpdate": "NO ACTION",+ "columns": [+ "provider_id"+ ],+ "referencedColumns": [+ "id"+ ]+ }+ ]+ },+ {+ "tableName": "epg_sources",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `last_refresh_at` INTEGER NOT NULL, `last_success_at` INTEGER NOT NULL, `last_error` TEXT, `priority` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",+ "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+ }+ ],+ "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, `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": "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"+ ]+ }+ ]+ }+ ],+ "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, 'fd8d94065bb029a29761e1f4b77dbaf8')"+ ]+ }+}\ No newline at end of filediff --git a/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.kt b/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.ktindex 9f5f5b29..6cebdaeb 100644--- a/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.kt+++ b/data/src/main/java/com/streamvault/data/epg/EpgResolutionEngine.kt@@ -53,8 +53,12 @@ class EpgResolutionEngine @Inject constructor(** @return summary statistics*/- suspend fun resolveForProvider(providerId: Long): EpgResolutionSummary = withContext(Dispatchers.Default) {+ suspend fun resolveForProvider(+ providerId: Long,+ hiddenLiveCategoryIds: Set<Long> = emptySet()+ ): EpgResolutionSummary = withContext(Dispatchers.Default) {val channels = channelDao.getByProviderSync(providerId)+ .filterNot { channel -> channel.categoryId != null && channel.categoryId in hiddenLiveCategoryIds }if (channels.isEmpty()) {channelEpgMappingDao.deleteByProvider(providerId)return@withContext EpgResolutionSummary()diff --git a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.ktindex 7944a102..e44e2dd5 100644--- a/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt+++ b/data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt@@ -37,7 +37,7 @@ import com.streamvault.data.local.entity.*EpgProgrammeEntity::class,ChannelEpgMappingEntity::class],- version = 27,+ version = 28,exportSchema = true // ← was false; schema JSON now tracked in version control)@TypeConverters(RoomEnumConverters::class)@@ -1206,6 +1206,12 @@ abstract class StreamVaultDatabase : RoomDatabase() {}}+ val MIGRATION_27_28 = object : Migration(27, 28) {+ override fun migrate(database: SupportSQLiteDatabase) {+ database.execSQL("ALTER TABLE providers ADD COLUMN m3u_vod_classification_enabled INTEGER NOT NULL DEFAULT 1")+ }+ }+val MIGRATION_24_25 = object : Migration(24, 25) {override fun migrate(database: SupportSQLiteDatabase) {// ── epg_sources ──diff --git a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt b/data/src/main/java/com/streamvault/data/local/entity/Entities.ktindex 8c9664cc..545897d8 100644--- a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt+++ b/data/src/main/java/com/streamvault/data/local/entity/Entities.kt@@ -32,6 +32,7 @@ data class ProviderEntity(@ColumnInfo(name = "allowed_output_formats_json") val allowedOutputFormatsJson: String = "[]",@ColumnInfo(name = "epg_sync_mode") val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,@ColumnInfo(name = "xtream_fast_sync_enabled") val xtreamFastSyncEnabled: Boolean = false,+ @ColumnInfo(name = "m3u_vod_classification_enabled") val m3uVodClassificationEnabled: Boolean = true,val status: ProviderStatus = ProviderStatus.UNKNOWN,@ColumnInfo(name = "last_synced_at") val lastSyncedAt: Long = 0,@ColumnInfo(name = "created_at") val createdAt: Long = System.currentTimeMillis()diff --git a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.ktindex 62d729ab..7296c3b0 100644--- a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt+++ b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt@@ -68,6 +68,8 @@ class BackupManagerImpl @Inject constructor("appLanguage" to preferencesRepository.appLanguage.first(),"liveTvCategoryFilters" to preferencesRepository.liveTvCategoryFilters.first().joinToString("\n"),"liveTvQuickFilterVisibility" to (preferencesRepository.liveTvQuickFilterVisibility.first() ?: "always"),+ "playerMediaSessionEnabled" to preferencesRepository.playerMediaSessionEnabled.first().toString(),+ "playerDecoderMode" to preferencesRepository.playerDecoderMode.first().name,"playerPlaybackSpeed" to preferencesRepository.playerPlaybackSpeed.first().toString(),"preferredAudioLanguage" to (preferencesRepository.preferredAudioLanguage.first() ?: "auto"),"playerSubtitleTextScale" to preferencesRepository.playerSubtitleTextScale.first().toString(),@@ -296,6 +298,15 @@ class BackupManagerImpl @Inject constructor(prefs["liveTvCategoryFilters"]?.let { preferencesRepository.setLiveTvCategoryFilters(it.split('\n')) }prefs["liveTvQuickFilterVisibility"]?.takeIf { it.isNotBlank() }?.let { preferencesRepository.setLiveTvQuickFilterVisibility(it) }+ prefs["playerMediaSessionEnabled"]?.toBooleanStrictOrNull()+ ?.let { preferencesRepository.setPlayerMediaSessionEnabled(it) }+ prefs["playerDecoderMode"]?.takeIf { it.isNotBlank() }?.let { savedMode ->+ val decoderMode = com.streamvault.domain.model.DecoderMode.entries+ .firstOrNull { entry -> entry.name == savedMode }+ if (decoderMode != null) {+ preferencesRepository.setPlayerDecoderMode(decoderMode)+ }+ }prefs["playerPlaybackSpeed"]?.toFloatOrNull()?.let { preferencesRepository.setPlayerPlaybackSpeed(it) }preferencesRepository.setPreferredAudioLanguage(prefs["preferredAudioLanguage"])prefs["playerSubtitleTextScale"]?.toFloatOrNull()?.let { preferencesRepository.setPlayerSubtitleTextScale(it) }diff --git a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.ktindex 8898efdd..0f7259cf 100644--- a/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt+++ b/data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt@@ -27,6 +27,7 @@ fun ProviderEntity.toDomain() = Provider(allowedOutputFormats = decodeAllowedOutputFormats(allowedOutputFormatsJson),epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = xtreamFastSyncEnabled,+ m3uVodClassificationEnabled = m3uVodClassificationEnabled,status = status,lastSyncedAt = lastSyncedAt,createdAt = createdAt@@ -48,6 +49,7 @@ fun Provider.toEntity() = ProviderEntity(allowedOutputFormatsJson = encodeAllowedOutputFormats(allowedOutputFormats),epgSyncMode = epgSyncMode,xtreamFastSyncEnabled = xtreamFastSyncEnabled,+ m3uVodClassificationEnabled = m3uVodClassificationEnabled,status = status,lastSyncedAt = lastSyncedAt,createdAt = createdAtdiff --git a/data/src/main/java/com/streamvault/data/parser/M3uParser.kt b/data/src/main/java/com/streamvault/data/parser/M3uParser.ktindex 800250a1..4cf6bb0a 100644--- a/data/src/main/java/com/streamvault/data/parser/M3uParser.kt+++ b/data/src/main/java/com/streamvault/data/parser/M3uParser.kt@@ -61,7 +61,7 @@ class M3uParser {reader.use {while (true) {val rawLine = reader.readLine() ?: break- val line = rawLine.trim()+ val line = sanitizeLine(rawLine)if (line.isEmpty()) {continue}@@ -107,7 +107,7 @@ class M3uParser {reader.use {while (true) {val rawLine = reader.readLine() ?: break- val line = rawLine.trim()+ val line = sanitizeLine(rawLine)if (line.isEmpty()) {continue}@@ -184,6 +184,9 @@ class M3uParser {)}+ private fun sanitizeLine(rawLine: String): String =+ rawLine.removePrefix("\uFEFF").trim()+private data class ParsedExtinf(val name: String,val durationSeconds: Int?,@@ -207,11 +210,23 @@ class M3uParser {private fun parseHeader(line: String): M3uHeader {val attributes = parseAttributes(line, line.indexOf(' '))return M3uHeader(- tvgUrl = attributes["x-tvg-url"] ?: attributes["url-tvg"],+ tvgUrl = extractHeaderEpgUrl(attributes),userAgent = attributes["user-agent"])}+ private fun extractHeaderEpgUrl(attributes: Map<String, String>): String? {+ val rawValue = headerEpgAttributes+ .firstNotNullOfOrNull { key -> attributes[key]?.takeIf { it.isNotBlank() } }+ ?: return null++ return rawValue+ .split(',')+ .asSequence()+ .map { it.trim() }+ .firstOrNull { it.isNotEmpty() }+ }+private fun parseExtinf(line: String): ParsedExtinf? {val colonIndex = line.indexOf(':')if (colonIndex < 0 || colonIndex == line.lastIndex) return null@@ -379,6 +394,13 @@ class M3uParser {}companion object {+ private val headerEpgAttributes = listOf(+ "x-tvg-url",+ "url-tvg",+ "tvg-url",+ "url-xml"+ )+/** Exposed for callers outside M3uParser (e.g. SyncManager) to avoid duplicate logic. */fun isVodEntry(entry: M3uEntry): Boolean {val url = entry.url.lowercase()diff --git a/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt b/data/src/main/java/com/streamvault/data/parser/XmltvParser.ktindex 79d74916..f1812c70 100644--- a/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt+++ b/data/src/main/java/com/streamvault/data/parser/XmltvParser.kt@@ -75,6 +75,19 @@ class XmltvParser {DateTimeFormatter.ofPattern("yyyyMMdd", Locale.US))+ private fun newPullParser(inputStream: InputStream): XmlPullParser {+ val factory = XmlPullParserFactory.newInstance()+ factory.isNamespaceAware = false+ val parser = factory.newPullParser()+ runCatching {+ parser.setFeature("http://xmlpull.org/v1/doc/features.html#relaxed", true)+ }.onFailure {+ logger.log(Level.FINE, "XML pull parser does not support relaxed mode", it)+ }+ parser.setInput(inputStream, "UTF-8")+ return parser+ }+@Deprecated(message = "Loads all programs into memory. Use parseStreaming() for large EPG files.",replaceWith = ReplaceWith("parseStreaming(inputStream, onProgram)")@@ -83,10 +96,7 @@ class XmltvParser {val programs = mutableListOf<Program>()try {- val factory = XmlPullParserFactory.newInstance()- factory.isNamespaceAware = false- val parser = factory.newPullParser()- parser.setInput(inputStream, "UTF-8")+ val parser = newPullParser(inputStream)var eventType = parser.eventTypevar currentChannelId: String? = null@@ -197,10 +207,7 @@ class XmltvParser {inputStream: InputStream,onProgram: suspend (Program) -> Unit) {- val factory = XmlPullParserFactory.newInstance()- factory.isNamespaceAware = false- val parser = factory.newPullParser()- parser.setInput(inputStream, "UTF-8")+ val parser = newPullParser(inputStream)var eventType = parser.eventTypevar currentChannelId: String? = null@@ -318,10 +325,7 @@ class XmltvParser {onChannel: suspend (XmltvChannel) -> Unit,onProgramme: suspend (XmltvProgramme) -> Unit) {- val factory = XmlPullParserFactory.newInstance()- factory.isNamespaceAware = false- val parser = factory.newPullParser()- parser.setInput(inputStream, "UTF-8")+ val parser = newPullParser(inputStream)var eventType = parser.eventType// Channel statediff --git a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.ktindex ef401c42..1c50272a 100644--- a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt+++ b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt@@ -17,6 +17,7 @@ import com.streamvault.data.local.entity.ChannelPreferenceEntityimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.CategorySortModeimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.DecoderModeimport com.streamvault.domain.manager.ParentalPinVerifierimport com.streamvault.domain.manager.ParentalControlSessionStateimport com.streamvault.domain.manager.ParentalControlSessionStore@@ -75,11 +76,17 @@ class PreferencesRepository @Inject constructor(val MULTIVIEW_PERFORMANCE_MODE = stringPreferencesKey("multiview_performance_mode")val IS_INCOGNITO_MODE = booleanPreferencesKey("is_incognito_mode")val PLAYER_MUTED = booleanPreferencesKey("player_muted")+ val PLAYER_MEDIA_SESSION_ENABLED = booleanPreferencesKey("player_media_session_enabled")+ val PLAYER_DECODER_MODE = stringPreferencesKey("player_decoder_mode")val PLAYER_PLAYBACK_SPEED = stringPreferencesKey("player_playback_speed")val PREFERRED_AUDIO_LANGUAGE = stringPreferencesKey("preferred_audio_language")val PLAYER_SUBTITLE_TEXT_SCALE = stringPreferencesKey("player_subtitle_text_scale")val PLAYER_SUBTITLE_TEXT_COLOR = intPreferencesKey("player_subtitle_text_color")val PLAYER_SUBTITLE_BACKGROUND_COLOR = intPreferencesKey("player_subtitle_background_color")+ val PLAYER_CONTROLS_TIMEOUT_SECONDS = intPreferencesKey("player_controls_timeout_seconds")+ val PLAYER_LIVE_OVERLAY_TIMEOUT_SECONDS = intPreferencesKey("player_live_overlay_timeout_seconds")+ val PLAYER_NOTICE_TIMEOUT_SECONDS = intPreferencesKey("player_notice_timeout_seconds")+ val PLAYER_DIAGNOSTICS_TIMEOUT_SECONDS = intPreferencesKey("player_diagnostics_timeout_seconds")val PLAYER_WIFI_MAX_VIDEO_HEIGHT = intPreferencesKey("player_wifi_max_video_height")val PLAYER_ETHERNET_MAX_VIDEO_HEIGHT = intPreferencesKey("player_ethernet_max_video_height")val LAST_SPEED_TEST_MEGABITS = stringPreferencesKey("last_speed_test_megabits")@@ -91,6 +98,16 @@ class PreferencesRepository @Inject constructor(val RECENT_SEARCH_QUERIES = stringPreferencesKey("recent_search_queries")val XTREAM_TEXT_CLASSIFICATION = booleanPreferencesKey("xtream_text_classification")val PREVENT_STANDBY_DURING_PLAYBACK = booleanPreferencesKey("prevent_standby_during_playback")+ val AUTO_CHECK_APP_UPDATES = booleanPreferencesKey("auto_check_app_updates")+ val LAST_APP_UPDATE_CHECK_TIMESTAMP = longPreferencesKey("last_app_update_check_timestamp")+ val APP_UPDATE_DOWNLOAD_ID = longPreferencesKey("app_update_download_id")+ val APP_UPDATE_DOWNLOADED_VERSION_NAME = stringPreferencesKey("app_update_downloaded_version_name")+ val APP_UPDATE_LATEST_VERSION_NAME = stringPreferencesKey("app_update_latest_version_name")+ val APP_UPDATE_LATEST_VERSION_CODE = intPreferencesKey("app_update_latest_version_code")+ val APP_UPDATE_RELEASE_URL = stringPreferencesKey("app_update_release_url")+ val APP_UPDATE_DOWNLOAD_URL = stringPreferencesKey("app_update_download_url")+ val APP_UPDATE_RELEASE_NOTES = stringPreferencesKey("app_update_release_notes")+ val APP_UPDATE_PUBLISHED_AT = stringPreferencesKey("app_update_published_at")}private object ParentalSessionKeys {@@ -134,6 +151,16 @@ class PreferencesRepository @Inject constructor(preferences[PreferencesKeys.PLAYER_MUTED] ?: false}+ val playerMediaSessionEnabled: Flow<Boolean> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.PLAYER_MEDIA_SESSION_ENABLED] ?: true+ }++ val playerDecoderMode: Flow<DecoderMode> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.PLAYER_DECODER_MODE]+ ?.let { saved -> DecoderMode.entries.firstOrNull { it.name == saved } }+ ?: DecoderMode.AUTO+ }+val playerPlaybackSpeed: Flow<Float> = context.dataStore.data.map { preferences ->preferences[PreferencesKeys.PLAYER_PLAYBACK_SPEED]?.toFloatOrNull()@@ -163,6 +190,22 @@ class PreferencesRepository @Inject constructor(preferences[PreferencesKeys.PLAYER_SUBTITLE_BACKGROUND_COLOR] ?: 0x80000000.toInt()}+ val playerControlsTimeoutSeconds: Flow<Int> = context.dataStore.data.map { preferences ->+ (preferences[PreferencesKeys.PLAYER_CONTROLS_TIMEOUT_SECONDS] ?: 5).coerceIn(2, 60)+ }++ val playerLiveOverlayTimeoutSeconds: Flow<Int> = context.dataStore.data.map { preferences ->+ (preferences[PreferencesKeys.PLAYER_LIVE_OVERLAY_TIMEOUT_SECONDS] ?: 4).coerceIn(2, 60)+ }++ val playerNoticeTimeoutSeconds: Flow<Int> = context.dataStore.data.map { preferences ->+ (preferences[PreferencesKeys.PLAYER_NOTICE_TIMEOUT_SECONDS] ?: 6).coerceIn(2, 60)+ }++ val playerDiagnosticsTimeoutSeconds: Flow<Int> = context.dataStore.data.map { preferences ->+ (preferences[PreferencesKeys.PLAYER_DIAGNOSTICS_TIMEOUT_SECONDS] ?: 15).coerceIn(2, 60)+ }+val playerWifiMaxVideoHeight: Flow<Int?> = context.dataStore.data.map { preferences ->preferences[PreferencesKeys.PLAYER_WIFI_MAX_VIDEO_HEIGHT]?.takeIf { it > 0 }}@@ -240,18 +283,149 @@ class PreferencesRepository @Inject constructor(preferences[PreferencesKeys.PREVENT_STANDBY_DURING_PLAYBACK] ?: true}+ val autoCheckAppUpdates: Flow<Boolean> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.AUTO_CHECK_APP_UPDATES] ?: true+ }++ val lastAppUpdateCheckTimestamp: Flow<Long?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.LAST_APP_UPDATE_CHECK_TIMESTAMP]?.takeIf { it > 0L }+ }++ val appUpdateDownloadId: Flow<Long?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_DOWNLOAD_ID]?.takeIf { it > 0L }+ }++ val downloadedAppUpdateVersionName: Flow<String?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_DOWNLOADED_VERSION_NAME]?.takeIf { it.isNotBlank() }+ }++ val cachedAppUpdateVersionName: Flow<String?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_LATEST_VERSION_NAME]?.takeIf { it.isNotBlank() }+ }++ val cachedAppUpdateVersionCode: Flow<Int?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_LATEST_VERSION_CODE]+ }++ val cachedAppUpdateReleaseUrl: Flow<String?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_RELEASE_URL]?.takeIf { it.isNotBlank() }+ }++ val cachedAppUpdateDownloadUrl: Flow<String?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_DOWNLOAD_URL]?.takeIf { it.isNotBlank() }+ }++ val cachedAppUpdateReleaseNotes: Flow<String> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_RELEASE_NOTES].orEmpty()+ }++ val cachedAppUpdatePublishedAt: Flow<String?> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.APP_UPDATE_PUBLISHED_AT]?.takeIf { it.isNotBlank() }+ }+suspend fun setPreventStandbyDuringPlayback(prevent: Boolean) {context.dataStore.edit { preferences ->preferences[PreferencesKeys.PREVENT_STANDBY_DURING_PLAYBACK] = prevent}}+ suspend fun setAutoCheckAppUpdates(enabled: Boolean) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.AUTO_CHECK_APP_UPDATES] = enabled+ }+ }++ suspend fun setLastAppUpdateCheckTimestamp(timestampMs: Long?) {+ context.dataStore.edit { preferences ->+ if (timestampMs == null || timestampMs <= 0L) {+ preferences.remove(PreferencesKeys.LAST_APP_UPDATE_CHECK_TIMESTAMP)+ } else {+ preferences[PreferencesKeys.LAST_APP_UPDATE_CHECK_TIMESTAMP] = timestampMs+ }+ }+ }++ suspend fun setAppUpdateDownloadId(downloadId: Long?) {+ context.dataStore.edit { preferences ->+ if (downloadId == null || downloadId <= 0L) {+ preferences.remove(PreferencesKeys.APP_UPDATE_DOWNLOAD_ID)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_DOWNLOAD_ID] = downloadId+ }+ }+ }++ suspend fun setDownloadedAppUpdateVersionName(versionName: String?) {+ context.dataStore.edit { preferences ->+ if (versionName.isNullOrBlank()) {+ preferences.remove(PreferencesKeys.APP_UPDATE_DOWNLOADED_VERSION_NAME)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_DOWNLOADED_VERSION_NAME] = versionName+ }+ }+ }++ suspend fun setCachedAppUpdateRelease(+ versionName: String?,+ versionCode: Int?,+ releaseUrl: String?,+ downloadUrl: String?,+ releaseNotes: String?,+ publishedAt: String?+ ) {+ context.dataStore.edit { preferences ->+ if (versionName.isNullOrBlank() || releaseUrl.isNullOrBlank()) {+ preferences.remove(PreferencesKeys.APP_UPDATE_LATEST_VERSION_NAME)+ preferences.remove(PreferencesKeys.APP_UPDATE_LATEST_VERSION_CODE)+ preferences.remove(PreferencesKeys.APP_UPDATE_RELEASE_URL)+ preferences.remove(PreferencesKeys.APP_UPDATE_DOWNLOAD_URL)+ preferences.remove(PreferencesKeys.APP_UPDATE_RELEASE_NOTES)+ preferences.remove(PreferencesKeys.APP_UPDATE_PUBLISHED_AT)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_LATEST_VERSION_NAME] = versionName+ if (versionCode == null) {+ preferences.remove(PreferencesKeys.APP_UPDATE_LATEST_VERSION_CODE)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_LATEST_VERSION_CODE] = versionCode+ }+ preferences[PreferencesKeys.APP_UPDATE_RELEASE_URL] = releaseUrl+ if (downloadUrl.isNullOrBlank()) {+ preferences.remove(PreferencesKeys.APP_UPDATE_DOWNLOAD_URL)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_DOWNLOAD_URL] = downloadUrl+ }+ if (releaseNotes.isNullOrBlank()) {+ preferences.remove(PreferencesKeys.APP_UPDATE_RELEASE_NOTES)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_RELEASE_NOTES] = releaseNotes+ }+ if (publishedAt.isNullOrBlank()) {+ preferences.remove(PreferencesKeys.APP_UPDATE_PUBLISHED_AT)+ } else {+ preferences[PreferencesKeys.APP_UPDATE_PUBLISHED_AT] = publishedAt+ }+ }+ }+ }+suspend fun setPlayerMuted(muted: Boolean) {context.dataStore.edit { preferences ->preferences[PreferencesKeys.PLAYER_MUTED] = muted}}+ suspend fun setPlayerMediaSessionEnabled(enabled: Boolean) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.PLAYER_MEDIA_SESSION_ENABLED] = enabled+ }+ }++ suspend fun setPlayerDecoderMode(mode: DecoderMode) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.PLAYER_DECODER_MODE] = mode.name+ }+ }+suspend fun setPlayerPlaybackSpeed(speed: Float) {context.dataStore.edit { preferences ->preferences[PreferencesKeys.PLAYER_PLAYBACK_SPEED] = speed.coerceIn(0.5f, 2f).toString()@@ -289,6 +463,30 @@ class PreferencesRepository @Inject constructor(}}+ suspend fun setPlayerControlsTimeoutSeconds(seconds: Int) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.PLAYER_CONTROLS_TIMEOUT_SECONDS] = seconds.coerceIn(2, 60)+ }+ }++ suspend fun setPlayerLiveOverlayTimeoutSeconds(seconds: Int) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.PLAYER_LIVE_OVERLAY_TIMEOUT_SECONDS] = seconds.coerceIn(2, 60)+ }+ }++ suspend fun setPlayerNoticeTimeoutSeconds(seconds: Int) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.PLAYER_NOTICE_TIMEOUT_SECONDS] = seconds.coerceIn(2, 60)+ }+ }++ suspend fun setPlayerDiagnosticsTimeoutSeconds(seconds: Int) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.PLAYER_DIAGNOSTICS_TIMEOUT_SECONDS] = seconds.coerceIn(2, 60)+ }+ }+suspend fun setPlayerWifiMaxVideoHeight(maxHeight: Int?) {context.dataStore.edit { preferences ->val normalized = maxHeight?.takeIf { it > 0 }@@ -662,6 +860,21 @@ class PreferencesRepository @Inject constructor(}}+ suspend fun setHiddenCategoryIds(+ providerId: Long,+ type: ContentType,+ categoryIds: Set<Long>+ ) {+ val key = stringPreferencesKey(hiddenCategoriesKey(providerId, type))+ context.dataStore.edit { preferences ->+ if (categoryIds.isEmpty()) {+ preferences.remove(key)+ } else {+ preferences[key] = categoryIds.sorted().joinToString(",")+ }+ }+ }+fun getPinnedCategoryIds(providerId: Long, type: ContentType): Flow<Set<Long>> {val key = stringPreferencesKey(pinnedCategoriesKey(providerId, type))return context.dataStore.data.map { preferences ->diff --git a/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.ktindex 98339e4a..bc97c556 100644--- a/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/EpgSourceRepositoryImpl.kt@@ -145,20 +145,20 @@ class EpgSourceRepositoryImpl @Inject constructor(priority = priority))- resolveForProvider(providerId)+ resolveForProvider(providerId, emptySet())return Result.success(Unit)}override suspend fun unassignSourceFromProvider(providerId: Long, epgSourceId: Long) {providerEpgSourceDao.delete(providerId, epgSourceId)- resolveForProvider(providerId)+ resolveForProvider(providerId, emptySet())}override suspend fun updateAssignmentPriority(providerId: Long, epgSourceId: Long, priority: Int) {val assignments = providerEpgSourceDao.getForProviderSync(providerId)val target = assignments.find { it.epgSourceId == epgSourceId } ?: returnproviderEpgSourceDao.update(target.copy(priority = priority))- resolveForProvider(providerId)+ resolveForProvider(providerId, emptySet())}// ── Refresh / Ingestion ────────────────────────────────────────@@ -318,8 +318,11 @@ class EpgSourceRepositoryImpl @Inject constructor(// ── Resolution ─────────────────────────────────────────────────- override suspend fun resolveForProvider(providerId: Long): EpgResolutionSummary =- resolutionEngine.resolveForProvider(providerId)+ override suspend fun resolveForProvider(+ providerId: Long,+ hiddenLiveCategoryIds: Set<Long>+ ): EpgResolutionSummary =+ resolutionEngine.resolveForProvider(providerId, hiddenLiveCategoryIds)override suspend fun getResolutionSummary(providerId: Long): EpgResolutionSummary =resolutionEngine.getResolutionSummary(providerId)@@ -403,7 +406,7 @@ class EpgSourceRepositoryImpl @Inject constructor(if (!existing.isManualOverride) {return Result.success(Unit)}- resolveForProvider(providerId)+ resolveForProvider(providerId, emptySet())return Result.success(Unit)}@@ -423,7 +426,7 @@ class EpgSourceRepositoryImpl @Inject constructor(.filter { it > 0L }.distinct().forEach { providerId ->- resolveForProvider(providerId)+ resolveForProvider(providerId, emptySet())}}}diff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex 948be1f5..36afe22b 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -167,6 +167,7 @@ class ProviderRepositoryImpl @Inject constructor(url: String,name: String,epgSyncMode: ProviderEpgSyncMode,+ m3uVodClassificationEnabled: Boolean,onProgress: ((String) -> Unit)?,id: Long?): Result<Provider> = try {@@ -196,6 +197,7 @@ class ProviderRepositoryImpl @Inject constructor(serverUrl = normalizedUrl,m3uUrl = normalizedUrl,epgSyncMode = epgSyncMode,+ m3uVodClassificationEnabled = m3uVodClassificationEnabled,isActive = true,lastSyncedAt = 0)@@ -208,6 +210,7 @@ class ProviderRepositoryImpl @Inject constructor(serverUrl = normalizedUrl,m3uUrl = normalizedUrl,epgSyncMode = epgSyncMode,+ m3uVodClassificationEnabled = m3uVodClassificationEnabled,status = ProviderStatus.ACTIVE)val newId = providerDao.insert(provider.toSecureEntity())diff --git a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt b/data/src/main/java/com/streamvault/data/sync/SyncManager.ktindex e46aa166..51e79f3d 100644--- a/data/src/main/java/com/streamvault/data/sync/SyncManager.kt+++ b/data/src/main/java/com/streamvault/data/sync/SyncManager.kt@@ -182,6 +182,11 @@ class SyncManager @Inject constructor(val stagedAcceptedCount: Int = 0)+ private data class LiveCatalogSnapshot(+ val categories: List<CategoryEntity>?,+ val channels: List<ChannelEntity>+ )+private data class SequentialProviderAdaptation(val rememberSequential: Boolean,val healthyStreak: Int@@ -541,6 +546,7 @@ class SyncManager @Inject constructor(}progress(provider.id, onProgress, "Connecting to server...")val useTextClassification = preferencesRepository.useXtreamTextClassification.first()+ val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()val api = createXtreamSyncProvider(provider, useTextClassification)var metadata = syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id)@@ -552,6 +558,7 @@ class SyncManager @Inject constructor(provider = provider,api = api,existingMetadata = metadata,+ hiddenLiveCategoryIds = hiddenLiveCategoryIds,onProgress = onProgress)val liveSequentialStress = liveSyncResult.strategyFeedback.segmentedStressDetected@@ -568,10 +575,16 @@ class SyncManager @Inject constructor(when (val liveResult = liveSyncResult.catalogResult) {is CatalogStrategyResult.Success -> {+ val liveCatalog = mergeVisibleLiveSyncWithHiddenStoredContent(+ providerId = provider.id,+ visibleCategories = liveSyncResult.categories,+ visibleChannels = liveResult.items.map { it.toEntity() },+ hiddenLiveCategoryIds = hiddenLiveCategoryIds+ )val acceptedCount = syncCatalogStore.replaceLiveCatalog(providerId = provider.id,- categories = liveSyncResult.categories,- channels = liveResult.items.map { it.toEntity() }+ categories = liveCatalog.categories,+ channels = liveCatalog.channels)metadata = metadata.copy(lastLiveSync = now,@@ -583,10 +596,16 @@ class SyncManager @Inject constructor(warnings += liveSyncResult.warnings + liveResult.warnings}is CatalogStrategyResult.Partial -> {+ val liveCatalog = mergeVisibleLiveSyncWithHiddenStoredContent(+ providerId = provider.id,+ visibleCategories = liveSyncResult.categories,+ visibleChannels = liveResult.items.map { it.toEntity() },+ hiddenLiveCategoryIds = hiddenLiveCategoryIds+ )val acceptedCount = syncCatalogStore.replaceLiveCatalog(providerId = provider.id,- categories = liveSyncResult.categories,- channels = liveResult.items.map { it.toEntity() }+ categories = liveCatalog.categories,+ channels = liveCatalog.channels)metadata = metadata.copy(lastLiveSync = now,@@ -934,6 +953,7 @@ class SyncManager @Inject constructor(): List<String> {var updatedMetadata = metadataval warnings = mutableListOf<String>()+ val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()when (provider.type) {ProviderType.XTREAM_CODES -> {@@ -996,7 +1016,7 @@ class SyncManager @Inject constructor(progress(provider.id, onProgress, "Refreshing external EPG sources...")epgSourceRepository.refreshAllForProvider(provider.id)progress(provider.id, onProgress, "Resolving EPG mappings...")- epgSourceRepository.resolveForProvider(provider.id)+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)} catch (e: CancellationException) {throw e} catch (e: Exception) {@@ -1012,6 +1032,7 @@ class SyncManager @Inject constructor(onProgress: ((String) -> Unit)?) {progress(provider.id, onProgress, "Retrying EPG...")+ val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()val epgUrl = when (provider.type) {ProviderType.XTREAM_CODES -> {val base = provider.serverUrl.trimEnd('/')@@ -1044,7 +1065,7 @@ class SyncManager @Inject constructor(progress(provider.id, onProgress, "Refreshing external EPG sources...")epgSourceRepository.refreshAllForProvider(provider.id)progress(provider.id, onProgress, "Resolving EPG mappings...")- epgSourceRepository.resolveForProvider(provider.id)+ epgSourceRepository.resolveForProvider(provider.id, hiddenLiveCategoryIds)}private suspend fun syncLiveOnly(@@ -1056,12 +1077,14 @@ class SyncManager @Inject constructor(ProviderType.XTREAM_CODES -> {progress(provider.id, onProgress, "Retrying Live TV...")val useTextClassification = preferencesRepository.useXtreamTextClassification.first()+ val hiddenLiveCategoryIds = preferencesRepository.getHiddenCategoryIds(provider.id, ContentType.LIVE).first()val api = createXtreamSyncProvider(provider, useTextClassification)val currentMetadata = syncMetadataRepository.getMetadata(provider.id) ?: SyncMetadata(provider.id)val liveSyncResult = syncXtreamLiveCatalog(provider = provider,api = api,existingMetadata = currentMetadata,+ hiddenLiveCategoryIds = hiddenLiveCategoryIds,onProgress = onProgress)val liveSequentialStress = liveSyncResult.strategyFeedback.segmentedStressDetected@@ -1078,10 +1101,16 @@ class SyncManager @Inject constructor(when (val liveResult = liveSyncResult.catalogResult) {is CatalogStrategyResult.Success -> {+ val liveCatalog = mergeVisibleLiveSyncWithHiddenStoredContent(+ providerId = provider.id,+ visibleCategories = liveSyncResult.categories,+ visibleChannels = liveResult.items.map { it.toEntity() },+ hiddenLiveCategoryIds = hiddenLiveCategoryIds+ )val acceptedCount = syncCatalogStore.replaceLiveCatalog(providerId = provider.id,- categories = liveSyncResult.categories,- channels = liveResult.items.map { it.toEntity() }+ categories = liveCatalog.categories,+ channels = liveCatalog.channels)syncMetadataRepository.updateMetadata(currentMetadata.copy(@@ -1094,10 +1123,16 @@ class SyncManager @Inject constructor()}is CatalogStrategyResult.Partial -> {+ val liveCatalog = mergeVisibleLiveSyncWithHiddenStoredContent(+ providerId = provider.id,+ visibleCategories = liveSyncResult.categories,+ visibleChannels = liveResult.items.map { it.toEntity() },+ hiddenLiveCategoryIds = hiddenLiveCategoryIds+ )val acceptedCount = syncCatalogStore.replaceLiveCatalog(providerId = provider.id,- categories = liveSyncResult.categories,- channels = liveResult.items.map { it.toEntity() }+ categories = liveCatalog.categories,+ channels = liveCatalog.channels)syncMetadataRepository.updateMetadata(currentMetadata.copy(@@ -1812,6 +1847,7 @@ class SyncManager @Inject constructor(provider: Provider,api: XtreamProvider,existingMetadata: SyncMetadata,+ hiddenLiveCategoryIds: Set<Long>,onProgress: ((String) -> Unit)?): CatalogSyncPayload<Channel> {Log.i(TAG, "Xtream live strategy start for provider ${provider.id}.")@@ -1839,43 +1875,53 @@ class SyncManager @Inject constructor(?.let { categories -> api.mapCategories(ContentType.LIVE, categories) }?.map { category -> category.toEntity(provider.id) }?.takeIf { it.isNotEmpty() }+ val filteredRawLiveCategories = rawLiveCategories.orEmpty().filterNot { category ->+ category.categoryId.toLongOrNull() in hiddenLiveCategoryIds+ }+ val visibleResolvedCategories = resolvedCategories+ ?.filterNot { category -> category.categoryId in hiddenLiveCategoryIds }+ ?.takeIf { it.isNotEmpty() }var fullResult: CatalogStrategyResult<Channel> = CatalogStrategyResult.EmptyValid("full")var categoryResult: CatalogStrategyResult<Channel> = CatalogStrategyResult.EmptyValid("category_bulk")- progress(provider.id, onProgress, "Downloading Live TV...")- fullResult = loadXtreamLiveFull(provider, api)- when (fullResult) {- is CatalogStrategyResult.Success -> return CatalogSyncPayload(- catalogResult = fullResult,- categories = mergePreferredAndFallbackCategories(- resolvedCategories,- buildFallbackLiveCategories(provider.id, fullResult.items)- ),- warnings = emptyList(),- strategyFeedback = XtreamStrategyFeedback(- attemptedFullCatalog = true,- fullCatalogUnsafe = false+ if (hiddenLiveCategoryIds.isEmpty()) {+ progress(provider.id, onProgress, "Downloading Live TV...")+ fullResult = loadXtreamLiveFull(provider, api)+ when (fullResult) {+ is CatalogStrategyResult.Success -> return CatalogSyncPayload(+ catalogResult = fullResult,+ categories = mergePreferredAndFallbackCategories(+ visibleResolvedCategories,+ buildFallbackLiveCategories(provider.id, fullResult.items)+ ),+ warnings = emptyList(),+ strategyFeedback = XtreamStrategyFeedback(+ attemptedFullCatalog = true,+ fullCatalogUnsafe = false+ ))- )- is CatalogStrategyResult.Partial -> return CatalogSyncPayload(- catalogResult = fullResult,- categories = mergePreferredAndFallbackCategories(- resolvedCategories,- buildFallbackLiveCategories(provider.id, fullResult.items)- ),- warnings = emptyList(),- strategyFeedback = XtreamStrategyFeedback(- attemptedFullCatalog = true,- fullCatalogUnsafe = false+ is CatalogStrategyResult.Partial -> return CatalogSyncPayload(+ catalogResult = fullResult,+ categories = mergePreferredAndFallbackCategories(+ visibleResolvedCategories,+ buildFallbackLiveCategories(provider.id, fullResult.items)+ ),+ warnings = emptyList(),+ strategyFeedback = XtreamStrategyFeedback(+ attemptedFullCatalog = true,+ fullCatalogUnsafe = false+ ))- )- else -> Unit+ else -> Unit+ }+ } else {+ Log.i(TAG, "Xtream live full catalog skipped for provider ${provider.id} because ${hiddenLiveCategoryIds.size} live categories are hidden.")}progress(provider.id, onProgress, "Downloading Live TV by category...")categoryResult = loadXtreamLiveByCategory(provider,api,- rawLiveCategories.orEmpty(),+ filteredRawLiveCategories,onProgress,preferSequential = existingMetadata.liveSequentialFailuresRemembered)@@ -1883,11 +1929,11 @@ class SyncManager @Inject constructor(catalogResult = categoryResult,categories = when (categoryResult) {is CatalogStrategyResult.Success -> mergePreferredAndFallbackCategories(- resolvedCategories,+ visibleResolvedCategories,buildFallbackLiveCategories(provider.id, categoryResult.items))is CatalogStrategyResult.Partial -> mergePreferredAndFallbackCategories(- resolvedCategories,+ visibleResolvedCategories,buildFallbackLiveCategories(provider.id, categoryResult.items))else -> null@@ -2988,7 +3034,7 @@ class SyncManager @Inject constructor(val safeLogoUrl = UrlSecurityPolicy.sanitizeImportedAssetUrl(entry.tvgLogo)val safeCatchUpSource = UrlSecurityPolicy.sanitizeImportedAssetUrl(entry.catchUpSource)- if (isVodEntry(entry)) {+ if (provider.m3uVodClassificationEnabled && isVodEntry(entry)) {if (!includeMovies) {return@parseStreaming}@@ -3669,6 +3715,35 @@ class SyncManager @Inject constructor(/** Delegates to M3uParser to avoid duplicate logic. */internal fun isVodEntry(entry: M3uParser.M3uEntry): Boolean = M3uParser.isVodEntry(entry)+ private suspend fun mergeVisibleLiveSyncWithHiddenStoredContent(+ providerId: Long,+ visibleCategories: List<CategoryEntity>?,+ visibleChannels: List<ChannelEntity>,+ hiddenLiveCategoryIds: Set<Long>+ ): LiveCatalogSnapshot {+ if (hiddenLiveCategoryIds.isEmpty()) {+ return LiveCatalogSnapshot(visibleCategories, visibleChannels)+ }++ val hiddenCategories = categoryDao.getByProviderAndTypeSync(providerId, ContentType.LIVE.name)+ .filter { category -> category.categoryId in hiddenLiveCategoryIds }+ val hiddenChannels = channelDao.getByProviderSync(providerId)+ .filter { channel -> channel.categoryId != null && channel.categoryId in hiddenLiveCategoryIds }++ val mergedCategories = ((visibleCategories ?: emptyList()) + hiddenCategories)+ .distinctBy { it.categoryId to it.type }+ .sortedBy { it.categoryId }+ .takeIf { it.isNotEmpty() }+ val mergedChannels = (visibleChannels + hiddenChannels)+ .distinctBy { it.streamId }+ .sortedBy { it.number }++ return LiveCatalogSnapshot(+ categories = mergedCategories,+ channels = mergedChannels+ )+ }+private fun progress(providerId: Long, callback: ((String) -> Unit)?, message: String) {publishSyncState(providerId, SyncState.Syncing(message))callback?.invoke(message)diff --git a/data/src/test/java/com/streamvault/data/parser/M3uParserTest.kt b/data/src/test/java/com/streamvault/data/parser/M3uParserTest.ktindex 8b4525ec..d374e911 100644--- a/data/src/test/java/com/streamvault/data/parser/M3uParserTest.kt+++ b/data/src/test/java/com/streamvault/data/parser/M3uParserTest.kt@@ -136,6 +136,50 @@ class M3uParserTest {assertThat(result.entries.single().tvgId).isEqualTo("cnn")}+ @Test+ fun `parse_headerAliases_extractGuideUrl`() {+ val variants = listOf("x-tvg-url", "tvg-url", "url-xml")++ variants.forEach { attribute ->+ val result = parser.parse(+ """+ #EXTM3U $attribute="https://epg.example.com/$attribute.xml.gz"+ #EXTINF:-1 group-title="News",CNN+ http://stream.example.com/cnn.m3u8+ """.trimIndent().byteInputStream()+ )++ assertThat(result.header.tvgUrl).isEqualTo("https://epg.example.com/$attribute.xml.gz")+ }+ }++ @Test+ fun `parse_headerWithUtf8Bom_extractsGuideUrl`() {+ val result = parser.parse(+ (+ "\uFEFF#EXTM3U x-tvg-url=\"https://epg.example.com/guide.xml\"\n" ++ "#EXTINF:-1 tvg-id=\"foxlivenow_foxlivenow_US\" group-title=\"News\",LiveNOW from FOX\n" ++ "https://stream.example.com/live.m3u8\n"+ ).byteInputStream()+ )++ assertThat(result.header.tvgUrl).isEqualTo("https://epg.example.com/guide.xml")+ assertThat(result.entries.single().tvgId).isEqualTo("foxlivenow_foxlivenow_US")+ }++ @Test+ fun `parse_headerWithMultipleEpgUrls_usesFirstUrl`() {+ val result = parser.parse(+ """+ #EXTM3U x-tvg-url="https://epg.example.com/guide.xml.gz, https://backup.example.com/guide.xml"+ #EXTINF:-1 group-title="News",CNN+ http://stream.example.com/cnn.m3u8+ """.trimIndent().byteInputStream()+ )++ assertThat(result.header.tvgUrl).isEqualTo("https://epg.example.com/guide.xml.gz")+ }+@Testfun `parse_catchUpAttributes_extracted`() {val m3u = """diff --git a/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt b/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.ktindex 081059de..6b36eead 100644--- a/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt+++ b/data/src/test/java/com/streamvault/data/parser/XmltvParserTest.kt@@ -205,6 +205,25 @@ class XmltvParserTest {assertThat(programs.size).isAtMost(2)}+ @Test+ fun `parse_textWithBareAmpersand_returnsProgramInRelaxedMode`() {+ val xml = """+ <?xml version="1.0"?>+ <tv>+ <programme start="20250101120000 +0000" stop="20250101130000 +0000" channel="ch1">+ <title>Law & Order</title>+ <desc>Tom & Jerry investigate</desc>+ </programme>+ </tv>+ """.trimIndent()++ val programs = parser.parse(xml.byteInputStream())++ assertThat(programs).hasSize(1)+ assertThat(programs.single().title).isEqualTo("Law & Order")+ assertThat(programs.single().description).contains("Tom")+ }+@Testfun `parse_sameInstance_isStableAcrossConcurrentCalls`() = runTest {val xml = """@@ -322,6 +341,33 @@ class XmltvParserTest {assertThat(programmes).isEmpty()}+ @Test+ fun `parseStreamingWithChannels_textWithBareAmpersand_returnsProgramme`() = runTest {+ val xml = """+ <?xml version="1.0" encoding="UTF-8"?>+ <tv>+ <channel id="ch1">+ <display-name>BBC One</display-name>+ </channel>+ <programme start="20250101120000 +0000" stop="20250101130000 +0000" channel="ch1">+ <title>Fish & Chips</title>+ <desc>Salt & vinegar special</desc>+ </programme>+ </tv>+ """.trimIndent()++ val programmes = mutableListOf<XmltvProgramme>()+ parser.parseStreamingWithChannels(+ inputStream = xml.byteInputStream(),+ onChannel = { },+ onProgramme = { programmes.add(it) }+ )++ assertThat(programmes).hasSize(1)+ assertThat(programmes.single().title).contains("Fish")+ assertThat(programmes.single().description).contains("Salt")+ }+@Testfun `maybeDecompressGzip_nonGzUrl_returnsOriginal`() {val original = "hello".byteInputStream()diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 6b42160d..73cfd925 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -2,6 +2,29 @@All notable product changes are recorded in this document.+## 1.0.2 - 08/04/2026++### Added+- Added in-app update discovery and download support backed by GitHub Releases, including cached release metadata, dashboard update callouts, Settings update controls, and APK install handoff through a FileProvider.+- Added bulk category visibility controls in Provider Category Controls with provider-wide `Hide All` and `Unhide All` actions.+- Added per-provider M3U VOD classification controls, including setup-time configuration, a persisted provider flag, and a refresh action to rearrange imported content after toggling the rules.+- Added playback troubleshooting controls in Settings for `System Media Session`, saved decoder mode preference, clearer playback timeout labels, and direct numeric timeout entry.+- Added targeted regression coverage for M3U header BOM handling, XMLTV relaxed parsing, and broader M3U header EPG alias support.++### Changed+- Updated M3U header EPG discovery to accept additional aliases such as `x-tvg-url`, `url-tvg`, `tvg-url`, and `url-xml`, while handling comma-separated guide URLs more reliably.+- Updated M3U and manual XMLTV ingestion to use a more tolerant shared parser so malformed entity text in otherwise usable feeds no longer fails as aggressively.+- Updated the add-provider and provider settings flows so Xtream-only advanced options stay hidden for M3U sources and provider-specific M3U behavior is configured where users expect it.+- Updated playback timeout settings to use clearer live-versus-VOD wording and a simpler typed-seconds workflow instead of long option pickers.+- Updated player initialization so main playback can react live to `MediaSession` and decoder preferences, with improved decoder fallback behavior when software extensions are available.++### Fixed+- Fixed M3U playlist imports that could miss header-declared EPG URLs when the playlist started with a UTF-8 BOM.+- Fixed provider sync so hidden live categories are skipped during Xtream live refresh and ignored during EPG resolution work, reducing unnecessary sync overhead.+- Fixed provider category control management to support bulk hide and restore flows without disturbing categories that were already hidden.+- Fixed M3U provider sync and setup behavior so discovered provider EPG URLs, VOD classification, and category rearrangement stay consistent across refreshes.+- Fixed XMLTV source refreshes that previously failed on some real-world feeds with `unterminated entity ref` parser errors.+## 1.0.1 - 08/04/2026### Added@@ -18,4 +41,4 @@ All notable product changes are recorded in this document.### Fixed- Fixed M3U playlist imports so header-declared `url-tvg` and `x-tvg-url` feeds are carried through into provider EPG refresh more reliably.- Fixed manual overrides so they persist as explicit external mappings instead of being lost during normal assignment updates.-- Fixed guide and playback consumers that previously bypassed resolved mappings and could ignore external or manually overridden EPG matches.\ No newline at end of file+- Fixed guide and playback consumers that previously bypassed resolved mappings and could ignore external or manually overridden EPG matches.diff --git a/domain/src/main/java/com/streamvault/domain/model/Provider.kt b/domain/src/main/java/com/streamvault/domain/model/Provider.ktindex 26e085b3..b47f529b 100644--- a/domain/src/main/java/com/streamvault/domain/model/Provider.kt+++ b/domain/src/main/java/com/streamvault/domain/model/Provider.kt@@ -16,6 +16,7 @@ data class Provider(val allowedOutputFormats: List<String> = emptyList(),val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,val xtreamFastSyncEnabled: Boolean = true,+ val m3uVodClassificationEnabled: Boolean = true,val status: ProviderStatus = ProviderStatus.UNKNOWN,val lastSyncedAt: Long = 0L,val createdAt: Long = System.currentTimeMillis()diff --git a/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.ktindex 96dabd9f..afd1922d 100644--- a/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/EpgSourceRepository.kt@@ -43,7 +43,7 @@ interface EpgSourceRepository {// ── Resolution ─────────────────────────────────────────────────- suspend fun resolveForProvider(providerId: Long): EpgResolutionSummary+ suspend fun resolveForProvider(providerId: Long, hiddenLiveCategoryIds: Set<Long> = emptySet()): EpgResolutionSummarysuspend fun getResolutionSummary(providerId: Long): EpgResolutionSummarydiff --git a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.ktindex 0df4e7b4..67876f82 100644--- a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt@@ -15,7 +15,7 @@ interface ProviderRepository {suspend fun deleteProvider(id: Long): Result<Unit>suspend fun setActiveProvider(id: Long): Result<Unit>suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, xtreamFastSyncEnabled: Boolean, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>- suspend fun validateM3u(url: String, name: String, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>+ suspend fun validateM3u(url: String, name: String, epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT, m3uVodClassificationEnabled: Boolean = true, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>suspend fun refreshProviderData(providerId: Long,force: Boolean = false,diff --git a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.ktindex 2e0bf126..1f726af1 100644--- a/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt+++ b/domain/src/main/java/com/streamvault/domain/usecase/ValidateAndAddProvider.kt@@ -21,6 +21,7 @@ data class M3uProviderSetupCommand(val url: String,val name: String,val epgSyncMode: ProviderEpgSyncMode = ProviderEpgSyncMode.UPFRONT,+ val m3uVodClassificationEnabled: Boolean = true,val existingProviderId: Long? = null)@@ -75,6 +76,7 @@ class ValidateAndAddProvider @Inject constructor(url = validated.data.url,name = validated.data.name,epgSyncMode = command.epgSyncMode,+ m3uVodClassificationEnabled = command.m3uVodClassificationEnabled,onProgress = onProgress,id = command.existingProviderId).toUseCaseResult()diff --git a/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt b/player/src/main/java/com/streamvault/player/Media3PlayerEngine.ktindex 2bbc18c0..129bae29 100644--- a/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt+++ b/player/src/main/java/com/streamvault/player/Media3PlayerEngine.kt@@ -80,6 +80,20 @@ class Media3PlayerEngine @Inject constructor(audioFocusController.bypassAudioFocus = value}var enableMediaSession: Boolean = true+ set(value) {+ if (field == value) return+ field = value+ if (value) {+ exoPlayer?.let { player ->+ if (mediaSession == null) {+ mediaSession = MediaSession.Builder(context, player).build()+ }+ }+ } else {+ mediaSession?.release()+ mediaSession = null+ }+ }private var supervisorJob = SupervisorJob()private var scope = CoroutineScope(Dispatchers.Main.immediate + supervisorJob)@@ -214,6 +228,10 @@ class Media3PlayerEngine @Inject constructor(}}+ override fun setMediaSessionEnabled(enabled: Boolean) {+ enableMediaSession = enabled+ }+override fun setVolume(volume: Float) {audioFocusController.setVolume(volume)}@@ -495,10 +513,11 @@ class Media3PlayerEngine @Inject constructor(}return baseFactory.apply {+ setEnableDecoderFallback(true)setExtensionRendererMode(when (activeDecoderMode) {- DecoderMode.AUTO, DecoderMode.HARDWARE -> DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER- DecoderMode.SOFTWARE -> DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF+ DecoderMode.AUTO, DecoderMode.HARDWARE -> DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON+ DecoderMode.SOFTWARE -> DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER})}diff --git a/player/src/main/java/com/streamvault/player/PlayerEngine.kt b/player/src/main/java/com/streamvault/player/PlayerEngine.ktindex 2d8cabf3..a70e39cd 100644--- a/player/src/main/java/com/streamvault/player/PlayerEngine.kt+++ b/player/src/main/java/com/streamvault/player/PlayerEngine.kt@@ -45,6 +45,7 @@ interface PlayerEngine {fun seekForward(ms: Long = 10_000)fun seekBackward(ms: Long = 10_000)fun setDecoderMode(mode: DecoderMode)+ fun setMediaSessionEnabled(enabled: Boolean)fun setVolume(volume: Float)fun setMuted(muted: Boolean)fun setPlaybackSpeed(speed: Float)