From 5e9cc572f24160a3805714224b289ad5ed9aaa4b Mon Sep 17 00:00:00 2001 From: odrling Date: Sat, 13 Jun 2020 00:06:07 +0200 Subject: [PATCH] update lua scripts see changes at https://git.odrling.xyz/odrling/amoegisub --- automation/autoload/clean-k-tags.lua | 25 +++++++++++++++++++++ automation/autoload/duetto-meika.lua | 4 +--- automation/autoload/karaoke-adjust-1sec.lua | 1 + 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 automation/autoload/clean-k-tags.lua diff --git a/automation/autoload/clean-k-tags.lua b/automation/autoload/clean-k-tags.lua new file mode 100644 index 000000000..e7b9e3378 --- /dev/null +++ b/automation/autoload/clean-k-tags.lua @@ -0,0 +1,25 @@ +local tr = aegisub.gettext + +script_name = tr"Clean k tags" +script_description = tr"Remove double k tags" +script_author = "amoethyst" +script_version = "1.0" + +function special_k(subs, sel) + + -- if the first tag is K/kf this would break the timing for the previous timing + local expr = "^(.-){\\(ko?)([0-9.]*)[^}]-}([^{]-){\\[kK][fo]?([0-9.]*)[^}]-}( -{(\\[kK][fo]?)[0-9.]*[^}]-}.*)$" + + for _, i in ipairs(sel) do + line = subs[i] + before, tag, k1, between, k2, after = line.text:match(expr) + while after ~= nil do + line.text = before .. "{\\" .. tag .. tonumber(k1) + tonumber(k2) .. "}" .. between .. after + subs[i] = line + before, tag, k1, between, k2, after = line.text:match(expr) + end + end + +end + +aegisub.register_macro(script_name, script_description, special_k) diff --git a/automation/autoload/duetto-meika.lua b/automation/autoload/duetto-meika.lua index 9b99a9c06..354db267f 100644 --- a/automation/autoload/duetto-meika.lua +++ b/automation/autoload/duetto-meika.lua @@ -149,9 +149,7 @@ function deduetto_meika(subs, sel) bracketed = bracketed:gsub("\\f[sn][^\\}]*", "") -- add style marker - if line.style ~= script_style.name then - bracketed = "{s:" .. script_style.name .. bracketed:sub(2, #bracketed) - end + bracketed = "{s:" .. script_style.name .. bracketed:sub(2, #bracketed) line.text = line.text:sub(1, match_start-1) .. bracketed .. line.text:sub(match_end + 1, #line.text) end end diff --git a/automation/autoload/karaoke-adjust-1sec.lua b/automation/autoload/karaoke-adjust-1sec.lua index 96f49e1f0..0d03f3617 100644 --- a/automation/autoload/karaoke-adjust-1sec.lua +++ b/automation/autoload/karaoke-adjust-1sec.lua @@ -110,6 +110,7 @@ function mugenizer(subs) line.fontname = "Arial" line.fontsize = "24" line.outline = "1.5" + line.shadow = "0" line.margin_l = "15" line.margin_r = "15" line.margin_t = "20"