cover more cases
This commit is contained in:
parent
c505190100
commit
ae55ceddf3
|
@ -31,12 +31,13 @@ diff -ruN mpvacious/main.lua mpvacious-patched/main.lua
|
||||||
require('subs2srs')
|
require('subs2srs')
|
||||||
diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japanese.lua
|
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/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
|
+++ mpvacious-patched/utils/force-japanese.lua 2024-07-22 18:54:10.283179193 -0400
|
||||||
@@ -0,0 +1,77 @@
|
@@ -0,0 +1,80 @@
|
||||||
+local assdraw = require 'mp.assdraw'
|
+local assdraw = require 'mp.assdraw'
|
||||||
+
|
+
|
||||||
+local preferred_alangs = {"jpn", "ja", "japanese"}
|
+local preferred_alangs = {"jpn", "ja", "japanese"}
|
||||||
+local preferred_slangs = {"jpn", "ja", "japanese"}
|
+local preferred_slangs = {"jpn", "ja", "japanese"}
|
||||||
|
+mp.command("set sid no")
|
||||||
+
|
+
|
||||||
+local phrases = {
|
+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 function find_japanese_audio(tracks)
|
||||||
+ local regex = ".*[Jj][Pp].*"
|
+ local regex = ".*([Jj][Pp]|[Jj]a).*"
|
||||||
+ for _, track in ipairs(tracks) do
|
+ for _, track in ipairs(tracks) do
|
||||||
+ if track.type == "audio" and string.match(track.title or "", regex) then
|
+ if track.type == "audio" and string.match(track.title or "", regex) then
|
||||||
+ return track.id
|
+ return track.id
|
||||||
|
@ -57,7 +58,7 @@ diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japan
|
||||||
+end
|
+end
|
||||||
+
|
+
|
||||||
+local function find_japanese_sub(tracks)
|
+local function find_japanese_sub(tracks)
|
||||||
+ local regex = ".*[Jj][Pp].*"
|
+ local regex = ".*([Jj][Pp]|[Jj]a).*"
|
||||||
+ for _, track in ipairs(tracks) do
|
+ for _, track in ipairs(tracks) do
|
||||||
+ if track.type == "sub" and string.match(track.title or "", regex) then
|
+ if track.type == "sub" and string.match(track.title or "", regex) then
|
||||||
+ return track.id
|
+ return track.id
|
||||||
|
@ -66,6 +67,7 @@ diff -ruN mpvacious/utils/force-japanese.lua mpvacious-patched/utils/force-japan
|
||||||
+ return nil
|
+ return nil
|
||||||
+end
|
+end
|
||||||
+
|
+
|
||||||
|
+
|
||||||
+local function find_best_match(tracks, preferred_langs, track_type)
|
+local function find_best_match(tracks, preferred_langs, track_type)
|
||||||
+ for _, lang in ipairs(preferred_langs) do
|
+ for _, lang in ipairs(preferred_langs) do
|
||||||
+ for _, track in ipairs(tracks) 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)
|
+ mp.add_timeout(3, show_phrase)
|
||||||
+ else
|
+ else
|
||||||
+ mp.set_property("sid", "no")
|
+ mp.set_property("sid", "no")
|
||||||
|
+ mp.command("no-osd set sid no")
|
||||||
+ end
|
+ end
|
||||||
+end
|
+end
|
||||||
+
|
+
|
||||||
|
|
Loading…
Reference in a new issue