From e41d6199d66e7cb7f2faf52989de30c327c07b8a Mon Sep 17 00:00:00 2001 From: garret Date: Sun, 13 Jun 2021 15:00:29 +0100 Subject: new ones --- become-fansubber.lua | 41 +++++++++++++++++++++++++++++++++++++++++ tagstrip.lua | 26 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 become-fansubber.lua create mode 100644 tagstrip.lua diff --git a/become-fansubber.lua b/become-fansubber.lua new file mode 100644 index 0000000..dc2111d --- /dev/null +++ b/become-fansubber.lua @@ -0,0 +1,41 @@ +script_name="CR Restyler" +script_description="become a fansubber with a click of a button" +script_author = "garret" +script_version = "1" + +-- Main -> Default +-- Top -> an8 +-- italics -> i1 +-- flashback -> default + +function add_tags(line) + local txt = line.text + local style = line.style + if style:find("Top") then + line.text="{\\an8}"..txt + end + if style:find("Italics") then + line.text="{\\i1}"..txt + end + return line +end + +function change_styles(line) + local style = line.style + if style:find("Top") or style:find("Italics") or style:find("Main") or style:find("Flashback") then + line.style="Default" + end + return line +end + +function main(sub, sel) + for h, i in ipairs(sel) do + local line = sub[i] + line = add_tags(line) + line = change_styles(line) + sub[i] = line + end + aegisub.set_undo_point(script_name) +end + +aegisub.register_macro(script_name, script_description, main) diff --git a/tagstrip.lua b/tagstrip.lua new file mode 100644 index 0000000..1a65a98 --- /dev/null +++ b/tagstrip.lua @@ -0,0 +1,26 @@ +script_name = "tagstrip" +script_description = "nukes tags\n(and comments)" +script_author = "garret" +script_version = "2021-06-13" +include("cleantags.lua") + +function strip(sub, sel) + for h, i in ipairs(sel) do + line = sub[i] + line.text = line.text:gsub("{[^}]-}","") + sub[i] = line + end + aegisub.set_undo_point(script_name) +end + +function clean(sub, sel) + for h, i in ipairs(sel) do + line = sub[i] + line.text = cleantags(line.text) + sub[i] = line + end + aegisub.set_undo_point(script_name) +end + +aegisub.register_macro(script_name, script_description, strip) +--aegisub.register_macro("Clean Tags", script_description, clean) -- dupe of existing aegi one -- cgit v1.2.3-70-g09d2