Skip to content

Commit df3af46

Browse files
authored
Add files via upload
1 parent d526a78 commit df3af46

19 files changed

+2277
-0
lines changed

(un)wrap curly braces.lua

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
script_name="Wrap\\Unwrap { }"
2+
script_description="ヽ( ゚ヮ・)ノ"
3+
script_author="dark_star90"
4+
script_version="2.1"
5+
6+
--Settings
7+
kill_inline = true --kill inline tags
8+
9+
10+
function Kevin(subs, sel)
11+
for x, i in ipairs(sel) do
12+
line=subs[i]
13+
line.text = line.text
14+
:gsub("-","NOTEMDASH")
15+
:gsub("%(","FIRSTCLIP")
16+
:gsub("%)","LASTCLIP")
17+
line.text=line.text
18+
:gsub("{","")
19+
:gsub("}","")
20+
line.text = line.text
21+
:gsub("NOTEMDASH","-")
22+
:gsub("FIRSTCLIP","%(")
23+
:gsub("LASTCLIP","%)")
24+
subs[i]=line
25+
end
26+
end
27+
28+
function switch (subs, sel)
29+
for x, i in ipairs(sel) do
30+
line=subs[i]
31+
tags=line.text:match("^{\\[^}]-}")
32+
--keep previous commments
33+
if line.text:match("{<([^\\}]-)>}") then line.text=line.text:gsub("{<([^\\}]-)>}","{|%1|}") :gsub("{([^\\}]-)}","{>%1<}") end
34+
--the actual stuff
35+
line.text=line.text
36+
:gsub("-","NOTEMDASH")
37+
:gsub("%(","FIRSTCLIP")
38+
:gsub("%)","LASTCLIP")
39+
:gsub("\\N","_br_") --save linebreak
40+
:gsub("{<([^\\}]-)>}","{%1}") --restore comment
41+
:gsub("{([^\\}]-)}","}{<%1>}{") --keep comment
42+
:gsub("{<>|([^\\}]-)|<>}","{<%1>}") --keep previous comment
43+
:gsub("{<>([^\\}]-)<>}","%1") --keep previous comment
44+
:gsub("^([^{]+)","{%1") --First { when no tags
45+
:gsub("([^}]+)$","%1}") --Last } on last collumn
46+
:gsub("([^}])({\\[^}]-})([^{])","%1}%2{%3") --keep {} around tags
47+
:gsub("^({\\[^}]-})([^{])","%1{%2") --First { after first set of tags
48+
:gsub("([^}])({\\[^}]-})$","%1}%2")
49+
:gsub("{}","") --get rid off garbage
50+
:gsub("_br_","\\N") --return linebreak
51+
:gsub("NOTEMDASH","-")
52+
:gsub("FIRSTCLIP","%(")
53+
:gsub("LASTCLIP","%)")
54+
if kill_inline == true then
55+
line.text = line.text:gsub("}{\\[^}]-}{","") :gsub("{\\[^}]-}","")
56+
line.text = tags..line.text
57+
end
58+
subs[i]=line
59+
end
60+
end
61+
62+
--aegisub.register_macro("unwrap", script_description, Kevin)
63+
aegisub.register_macro(script_name, script_description, switch)

Anti-Blinker Linking.lua

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
script_name="Anti-Blinker Linking"
2+
script_description="Autosnapper"
3+
script_author="dark_star90"
4+
script_version="1.7"
5+
submenu="_darkis crappy scripts"
6+
7+
--Settings--
8+
max_gap = 65 --time in ms
9+
mpv_link = 220 --gap-time in ms mpv does auto-linking
10+
lead_in_gap = 320 --max pause between scene change and line.start_time incl lead-in
11+
--Settings--
12+
13+
function cutout(subs, sel)
14+
for z, i in ipairs(sel) do
15+
line=subs[i]
16+
j=i+1
17+
if i~=sel[#sel] then
18+
l2=subs[j]
19+
gap = l2.start_time - line.end_time
20+
if gap ~= 0 and gap < max_gap and gap > -1*max_gap then
21+
l2.start_time = line.end_time
22+
l2.effect=l2.effect.." [start time snapped by "..gap.."ms]"
23+
subs[j] = l2
24+
end
25+
26+
if gap >= max_gap and gap < mpv_link then
27+
l3=subs[j]
28+
l3.text="{\\alpha&HFF&}Line to prevent MPV Auto-Linking"
29+
l3.actor=""
30+
l3.effect=" [line inserted]"
31+
l3.start_time=line.end_time
32+
l3.end_time=l2.start_time
33+
subs.insert(i+1, l3)
34+
for s=z,#sel do sel[s]=sel[s]+1 end
35+
end
36+
37+
if gap >= mpv_link and gap < lead_in_gap then
38+
l2.effect=l2.effect.." [gap only "..gap.."ms; check and fix if needed]"
39+
subs[j] = l2
40+
end
41+
end
42+
end
43+
end
44+
45+
aegisub.register_macro(submenu.."/"..script_name, script_description, cutout)

0 commit comments

Comments
 (0)