Skip to content

Latest commit

 

History

History
427 lines (324 loc) · 20.7 KB

README.md

File metadata and controls

427 lines (324 loc) · 20.7 KB

Table of Contents


DependencyControl
https://raw.githubusercontent.com/Akatmks/Akatsumekusa-Aegisub-Scripts/master/DependencyControl.json
Motion Tracking
aae-export
Typesetting Scripts
aka.99PercentTags
aka.SandBox
aka.BackupSection
aka.Cycles
aka.dupe-and-not-comment
Typesetting Snippets
Typesetting Snippets
farn huah
NN.farnhuah
Aegisub VapourSynth Scripts
tkinter_alternatives

Modules
aka.uikit
aka.actor
aka.CIELab
aka.command
aka.config
aka.config2
aka.optimising
aka.outcome
aka.singlesimple
aka.threads
aka.unicode
aka.unsemantic
Thirdparty Modules
effil
request
StackTracePlus


aae-export

AAE Export Function Preview

AAE Export is a Blender add-on that exports tracks and plane tracks into Aegisub-Motion and Aegisub-Perspective-Motion compatible AAE data.

– Download (Windows)
– Download (Linux x86_64)
– Download (Linux aarch64)
– Download (Mac)
– Tutorial 1: Install AAE Export
– Tutorial 2: Basic motion tracking
– Tutorial 3: Introducing smoothing feature
– Tutorial 4: Tracking perspective
– Tutorial: Blender Motion Tracking for Fansubbing by PhosCity

Thanks to

– arch1t3cht for helping in improving algorithms and for developing the original AAE Export (Power Pin) script.
– bucket3432, Noroino Hanako for helping with AAE Export's function.
– bucket3432, petzku and others for helping with UI/UX design.
– Martin Herkt for developing the original AAE Export script in 2012.

License information
aae-export was originally released by Martin Herkt under ISC License. Since then, aae-export has been completely rewritten, with every original line replaced. It is now released under a single MIT License.
aae-export-install-dependencies is a helper tool with its binary included in Linux x86_64 and Mac version of aae-export. The tool is released under MIT License, using Qt libraries under LGPLv3.
aae-export-base122 is a helper tool with its binary included in Linux x86_64 and Mac version of aae-export. It is a wrapper of Kevin Albertson's libbase122 library, and is released under Apache License.

aka.99PercentTags

99%Tags is a script for adding and modifying tags on subtitle lines. It combines the base functions of HYDRA, PhosCity's Edit Tags, Recalculator, NecrosCopy, and LuaIntepret into a simple, easytouse, HYDRA-like interface. It can facilitate simple operations such as setting tag values across multiple lines or performing arithmetic calculations on tag values, but it also provides full Lua interface for complex operations.

To get started:
– Install the script from DependencyControl.
– Use it the same way as ua.HYDRA. If you want to set \fscx to 150, enter 150 in the text field for fscx.
– Try out simple arithmetic calculations. If you want to multiply \fscx by 125%, enter *1.25 in the text field for fscx.
– Explore the builtin „Help“ panel for a detailed guide to all the features of 99%Tags.

Features:
– Carefully designed Lua system that minimises typing for simple operations.
– Easytouse Lua interface that makes complex operations easier to code than aka.Sandbox.
– Builtin „Help“ panel showcasing example usages and explaining all the details.
– Bultiin import and export feature as well as an internal preset system for ease of reusing and sharing operations. See Typesetting Snippets for some snippets by Akatsumekusa.

Relations between 99%Tags and HYDRA, PhosCity's Edit Tags, or other similar scripts:
The idea of 99%Tags is not to replace HYDRA, PhosCity's Edit Tags, NecrosCopy, or other similar scripts. There are many situations where these scripts would be more convenient than 99%Tags. It would be a great idea to learn all these scripts and use whichever one that is the most efficient for the situation.

Comparing against aka.Sandbox for complex operations:
– For any operations that can be performed in 1 pass, especially modifying ASS tags, 99%Tags would be faster to code.
– For any operations that need to compare between all selected lines and can't be performed in 1 pass, or operations that would need to create tags blocks or modify multiple tags blocks at once, aka.Sandbox would be the better choice.

99%Tags Function Preview

aka.Sandbox

aka.Sandbox is a script similar to lyger.LuaInterpret but relies on libraries such as ILL.ILL and l0.ASSFoundation for easy modification of subtitles.

Unique features:
– MoonScript support in addition to Lua.
– Commonly used libraries already required and initialised. No need to manually write requires.
– Builtin import and export of code snippets, as well as an internal preset system.
– Better error handling. If an error occurs during execution, the editor window will open back up to make it easier to tweak the code.

Thanks to
– bucket3432 for developing the original bucket.Sandbox script.
– Zahuczky and PhosCity for suggesting libraries to be required and made available in scope.

99%Tags Function Preview

aka.BackupSection & aka.dupe-and-not-comment

aka.BackupSection and aka.dupe-and-not-comment are similar in function to garret.dupe-and-comment but arrange the new lines in different ways.

To backup using aka.BackupSection, select the lines to backup and click „Backup“. To start from a previous backup, select the previously commented lines and click „Backup“.

Comparing the three scripts,
when applied to the following selection:
99%Tags Function Preview

aka.BackupSection:
99%Tags Function Preview

garret.dupe-and-comment:
99%Tags Function Preview

aka.dupe-and-not-comment:
99%Tags Function Preview

aka.Cycles

aka.Cycles is largely the same as ua.Cycles but with a configuration editor inside Aegisub.

NN.farnhuah

NN.farnhuah is an Aegisub frontend for zhconvert.

To use NN.farnhuah, select the line for farnhuah and click „farn huah“. To switch between chs and cht subtitles, click „chie huann chs her cht“.
On first launch, NN.farnhuah will show a configuration window. Create your own configuration from zhconvert's documentation, or click „Apply Preset“ to use the default config from SweetSub.

Typesetting Snippets

Fix Multiline fax (99%Tags)
Fix alignment at \N for \frz\fax typeset signs.
How to Use: Typeset, use ua.NecrosCopy to split at \N, then apply this snippets using 99%Tags.

Fix Vertical Source Han (99%Tags)
Fix render issues for vertical Source Han fonts.
How to Use: Typeset under libass, use zf.split's „Splits Text By Chars“ feature, then apply this snippets using 99%Tags.
Limitations: Only supports signs without perspective. \pos correction only supports \an1, \an4 and \an7.
Notes: Supporting signs with \frz\fax would probably be fairly easy. Send me a message if you need it.

tkinter_alternatives

tkinter_alternatives.py is a fix for Aegisub VapourSynth Default Video Script if your Python installation does not come with Tkinter.

Download the file and put it in automation/vapoursynth in your Aegisub install location.

Open Aegisub, open „View > Options“ and select „VapourSynth“. In „Default Video Script“, find the import aegisub_vs line:

import aegisub_vs as a

Add the following line below import aegisub_vs line:

import tkinter_alternatives as ask

Find the line to generate keyframe:

__aegi_keyframes = a.get_keyframes(filename, clip, __aegi_keyframes, generate=a.GenKeyframesMode.ASK)

Replace the line with:

__aegi_keyframes = a.get_keyframes(filename, clip, __aegi_keyframes, generate=a.GenKeyframesMode.ASK, ask_callback=ask.callback)

aka.uikit

aka.uikit is a powerful UI framework for aegisub dialogs. Creating a dialog is as simple as:

with dialog = adialog { width: 6 }
    \label { label: "Hello World!" }
with buttons = abuttons!
    \ok "OK"
    \close "Cancel"
button, result = (adisplay dialog, buttons)\resolve!
if buttons\is_ok button
    aegisub.debug.out "Hooray!"

View the document at docs/Using aka.uikit.md.

aka.actor

aka.actor is a flag system visible to the user.
For example, when you backup a line with aka.BackupSection, a backup flag will be added to the commented line.

Check whether a flag exists and the number of times it exists on line:

aactor.flag(line, "backup")

Set flag on line:

aactor.setFlag(line, "backup")

Other functions include:

aactor.flag(line, flag)
aactor.setFlag(line, flag)
aactor.clearFlag(line, flag)
aactor.toggleFlag(line, flag)
aactor.onemoreFlag(line, flag)
aactor.onelessFlag(line, flag)

aactor.field is a aka.singlesimple config specifying the field to place the flags. It has three possible values, actor, effect and style. It is synced across all scripts using aka.actor.

aka.CIELab

aka.CIELab is a module that converts between sRGB RGB with pure power curve 2.4 and CIELab.

import Colour from require "aka.CIELab"
L, a, b = (Colour.fromBT1886RGB R, G, B)\toCIELab!
L, C, h = (Colour.fromPixel (Line.tagsBlocks ass, line)[1].data.color1)\toCIELCh!
X, Y, Z = (Colour.fromCIELCh L, C, h)\toXYZ!

Thanks to Chortos-2 and arch1t3cht for teaching me about BT.709 and gamma 2.4. I might still manage to screw something up in this module and it'll all be my fault, not theirs.

aka.command

aka.command is a (hopefully) problem-free solution for executing commands from Aegisub based on run_cmd function from petzku.util.

aka.command imports run_cmd function from petzku.util. run_cmd should always be preferred over os.execute, not only because it records the log and avoids the 256 character limit on Windows, but also because os.execute sometimes returns 0 even when the program doesn't exit normally. Different from petzku.util, run_cmd in aka.command have quiet = true by default.

log, status, terminate, exit_code = run_cmd(command)

In addition, aka.command provides function c that supports running multiple commands separated by \n. Later commands will only be runned if earlier commands return with exit code 0.

command = c(command)

aka.command also provides function p which when wrapped around paths in the command, escapes any characters that would cause issue. Commands constructed using function p has to be runned through c before executing.

quoted_path = p(path)

Combining run_cmd and c, aka.command provides two shorthand functions:

log, status, terminate, exit_code = run_cmd_c(command)
status = check_cmd_c(command)

Examples of using aka.command:

local acommand = require("aka.command")
local p = acommand.p
local run_cmd_c = acommand.run_cmd_c
local check_cmd_c = acommand.check_cmd_c

-- Check AutoClip dependencies
local command = p(config["python"]) .. " -m ass_autoclip --check-python-dependencies\n" ..
                p(config["python"]) .. " -m ass_autoclip --check-vs-dependencies"
if check_cmd_c(command) then
    aegisub.debug.out("Dependency satisfied.\n")
end

-- Run AutoClip
local command = p(config["python"]) .. " -m ass_autoclip" ..
                                       " --input " .. p(video_file) .. 
                                       " --output " .. p(output_file)
local log, status, terminate, code = run_cmd_c(command)
if status then
    aegisub.debug.out("AutoClip completed successfully.\n")
else
    if terminate == "exit" then
        aegisub.debug.out("Python exits with code " .. tostring(code) .. "\n")
    else
        aegisub.debug.out("Python terminated with signal " .. tostring(code) .. "\n")
end end
import p, run_cmd_c, check_cmd_c from require "aka.command"

-- Check AutoClip dependencies
command = (p config["python"]) .. " -m ass_autoclip --check-python-dependencies\n" ..
          (p config["python"]) .. " -m ass_autoclip --check-vs-dependencies"
if check_cmd_c command
  aegisub.debug.out "Dependency satisfied.\n"

-- Run AutoClip
command = (p config["python"]) .. " -m ass_autoclip" ..
                                  " --input " .. (p video_file) .. 
                                  " --output " .. (p output_file)
log, status, terminate, code = run_cmd_c command
if status
  aegisub.debug.out "AutoClip completed successfully.\n"
else
  if terminate == "exit"
    aegisub.debug.out "Python exits with code " .. (tostring code) .. "\n"
  else
    aegisub.debug.out "Python terminated with signal " .. (tostring code) .. "\n"

aka.config & aka.config2

aka.config is a config module that features a builtin JSON editor with pretty JSON. aka.config2 provides the base JSON and file system functions while aka.config implements three readytouse config functions with GUI.

Readytouse config functions include:

aconfig.read_and_validate_config_if_empty_then_default_or_else_edit_and_save(self, config, config_supp, validation_func)
aconfig.read_and_validate_config_or_else_edit_and_save(self, config, config_supp, validation_func)
aconfig.read_edit_validate_and_save_config(self, config, config_supp, validation_func)

Detailed tutorial is available at docs/Using aka.config and aka.config2.md.

aka.optimising

aka.optimising introduces a timing function for debugging.

Set aka.optimising.json under DependencyControl's configDir to { true }. Use optimising.start() to start the timer. Use optimising.lap(lap_name) to print time to aegisub.debug.out.

aka.outcome

aka.outcome introduces Result and Option similar to Rust's std::result::Result and std::option::Option. It is based on mtdowling's Outcome and is used by aka.config, aka.config and many other Akatsumkusa's scripts.

Detailed introduction is available at docs/Using aka.outcome.md.

License Information
Outcome is originally released by Michael Dowling under MIT License.
It is modified with exisiting functions changed and new functions added by Akatsumekusa.

aka.singlesimple

aka.singlesimple is a config module. It stores one enum per config and the enum is synced* across all scrips requesting the same config.

-- Create a config
config = ss.make_config("aka.Testing", possible_values, default_value)
-- Get the current value
config:value()
-- Set the value
config:setValue(value)

*: Loosely.

Detailed tutorial is available at docs/Using aka.singlesimple.md.

aka.threads

aka.threads is a synced aka.singlesimple config storing the number of threads used when multithreading.

aka.threads defaults to the number of logical processors on the system. Any multithreading script could get the number of threads to use from this config and also change this config at user's request.

threads = require("aka.threads")
-- Get the number of threads to use
threads.threads()
-- Change this config for all scripts
threads.setThreads(8)

aka.unicode

aka.unicode extends aegisub.unicode with a unicode.char(codepoint) function to turn codepoints back to characters.

aka.unsemantic

aka.unsemantic is a version compare module that supports basic version format with two or three positive numbers separated by periods.

V = require("aka.unsemantic").V
assert(V"1.1.2" > V"1.0.24")

Two-number version is treated as three-number version with a patch number of `-1``.

assert(V"2.1.0" > V"2.1")

effil

effil is a multithreading library for Lua.

Add aka.effil to DependencyControl's required modules. View the documents at the original repository.

It is recommended to use the synced module aka.threads for the number of threads to use when multithreading.

License Information
effil is copyrighted to Mikhail Kupriyanov and Ilia Udalov and is licensed under MIT License.

request

LuaJIT-Request is a request module for LuaJIT based on libcurl.

Add aka.request to DependencyControl's required modules. View the documents at the original repository.

License Information
LuaJIT-Request is copyrighted to Lucien Greathouse and is licensed under zlib License. It is adapted to Aegisub environment with minimum modifications.

StackTracePlus

StackTracePlus provides enhanced stack traces for LuaJIT.

require("aka.StackTracePlus")()
(require "aka.StackTracePlus")!

License Information
StackTracePlus is copyrighted to Ignacio Burgueño and is licensed under MIT License. It is adapted to Aegisub environment with some modifications.