Add option to override user profile settings for audio & subtitle languages (#1680)

## Description
Adds settings under the "User profile settings" section which allows for
specifying preferred languages for audio and subtitles and the preferred
subtitle mode.

By default (matching existing Wholphin behavior), the preferred
languages and subtitle mode are derived from the user's profile settings
provided by the server which can be set on the WebUI:
User->Settings->Playback or Subtitles. However, this isn't well
understood and Wholphin doesn't display these values anywhere, so many
users were confused.

The preferred languages and subtitle mode can now be configured from
within Wholphin. Setting these will **not** update the server. The
settings are **only** used locally.

### Related issues
Related to #319
Closes #790

### Testing
Emulator manually changing some settings, added additional unit tests to
ensure the overrides are respected when choosing tracks

## Screenshots
### Settings page
<img width="1280" height="720" alt="settings_01 Large"
src="https://github.com/user-attachments/assets/28cc2f6b-3a60-42a4-b268-48695086d566"
/>

### Clicking into "More user profile settings"
<img width="1280" height="720" alt="settings_02 Large"
src="https://github.com/user-attachments/assets/6c3be3aa-c177-4d44-8060-b76d15fb10d7"
/>

### Language choice dialog

Can filter languages by typing in the search box at the top

<img width="1280" height="720" alt="settings_03 Large"
src="https://github.com/user-attachments/assets/c014d0ba-8d5b-4201-a6ee-4876b478148c"
/>


## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-07-14 14:17:31 -04:00 • committed by GitHub
parent 077b7e4570
commit 3f60fa7550
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 1751 additions and 48 deletions

View file

@ -582,6 +582,13 @@ sealed interface AppPreference<Pref, T> {
destination = Destination.Settings(PreferenceScreenOption.ADVANCED),
)
val UserProfileSettings =
AppDestinationPreference<AppPreferences>(
title = R.string.override_user_profile_settings,
destination = Destination.UserAppPreferences,
summary = R.string.override_user_profile_settings_summary,
)
val SkipIntros =
AppChoicePreference<AppPreferences, SkipSegmentBehavior>(
title = R.string.skip_intro_behavior,
@ -1116,6 +1123,7 @@ val basicPreferences =
AppPreference.CustomizeHome,
AppPreference.UserPinnedNavDrawerItems,
AppPreference.UserInterfaceLanguage,
AppPreference.UserProfileSettings,
),
),
PreferenceGroup(

View file

@ -1,5 +1,6 @@
package com.github.damontecres.wholphin.preferences
import com.github.damontecres.wholphin.data.model.JellyfinUserPreferences
import org.jellyfin.sdk.model.api.SubtitlePlaybackMode
import org.jellyfin.sdk.model.api.UserConfiguration
@ -8,6 +9,7 @@ import org.jellyfin.sdk.model.api.UserConfiguration
*/
data class UserPreferences(
val appPreferences: AppPreferences,
val userPreferences: JellyfinUserPreferences?,
)
val DefaultUserConfiguration =

View file

@ -0,0 +1,70 @@
package com.github.damontecres.wholphin.preferences
import com.github.damontecres.wholphin.R
import com.github.damontecres.wholphin.data.model.JellyfinUserPreferences
import com.github.damontecres.wholphin.ui.preferences.PreferenceGroup
/**
* Represents settings from the user's profile on the server that may be overridden within the app
*/
object UserProfileSettings {
/**
* Special value that means the preferred language should be taken from the user's profile on the server
*/
const val USE_USER_PROFILE = ""
/**
* Special value that means the user has no preferred language
*/
const val PREFER_ANY_LANGUAGE = "_any-language"
val PreferredAudioLang =
AppClickablePreference<JellyfinUserPreferences>(
title = R.string.preferred_audio_language,
getter = { },
setter = { prefs, _ -> prefs },
)
val PreferredSubtitleLang =
AppClickablePreference<JellyfinUserPreferences>(
title = R.string.preferred_subtitle_language,
summary = null,
getter = { },
setter = { prefs, _ -> prefs },
)
val SubtitleModePref =
AppChoicePreference<JellyfinUserPreferences, SubtitleModePreference>(
title = R.string.subtitle_mode,
defaultValue = SubtitleModePreference.USE_USER_PROFILE,
getter = { it.subtitleMode },
setter = { prefs, value ->
prefs.copy(subtitleMode = value)
},
displayValues = R.array.subtitle_mode_options,
indexToValue = { SubtitleModePreference.entries[it] },
valueToIndex = { it.ordinal },
)
val Preferences =
listOf(
PreferenceGroup(
title = R.string.profile_specific_settings_from_server,
preferences =
listOf(
PreferredAudioLang,
PreferredSubtitleLang,
SubtitleModePref,
),
),
)
}
enum class SubtitleModePreference {
USE_USER_PROFILE,
DEFAULT,
SMART,
ONLY_FORCED,
ALWAYS,
NONE,
}