Skip to content
Extraits de code Groupes Projets
Valider 8f99a2e1 rédigé par odrling's avatar odrling
Parcourir les fichiers

update lua scripts

parent 7814c9ca
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
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)
......@@ -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
line.text = line.text:sub(1, match_start-1) .. bracketed .. line.text:sub(match_end + 1, #line.text)
end
end
......
......@@ -13,7 +13,7 @@ ktag = "\\[kK][fo]?%d+" --pattern used to detect karaoke tags
-- KM template line definition
km_template_effect = "template pre-line all keeptags"
km_templayte_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)}'
km_template_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)}'
function hasleadin(line)--check if there is an existing lead in (2 consecutive bracket with karaoke tags at the start of the line)
return line.text:find("^{[^{}]-" .. ktag .. "[^{}]-}%s*{[^{}]-" .. ktag .. "[^{}]-}")
......@@ -88,7 +88,7 @@ end
function is_template_line(line)
return (line.class == "dialogue"
and line.effect == km_template_effect
and line.text == km_templayte_text)
and line.text == km_template_text)
end
......@@ -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"
......@@ -163,7 +164,7 @@ function mugenizer(subs)
line.start_time = 0
line.end_time = 0
line.effect = km_template_effect
line.text = km_templayte_text
line.text = km_template_text
subs.insert(first, line)
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter