ass

package
v0.0.0-...-f890984 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 5 Imported by: 1

README

GoDoc cover.run

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loadass

func Loadass(v *Ass, filepath string) error

Loadass loads the .ass file and parses out the various possible valid lines.

func Setheaders

func Setheaders(v *Ass)

Setheaders sets default headers for the various fields. These are static and should not change in ass v4

func WriteAss

func WriteAss(v *Ass, outpath string) error

Types

type Ass

type Ass struct {
	//Script info portion
	ScriptInfo struct {
		Header string
		Body   Scriptinfo
	}
	//Aegisub project garbage portion
	PGarbage struct {
		Header string
		Body   Projectgarbage
	}
	//Styles portion
	Styles struct {
		Header string
		Format string
		Body   []Style
	}
	//Events which are usually subtitles or commented out lines.
	Events struct {
		Header string
		Format string
		Body   []Event
	}
}

Ass is the main struct for an .ass subtitle file.

func ParseAss

func ParseAss(filename string) (*Ass, error)

ParseAss - Parses an .ass file to a structure

type Event

type Event struct {
	Format  string
	Layer   int
	Start   string
	End     string
	Style   string
	Name    string
	MarginL int
	MarginR int
	MarginV int
	Effect  string
	Text    string
}

Event contains all of the required variables for an event. Start and End are required, everything else is optional A script will definitely have multiple events.

func Createevent

func Createevent(format string, layer int, start string, end string, style string, name string, marginl int, marginr int, marginv int, effect string, text string) *Event

Createevent creates event from a lit of elements

func Parseevent

func Parseevent(in string, etype string) *Event

Parseevent creates the event from an event string split up on :. For example `Dialogue: 0,0:03:20.10,0:03:21.36,Default,,0,0,0,,` would parse to in = `0,0:03:20.10,0:03:21.36,Default,,0,0,0,` etype = Dialogue

type Projectgarbage

type Projectgarbage struct {
	AudioFile        string
	VideoFile        string
	VideoARMode      string
	VideoARValue     float64
	VideoZoomPercent float64
	ScrollPosition   int
	ActiveLine       int
	VideoPos         int
}

Projectgarbage - aegisub project garbage section Generally useless, until it suddenly isn't. Players will not care about this, this section is only here for compatibility.

type Scriptinfo

type Scriptinfo struct {
	Title       string
	ScriptType  string
	WarpStyle   string
	SBaShadow   string
	YCbCrMatrix string
	PlayResX    int
	PlayResY    int
}

Scriptinfo outlines the script information for the format

type Style

type Style struct {
	Format          string
	Name            string
	Fontname        string
	Fontsize        float64
	PrimaryColour   string
	SecondaryColour string
	OutlineColour   string
	Backcolour      string
	Bold            int
	Italic          int
	Underline       int
	StrikeOut       int
	ScaleX          float64
	ScaleY          float64
	Spacing         float64
	Angle           float64
	BorderStyle     int
	Outline         float64
	Shadow          float64
	Alignment       int
	MarginL         int
	MarginR         int
	MarginV         int
	Encoding        int
}

Style is a struct for the ass styles A script can have multiple styles.

func Createstyle

func Createstyle(name string, fontname string, fontsize float64, pcolour string, scolour string, ocolour string, bcolour string, b int, i int, u int, so int, sx float64, sy float64, spacing float64, angle float64, bstyle int, outline float64, shadow float64, align int, marginl int, marginr int, marginv int, encoding int) *Style

Createstyle creates tyle from a list of elements.

func Parsestyle

func Parsestyle(in string) *Style

Parsestyle - creates a style from a string. Takes a full .ass style line as an argument. Similar to Createevent, except Styles don't have multiple Formats, so we only take the format-less style string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL