Adds support for secondary subtitle selection and visibility preferences
This PR is based on the audio-select branch so merge #17 first.
This only adds functionality and the way how audio and primary subtitles are selected is not affected. These functionalities have been added:
- Support for secondary subtitle selection, which occurs only after a primary subtitle has been selected
- Support for subtitle visibility settings
- alang is now optional and defaults to
* - After track selection there is a console output
New JSON config options:
secondary_slang
secondary_whitelist
secondary_blacklist
secondary_condition
sub_visibility
secondary_sub_visibility
For more information see the updated readme.
See mpv's notes on secondary subtitles: https://mpv.io/manual/master/#options-secondary-sid
An issue to add the option secondary-slang internally to mpv has been open since 6 years here: https://github.com/mpv-player/mpv/issues/4209 And an issue about not being able to hide/show subtitles depending on, if they are forced is open here: https://github.com/mpv-player/mpv/issues/4271 Both these issues are solved with this script now.
The reason why started working on this is to make this config possible:
[
{
"slang": ["forced"],
"secondary_slang": ["eng?"],
"sub_visibility": true,
"secondary_sub_visibility": false
},
{
"slang": ["eng?"],
"sub_visibility": false
}
]
These preferences make sure that, if forced subtitles are available, they are always selected and made visible. If regular subtitles are available, they are selected, but the visibility hidden by default. They are selected as primary subtitles, if no forced subtitles exist and otherwise as secondary subtitles. This allows to quickly toggle regular subtitles between hidden and visible by using the key shortcuts (v and Alt+v).
This looks quite interesting, but it is quite a significant PR so I probably won't have time to delve into it for some time. If I haven't done a review in a months time then please feel free to make a new comment in this thread to remind me.
I've merged the audio-select PR, however there have been a number of changes on that branch since you forked this, so you'll need to rebase.