Skip to content

Latest commit

 

History

History
116 lines (95 loc) · 16.8 KB

File metadata and controls

116 lines (95 loc) · 16.8 KB

subkt / myaa.subkt.tasks / Automation

Automation

open class Automation : DefaultTask, SubTask (source)

Task for running Aegisub automations on a script using Aegisub CLI.

The aegisub-cli binary needs to be in your PATH, or specified using aegisubCli.

val assWipe by task<Automation> {
    from(merge.item())
    // filename of script
    script("l0.ASSWipe.moon")
    // name of macro as passed to aegisub.register
    macro("ASSWipe")
    // video to load (needed for e.g. aegisub.frame_from_ms)
    video("premux.mkv")
    dialog(
            // dialog values
            "removeInvisible" to true,
            "cleanLevel" to 4,
            "extraDataMode" to "Remove all",
            // button to push to confirm dialog
            button = 0
    )
    loglevel(Automation.LogLevel.INFO)

    selectLines { ass ->
        // select only lines that are not commented
        select(ass.events.lines.filter { !it.comment })
    }

    out(get("mergefile"))
}

Types

Name Summary
Dialog data class Dialog
LogLevel enum class LogLevel
Selection data class Selection
Selector inner class Selector

Constructors

Name Summary
<init> Automation()
Task for running Aegisub automations on a script using Aegisub CLI.

Properties

Name Summary
aegisubCli val aegisubCli: Property<String>
Name of Aegisub CLI binary, or path to it if it is not in your PATH.
dialog val dialog: Provider<List<Automation.Dialog>>
fileDialog val fileDialog: ListProperty<String>
File names to provide to an aegisub.dialog.open or aegisub.dialog.save call.
from val from: ConfigurableFileCollection!
Specifies the source ASS file.
keyframes val keyframes: ConfigurableFileCollection!
Keyframes file to load.
loglevel val loglevel: Property<Automation.LogLevel>
What Aegisub CLI should print to standard out.
macro val macro: Property<String>
Name of macro to run, as defined by the script specified with script.
out val out: ConfigurableFileCollection
The location to save the ASS file. Defaults to an automatically generated file in the build directory.
script val script: Property<String>
Filename of automation script to run.
selection val selection: Provider<Automation.Selection>
timecodes val timecodes: ConfigurableFileCollection!
Timecodes file to load.
video val video: ConfigurableFileCollection!
Video file to load.

Functions

Name Summary
dialog fun dialog(vararg values: Pair<String, Any>, button: Int): Unit
Values to supply to an aegisub.dialog.display call.
run fun run(): Unit
selectLines fun selectLines(f: Automation.Selector.(ASSFile) -> Unit): Unit
Specify what lines to mark as selected and active.

Inherited Functions

Name Summary
batchItems open fun <T> ItemGroup<T>.batchItems(): List<T>
Gets the items from the given item group that correspond to episodes.
item open fun <T> ItemGroup<T>.item(): T
Gets the item from the given item group that corresponds to entry.

Extension Properties

Name Summary
batch val Task.batch: String
The same as entry if this is a batch task; error otherwise.
currentTask val Task.currentTask: String
The name of this task.
entry val Task.entry: String
The entry (batch or episode) this task corresponds to.
episode val Task.episode: String
The same as entry if this is an episode task; error otherwise.
episodes val Task.episodes: List<String>
The episodes this task corresponds to. A single-item list containing episode if this is an episode task; a list of the episodes for the batch given by batch otherwise.
isBatch val Task.isBatch: Boolean
True if this task is a batch task.
release val Task.release: String
The release this task was generated for.
taskGroup val <T : Task> T.taskGroup: TaskGroup<T>
The TaskGroup instance this task belongs to.

Extension Functions

Name Summary
defaultProperty fun <T> Task.defaultProperty(default: T): Property<T>
Returns a Property with a default value set.
evaluate fun Task.evaluate(expression: String): Provider<List<String>!>!
Evaluates a string using Velocity, splits it on `
evaluateTemplate fun Task.evaluateTemplate(expression: String): Provider<String!>!
Like evaluate but only processes the template syntax, without globbing.
get fun Task.get(propertyName: String): Provider<String!>!
Searches for the given property in the Subs object's SubProperties instance, evaluates its value using evaluate, and returns a single string, assuming that the resulting list contains only one element.
getAs fun <T> Task.getAs(propertyName: String): Provider<T>!
Searches for the given property in the Subs object's SubProperties instance, evaluates its value using evaluate, and returns a single string, cast to the given type using String.asType, assuming that the resulting list contains only one element.
getFile fun Task.getFile(filename: String): Provider<String!>!
fun Task.getFile(filename: Provider<String>): Provider<String!>!
Reads the specified file and processes it using Velocity.
getList fun Task.getList(propertyName: String): Provider<List<String>>
Searches for the given property in the Subs object's SubProperties instance, and evaluates its value using evaluate.
getListAs fun <T> Task.getListAs(propertyName: String): Provider<List<T>!>!
Searches for the given property in the Subs object's SubProperties instance, evaluates its value using evaluate, and casts the list elements to the given type using String.asType.
getRaw fun Task.getRaw(propertyName: String): String
Searches for the given property in the Subs object's SubProperties instance, and returns the raw string. Raises an error if not found.
getRawMaybe fun Task.getRawMaybe(propertyName: String): String?
Searches for the given property in the Subs object's SubProperties instance, and returns the raw string, possibly null.
outputFile fun Task.outputFile(extension: String): ConfigurableFileCollection
Returns a ConfigurableFileCollection containing a single file taskName.extension located in the build directory.
propertyExists fun Task.propertyExists(propertyName: String): Boolean
Returns true if the given property exists in the Subs object's SubProperties instance for the given context.