Skip to content

Commit

Permalink
Lowercase track lang
Browse files Browse the repository at this point in the history
mpv commit mpv-player/mpv@ab3b174 introduces support for BCP 47 language tags,
which cause mixing of uppercase and lowercase characters in lang.
Unify lowercase this to adapt to new behaviors
  • Loading branch information
dyphire committed Apr 18, 2024
1 parent a23111e commit cacfed7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ the inherited condition from the third preference.
[
{
"alang": ["jpn", "ja"],
"slang": "eng",
"slang": ["en%-us", "eng?"],
"whitelist": [ "sign", "song"],
"condition": "sub.codec == 'ass' and sub.external"
},
Expand Down
6 changes: 3 additions & 3 deletions sub-select.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"alang": ["eng?", "und"],
"slang": ["eng?", "und"],
"slang": ["en%-us", "eng?", "und"],
"condition": "sub.forced"
},
{
Expand All @@ -15,7 +15,7 @@
},
{
"alang": "eng?",
"slang": [ "eng?", "und" ],
"slang": [ "en%-us", "eng?", "und" ],
"whitelist": [ "sign", "song" ]
},
{
Expand All @@ -24,7 +24,7 @@
},
{
"alang": "*",
"slang": [ "eng?", "und" ]
"slang": [ "en%-us", "eng?", "und" ]
},
{
"alang": "no",
Expand Down
4 changes: 2 additions & 2 deletions sub-select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ local function is_valid_audio(audio, pref)
elseif lang == "default" then
if audio.default then return true end
else
if audio.lang and audio.lang:find(lang) then return true end
if audio.lang and audio.lang:lower():find(lang) then return true end
end
end
end
Expand All @@ -238,7 +238,7 @@ local function is_valid_sub(sub, slang, pref)
if not sub.forced then return false end
else
if sub.forced and o.explicit_forced_subs then return false end
if not sub.lang:find(slang) and slang ~= "*" then return false end
if not sub.lang:lower():find(slang) and slang ~= "*" then return false end
end
end

Expand Down

0 comments on commit cacfed7

Please sign in to comment.