Added subtitle settings.

This commit is contained in:
MattMckenzy 2024-02-10 08:22:39 -05:00
parent d05f06da9a
commit 5bc944cb60
3 changed files with 74 additions and 21 deletions

View File

@ -197,18 +197,24 @@ Current Settings:
- `aspect: string enum`: Allows control of aspect ratio. The default is `normal`.
- Options: `normal`, `zoom`, `force_4_3`, `force_16_9`, `force_16_9_if_4_3`, `stretch`, `noscaling`, `custom`
- Subtitle Section (`subtitles`):
- `placement: string enum`: Controls where subtitles are displayed on the screen. Default: `center,bottom`
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/7d5943becc1ca672d599887cac9107836c38d337/resources/settings/settings_description.json#L352-L359)
- `color: string enum`: Controls colors of subtitles. Default: `#EEEEEE`
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L421-L427)
- `border_color: string enum`: Controls font border colors of subtitles. Default: `#000000`
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L434-L440)
- `background_color: string enum`: Controls backgroud colors of subtitles. Default: `#CCCCCC`
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L447-L453)
- `background_transparency: string enum`: Controls backgroud transparency (in hex) of subtitles. Default: `00`
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L460-L464)
- `size: int`: Controls subtitle size. Default is `32`.
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/7d5943becc1ca672d599887cac9107836c38d337/resources/settings/settings_description.json#L376-L382)
- `ass_style_override: string enum`: Controls whether user style override should be applied to ASS subtitles. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/7d5943becc1ca672d599887cac9107836c38d337/resources/settings/settings_description.json#L408-L415)
- `placement: string enum`: Controls where subtitles are displayed on the screen. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/7d5943becc1ca672d599887cac9107836c38d337/resources/settings/settings_description.json#L420-L428)
- `color: string enum`: Controls colors of subtitles. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L433-L442)
- `border_color: string enum`: Controls font border colors of subtitles. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L447-L456)
- `border_size: int`: Controls subtitle border size. Default is `-1`.
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/7d5943becc1ca672d599887cac9107836c38d337/resources/settings/settings_description.json#L461-L469)
- `background_color: string enum`: Controls backgroud colors of subtitles. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L474-L483)
- `background_transparency: string enum`: Controls backgroud transparency (in hex) of subtitles. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L488-L495)
- `size: int`: Controls subtitle size. Default is `-1`.
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/7d5943becc1ca672d599887cac9107836c38d337/resources/settings/settings_description.json#L500-L507)
- `font: string enum`: Specify font to use for subtitles that do not themselves specify a particular font. Default: ``
- Provided options: [see enum](https://github.com/jellyfin/jellyfin-media-player/blob/master/resources/settings/settings_description.json#L512-L521)
The global `window.jmpInfo` object contains settings for the application in the form of `window.jmpInfo.settings.[section][key] = value`.
Settings descriptions are stored in the form `window.jmpInfo.settingsDescriptions.[section] = [{ key, options }]`

View File

@ -403,9 +403,22 @@
"section": "subtitles",
"values": [
{
"value": "placement",
"default": "center,bottom",
"value": "ass_style_override",
"default": "",
"possible_values": [
[ "", "subtitles.default" ],
[ "yes", "subtitles.yes" ],
[ "no", "subtitles.no" ],
[ "force", "subtitles.force" ],
[ "scale", "subtitles.scale" ],
[ "strip", "subtitles.strip" ]
]
},
{
"value": "placement",
"default": "",
"possible_values": [
[ "", "subtitles.default" ],
[ "left,bottom", "subtitles.leftBottom" ],
[ "right,bottom", "subtitles.rightBottom" ],
[ "center,bottom", "subtitles.centerBottom" ],
@ -416,8 +429,9 @@
},
{
"value": "color",
"default": "#EEEEEE",
"default": "",
"possible_values": [
[ "", "subtitles.default" ],
[ "#000000", "subtitles.black" ],
[ "#FFFFFF", "subtitles.white" ],
[ "#EEEEEE", "subtitles.lightGrey" ],
@ -429,8 +443,9 @@
},
{
"value": "border_color",
"default": "#000000",
"default": "",
"possible_values": [
[ "", "subtitles.default" ],
[ "#000000", "subtitles.black" ],
[ "#FFFFFF", "subtitles.white" ],
[ "#EEEEEE", "subtitles.lightGrey" ],
@ -441,9 +456,23 @@
]
},
{
"value": "background_color",
"default": "#CCCCCC",
"value": "border_size",
"default": -1,
"possible_values": [
[ -1, "subtitles.default" ],
[ 0, "subtitles.none" ],
[ 1, "subtitles.tiny" ],
[ 2, "subtitles.small" ],
[ 3, "subtitles.normal" ],
[ 4, "subtitles.large" ],
[ 5, "subtitles.huge" ]
]
},
{
"value": "background_color",
"default": "",
"possible_values": [
[ "", "subtitles.default" ],
[ "#000000", "subtitles.black" ],
[ "#FFFFFF", "subtitles.white" ],
[ "#EEEEEE", "subtitles.lightGrey" ],
@ -455,8 +484,9 @@
},
{
"value": "background_transparency",
"default": "00",
"default": "",
"possible_values": [
[ "", "subtitles.default" ],
[ "FF", "subtitles.0%" ],
[ "C0", "subtitles.25%" ],
[ "80", "subtitles.50%" ],
@ -466,8 +496,9 @@
},
{
"value": "size",
"default": 32,
"default": -1,
"possible_values": [
[ -1, "subtitles.default" ],
[ 18, "subtitles.tiny" ],
[ 24, "subtitles.small" ],
[ 32, "subtitles.normal" ],
@ -479,6 +510,7 @@
"value": "font",
"default": "sans-serif",
"possible_values": [
[ "", "subtitles.default" ],
[ "serif", "serif" ],
[ "sans-serif", "sans-serif" ],
[ "script", "script" ],

View File

@ -1139,8 +1139,17 @@ void PlayerComponent::setAudioConfiguration()
///////////////////////////////////////////////////////////////////////////////////////////////////
void PlayerComponent::updateSubtitleSettings()
{
QString assStyleOverride = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "ass_style_override").toString();
if (!assStyleOverride.isEmpty())
{
mpv::qt::set_property(m_mpv, "sub-ass-override", assStyleOverride);
}
QVariant size = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "size");
mpv::qt::set_property(m_mpv, "sub-scale", size.toInt() / 32.0);
if (size != -1)
{
mpv::qt::set_property(m_mpv, "sub-scale", size.toInt() / 32.0);
}
QString font = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "font").toString();
if (!font.isEmpty())
@ -1160,6 +1169,12 @@ void PlayerComponent::updateSubtitleSettings()
mpv::qt::set_property(m_mpv, "sub-border-color", borderColor);
}
QString borderSize = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "border_size").toString();
if (borderSize != -1)
{
mpv::qt::set_property(m_mpv, "sub-border-size", borderSize);
}
QString backgroundColor = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "background_color").toString();
QString backgroundTransparency = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "background_transparency").toString();
if (!backgroundColor.isEmpty() && !backgroundTransparency.isEmpty())