mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
[automation] remove scripts that seem totally useless
This commit is contained in:
parent
deaf588af9
commit
0146c2e13f
@ -1,79 +0,0 @@
|
|||||||
--[[
|
|
||||||
Copyright (c) 2007, Niels Martin Hansen
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of the Aegisub Group nor the names of its contributors
|
|
||||||
may be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
]]
|
|
||||||
|
|
||||||
local tr = aegisub.gettext
|
|
||||||
|
|
||||||
script_name = tr"Automatic karaoke lead-in"
|
|
||||||
script_description = tr"Join up the ends of selected lines and add \\k tags to shift karaoke"
|
|
||||||
script_author = "Niels Martin Hansen"
|
|
||||||
script_version = "1.0"
|
|
||||||
|
|
||||||
function add_auto_leadin(subs, sel)
|
|
||||||
-- Smallest inter-line duration
|
|
||||||
local min_interdur = nil
|
|
||||||
|
|
||||||
for i = 2, #sel do
|
|
||||||
-- Grab two selected lines
|
|
||||||
local A = subs[sel[i-1]]
|
|
||||||
local B = subs[sel[i]]
|
|
||||||
|
|
||||||
-- Blank duration between lines
|
|
||||||
local interdur = B.start_time - A.end_time
|
|
||||||
|
|
||||||
if interdur > 0 then
|
|
||||||
-- Update smallest inter-line duration
|
|
||||||
if not min_interdur or interdur < min_interdur then
|
|
||||||
min_interdur = interdur
|
|
||||||
end
|
|
||||||
|
|
||||||
B.start_time = A.end_time
|
|
||||||
B.text = string.format("{\\k%d}%s", interdur/10, B.text)
|
|
||||||
|
|
||||||
subs[sel[i]] = B
|
|
||||||
else
|
|
||||||
aegisub.debug.out(2, "Warning: Skipping line-pair with zero or negative inter-duration:\n%s\n%s\n\n", A.text, B.text)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
if min_interdur then
|
|
||||||
aegisub.debug.out(0, "Smallest inter-line duration: %d milliseconds", min_interdur)
|
|
||||||
|
|
||||||
aegisub.set_undo_point(script_name)
|
|
||||||
else
|
|
||||||
aegisub.debug.out(2, "Warning: No lines modified")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function check_minsel_2(subs, sel)
|
|
||||||
return #sel >= 2
|
|
||||||
end
|
|
||||||
|
|
||||||
aegisub.register_macro(script_name, script_description, add_auto_leadin, check_minsel_2)
|
|
@ -1,21 +0,0 @@
|
|||||||
-- Automation 4 demo script
|
|
||||||
-- Macro that adds \be1 tags in front of every selected line
|
|
||||||
|
|
||||||
local tr = aegisub.gettext
|
|
||||||
|
|
||||||
script_name = tr"Add edgeblur"
|
|
||||||
script_description = tr"A demo macro showing how to do simple line modification in Automation 4"
|
|
||||||
script_author = "Niels Martin Hansen"
|
|
||||||
script_version = "1"
|
|
||||||
|
|
||||||
|
|
||||||
function add_edgeblur(subtitles, selected_lines, active_line)
|
|
||||||
for z, i in ipairs(selected_lines) do
|
|
||||||
local l = subtitles[i]
|
|
||||||
l.text = "{\\be1}" .. l.text
|
|
||||||
subtitles[i] = l
|
|
||||||
end
|
|
||||||
aegisub.set_undo_point(script_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
aegisub.register_macro(script_name, tr"Adds \\be1 tags to all selected lines", add_edgeblur)
|
|
@ -1,80 +0,0 @@
|
|||||||
-- Automation 4 demo script
|
|
||||||
-- Converts halfwidth (ASCII) Latin letters to fullwidth JIS Latin letters
|
|
||||||
|
|
||||||
local tr = aegisub.gettext
|
|
||||||
|
|
||||||
script_name = tr("Make text fullwidth")
|
|
||||||
script_description = tr("Shows how to use the unicode include to iterate over characters and a lookup table to convert those characters to something else.")
|
|
||||||
script_author = "Niels Martin Hansen"
|
|
||||||
script_version = "1"
|
|
||||||
|
|
||||||
include("unicode.lua")
|
|
||||||
|
|
||||||
|
|
||||||
lookup = {
|
|
||||||
['!'] = '!', ['"'] = '”', ['#'] = '#', ['$'] = '$',
|
|
||||||
['%'] = '%', ['&'] = '&', ["'"] = '’', ['('] = '(',
|
|
||||||
[')'] = ')', ['*'] = '*', ['+'] = '+', [','] = ',',
|
|
||||||
['-'] = '-', ['.'] = '.', ['/'] = '/',
|
|
||||||
['1'] = '1', ['2'] = '2', ['3'] = '3', ['4'] = '4',
|
|
||||||
['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8',
|
|
||||||
['9'] = '9', ['0'] = '0',
|
|
||||||
[':'] = ':', [';'] = ';', ['<'] = '<', ['='] = '=',
|
|
||||||
['>'] = '>', ['?'] = '?', ['@'] = '@',
|
|
||||||
['A'] = 'A', ['B'] = 'B', ['C'] = 'C', ['D'] = 'D',
|
|
||||||
['E'] = 'E', ['F'] = 'F', ['G'] = 'G', ['H'] = 'H',
|
|
||||||
['I'] = 'I', ['J'] = 'J', ['K'] = 'K', ['L'] = 'L',
|
|
||||||
['M'] = 'M', ['N'] = 'N', ['O'] = 'O', ['P'] = 'P',
|
|
||||||
['Q'] = 'Q', ['R'] = 'R', ['S'] = 'S', ['T'] = 'T',
|
|
||||||
['U'] = 'U', ['V'] = 'V', ['W'] = 'W', ['X'] = 'X',
|
|
||||||
['Y'] = 'Y', ['Z'] = 'Z',
|
|
||||||
['['] = '[', ['\\'] = '\', [']'] = ']', ['^'] = '^',
|
|
||||||
['a'] = 'a', ['b'] = 'b', ['c'] = 'c', ['d'] = 'd',
|
|
||||||
['e'] = 'e', ['f'] = 'f', ['g'] = 'g', ['h'] = 'h',
|
|
||||||
['i'] = 'i', ['j'] = 'j', ['k'] = 'k', ['l'] = 'l',
|
|
||||||
['m'] = 'm', ['n'] = 'n', ['o'] = 'o', ['p'] = 'p',
|
|
||||||
['q'] = 'q', ['r'] = 'r', ['s'] = 's', ['t'] = 't',
|
|
||||||
['u'] = 'u', ['v'] = 'v', ['w'] = 'w', ['x'] = 'x',
|
|
||||||
['y'] = 'y', ['z'] = 'z',
|
|
||||||
['_'] = '_', ['`'] = '‘',
|
|
||||||
['{'] = '{', ['|'] = '|', ['}'] = '}', ['~'] = '~',
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_fullwidth(subtitles, selected_lines, active_line)
|
|
||||||
for z, i in ipairs(selected_lines) do
|
|
||||||
local l = subtitles[i]
|
|
||||||
|
|
||||||
aegisub.debug.out(string.format('Processing line %d: "%s"\n', i, l.text))
|
|
||||||
aegisub.debug.out("Chars: \n")
|
|
||||||
|
|
||||||
local in_tags = false
|
|
||||||
local newtext = ""
|
|
||||||
for c in unicode.chars(l.text) do
|
|
||||||
aegisub.debug.out(c .. ' -> ')
|
|
||||||
if c == "{" then
|
|
||||||
in_tags = true
|
|
||||||
end
|
|
||||||
if in_tags then
|
|
||||||
aegisub.debug.out(c .. " (ignored, in tags)\n")
|
|
||||||
newtext = newtext .. c
|
|
||||||
else
|
|
||||||
if lookup[c] then
|
|
||||||
aegisub.debug.out(lookup[c] .. " (converted)\n")
|
|
||||||
newtext = newtext .. lookup[c]
|
|
||||||
else
|
|
||||||
aegisub.debug.out(c .. " (not found in lookup)\n")
|
|
||||||
newtext = newtext .. c
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if c == "}" then
|
|
||||||
in_tags = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
l.text = newtext
|
|
||||||
subtitles[i] = l
|
|
||||||
end
|
|
||||||
aegisub.set_undo_point(tr"Make fullwidth")
|
|
||||||
end
|
|
||||||
|
|
||||||
aegisub.register_macro(tr"Make fullwidth", tr"Convert Latin letters to SJIS fullwidth letters", make_fullwidth)
|
|
@ -1,32 +0,0 @@
|
|||||||
-- Copyright (c) 2010, Thomas Goyne <plorkyeran@aegisub.org>
|
|
||||||
--
|
|
||||||
-- Permission to use, copy, modify, and distribute this software for any
|
|
||||||
-- purpose with or without fee is hereby granted, provided that the above
|
|
||||||
-- copyright notice and this permission notice appear in all copies.
|
|
||||||
--
|
|
||||||
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
local tr = aegisub.gettext
|
|
||||||
|
|
||||||
script_name = tr"Strip tags"
|
|
||||||
script_description = tr"Remove all override tags from selected lines"
|
|
||||||
script_author = "Thomas Goyne"
|
|
||||||
script_version = "1"
|
|
||||||
|
|
||||||
function strip_tags(subs, sel)
|
|
||||||
for _, i in ipairs(sel) do
|
|
||||||
local line = subs[i]
|
|
||||||
line.text = line.text:gsub("{[^}]+}", "")
|
|
||||||
subs[i] = line
|
|
||||||
end
|
|
||||||
aegisub.set_undo_point(tr"strip tags")
|
|
||||||
end
|
|
||||||
|
|
||||||
aegisub.register_macro(script_name, script_description, strip_tags)
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user