From bf568cc3de4da73e0629ddcca421007e00abe77e Mon Sep 17 00:00:00 2001 From: odrling Date: Sun, 4 Aug 2019 09:06:57 +0200 Subject: [PATCH] [mugenizer] change fonts and playback resolution also no need to select the lines now --- README.md | 4 +++- karaoke-adjust-1sec.lua | 46 ++++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index ba3d797..399c459 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ Adds a `{\k100}` at the beginning of your line so your line appears 1s earlier ( Mugenizer --------- -Select all the lines of your karaoke, launch the Mugenizer and it will remove our lead-ins and add mugen's karaoke script. +Launch the Mugenizer and it will remove our lead-ins, change the font to Arial and add mugen's karaoke script. Then in "Automation" you can run "Apply karaoke template" and you're ready to submit your karaoke to Mugen. +PS: Maybe you'll still have to change the color of your subs, or change how the english words are written (like DOA → DOOR). + Split karaoke line ------------------ diff --git a/karaoke-adjust-1sec.lua b/karaoke-adjust-1sec.lua index dae8cfc..f6f1bf4 100644 --- a/karaoke-adjust-1sec.lua +++ b/karaoke-adjust-1sec.lua @@ -68,36 +68,44 @@ function adjust_1sec(subs, sel) aegisub.set_undo_point(tr"1sec adjust lead-in") end -function mugenizer(subs, sel) - local first = true - local line - for _, i in ipairs(sel) do +function mugenizer(subs) + local first = nil - -- add mugen's magic line - if first then - line = subs[i] - line.comment = true - line.start_time = 0 - line.end_time = 0 - line.effect = "template pre-line all keeptags" - line.text = '!retime("line",$start < 900 and -$start or -900,200)!{!$start < 900 and "\\\\k" .. ($start/10) or "\\\\k90"!\\fad(!$start < 900 and $start or 300!,200)}' - subs.insert(i, line) - line.text = cleantags(line.text) - first = false + for i, line in ipairs(subs) do + if line.class == "info" then + if line.key == "PlayResX" or line.key == "PlayResY" then + line.value = "0" + end end - line = subs[i] - if (line.text:find(ktag)) then--don't do anything if there is no ktags in this line + if line.class == "style" then + line.fontname = "Arial" + line.fontsize = "24" + end + + if line.class == "dialogue" then + if first == nil then + first = i + end + while hasleadin(line) do if aegisub.progress.is_cancelled() then return end line = removeleadin(line) end - - subs[i] = line end + subs[i] = line end + + -- add mugen's magic line + line = subs[first] + line.comment = true + line.start_time = 0 + line.end_time = 0 + line.effect = "template pre-line all keeptags" + line.text = '!retime("line",$start < 900 and -$start or -900,200)!{!$start < 900 and "\\\\k" .. ($start/10) or "\\\\k90"!\\fad(!$start < 900 and $start or 300!,200)}' + subs.insert(first, line) end aegisub.register_macro(script_name, script_description, adjust_1sec)