add a download quality preference

Downloads always fetched the original file. The setting takes the same choices
as the stream quality, and when it transcodes the download uses the stream
endpoint with those parameters instead, so the stored file is already the
wanted encoding rather than the original that would be transcoded on each play.

A preference change applied before the source is ready falls back to original,
and the URI is built from the same cached source the stream URL uses.
This commit is contained in:
austinried
2026-10-04 00:30:03 +00:00
parent 26b8963205
commit adb9367f18
7 changed files with 98 additions and 11 deletions
@@ -33,6 +33,11 @@ class SettingsViewModel(
.streamQuality(NetworkMode.Mobile)
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), StreamQuality())
val downloadQuality: StateFlow<StreamQuality> =
userPreferences
.downloadQuality()
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), StreamQuality())
val syncConcurrency: StateFlow<Int> =
userPreferences
.syncConcurrency()
@@ -50,6 +55,10 @@ class SettingsViewModel(
viewModelScope.launch { userPreferences.setStreamQuality(NetworkMode.Mobile, quality) }
}
fun setDownloadQuality(quality: StreamQuality) {
viewModelScope.launch { userPreferences.setDownloadQuality(quality) }
}
fun setSyncConcurrency(value: Int) {
viewModelScope.launch { userPreferences.setSyncConcurrency(value) }
}