aboutsummaryrefslogtreecommitdiffstats
path: root/macros/pos2an.lua
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2024-02-25 23:01:13 +0000
committergarret <garret@airmail.cc>2024-02-25 23:08:47 +0000
commit67d261ab378fa9166ee6e0c31b7cb4e32a019925 (patch)
tree1fbd2153481e675f283f731c1da59d584513f2c9 /macros/pos2an.lua
parent5edf42a777b02ab939ab751a7d3e7eb0a7efde70 (diff)
downloadaegisub-scripts-67d261ab378fa9166ee6e0c31b7cb4e32a019925.tar.gz
aegisub-scripts-67d261ab378fa9166ee6e0c31b7cb4e32a019925.tar.bz2
aegisub-scripts-67d261ab378fa9166ee6e0c31b7cb4e32a019925.zip
get rid of dependencycontrol bullshit
there is no sense in me keeping it around when all it does is add faff to writing the script add useless noise to the filenames/paths and enforces its opinions upon me which i dont agree with and all for absolutely ZERO reason since i don't even have a feed in the first place if you want to take my scripts and package them into a dependencycontrol feed, you are more than welcome to do so, provided you comply with the terms of the licence. but your life is going to be a little bit harder i'm afraid, sorry about that. i will keep all the script_namespace, depctrl registration and such around for the time being (removing it is >effort)
Diffstat (limited to 'macros/pos2an.lua')
-rw-r--r--macros/pos2an.lua69
1 files changed, 0 insertions, 69 deletions
diff --git a/macros/pos2an.lua b/macros/pos2an.lua
deleted file mode 100644
index 7b67b00..0000000
--- a/macros/pos2an.lua
+++ /dev/null
@@ -1,69 +0,0 @@
-script_name = "pos -> an"
-script_description = "double click the video then snap to an \\an"
-script_author = "garret"
-script_version = "1"
-
-
-local function escape_pattern(txt)
- local magic_chars = "%^%$%(%)%%.%[%]%*%+%-%?"
- return txt:gsub("(["..magic_chars.."])", "%%%1")
-end
-
-local function main(sub, sel)
- local vidx, vidy = aegisub.video_size()
- local left = vidx * 0.25
- local right = vidx - (vidx * 0.25)
- local top = vidy * 0.32
- local bottom = vidy - (vidx * 0.35)
- -- todo: have these customisable in a gui in v2
-
- if not vidx then
- aegisub.log("open a video")
- aegisub.cancel()
- -- todo: might be nice to use script res for this
- -- but realistically if youre using this, youve got a video open
- end
- for _, i in ipairs(sel) do
- local line = sub[i]
- local x
- local y
- local tag
- local c = 0
- line.text = string.gsub(line.text, "\\an%d", "")
- line.text = string.gsub(line.text, "{}", "")
- for postag, posx, posy in string.gmatch(line.text, "{[^}]*(\\pos%(([^,]+), *([^)]+)%))[^}]*}") do
- if c == 0 then
- x = tonumber(posx)
- y = tonumber(posy)
- tag = escape_pattern(postag)
- end
- c = c + 1
- end
- if c == 0 then goto continue end
- -- aegi is luajit
-
- local s
-
- if y <= top then
- s = "t" elseif
- y >= bottom then s = "b"
- else s = "c" end
-
- if x <= left then
- s = s.."l" elseif
- x >= right then s = s.."r"
- else s = s.."c" end
-
- local AN_MAP = {
- tl = 7, tc = 8, tr = 9,
- cl = 4, cc = 5, cr = 6,
- bl = 1, bc = 2, br = 3,
- }
-
- line.text = string.gsub(line.text, tag, "\\an"..AN_MAP[s])
- sub[i] = line
- ::continue::
- end
-end
-
-aegisub.register_macro(script_name, script_description, main)