diff --git a/force-japanese.patch b/force-japanese.patch index cb839fe..23f1b5f 100644 --- a/force-japanese.patch +++ b/force-japanese.patch @@ -31,12 +31,13 @@ diff -ruN mpvacious/main.lua mpvacious-patched/main.lua require('subs2srs') diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japanese.lua --- mpvacious/utils/force-japanese.lua 1969-12-31 20:00:00.000000000 -0400 -+++ mpvacious-patched/utils/force-japanese.lua 2024-07-22 18:01:09.376499651 -0400 -@@ -0,0 +1,77 @@ ++++ mpvacious-patched/utils/force-japanese.lua 2024-07-22 18:54:10.283179193 -0400 +@@ -0,0 +1,80 @@ +local assdraw = require 'mp.assdraw' + +local preferred_alangs = {"jpn", "ja", "japanese"} +local preferred_slangs = {"jpn", "ja", "japanese"} ++mp.command("set sid no") + +local phrases = { + "日本語オンリーで行こう!英語なんて大嫌い!", @@ -47,7 +48,7 @@ diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japan +} + +local function find_japanese_audio(tracks) -+ local regex = ".*[Jj][Pp].*" ++ local regex = ".*([Jj][Pp]|[Jj]a).*" + for _, track in ipairs(tracks) do + if track.type == "audio" and string.match(track.title or "", regex) then + return track.id @@ -57,7 +58,7 @@ diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japan +end + +local function find_japanese_sub(tracks) -+ local regex = ".*[Jj][Pp].*" ++ local regex = ".*([Jj][Pp]|[Jj]a).*" + for _, track in ipairs(tracks) do + if track.type == "sub" and string.match(track.title or "", regex) then + return track.id @@ -66,6 +67,7 @@ diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japan + return nil +end + ++ +local function find_best_match(tracks, preferred_langs, track_type) + for _, lang in ipairs(preferred_langs) do + for _, track in ipairs(tracks) do @@ -92,6 +94,7 @@ diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japan + mp.add_timeout(3, show_phrase) + else + mp.set_property("sid", "no") ++ mp.command("no-osd set sid no") + end +end +