mpv-sub-select icon indicating copy to clipboard operation
mpv-sub-select copied to clipboard

Adds support for secondary subtitle selection and visibility preferences

Open microraptor opened this issue 1 year ago • 2 comments

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).

microraptor avatar Jan 16 '23 10:01 microraptor