writer

package
v0.0.0-...-c131409 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package writer create SSA/ASS Subtitle Script

Index

Constants

View Source
const (
	// AlignBottomLeft Bottom Left SSA numbered Alignment
	AlignBottomLeft int = 1 + iota
	// AlignBottomCenter Bottom Center SSA numbered Alignment
	AlignBottomCenter
	// AlignBottomRight Bottom Right SSA numbered Alignment
	AlignBottomRight

	// AlignMiddleLeft Middle Left SSA numbered Alignment
	AlignMiddleLeft
	// AlignMiddleCenter Middle Center SSA numbered Alignment
	AlignMiddleCenter
	// AlignMiddleRight Middle Right SSA numbered Alignment
	AlignMiddleRight

	// AlignTopLeft Top Left SSA numbered Alignment
	AlignTopLeft
	// AlignTopCenter Top Left SSA numbered Alignment
	AlignTopCenter
	// AlignTopRight Top Right SSA numbered Alignment
	AlignTopRight
)

Variables

This section is empty.

Functions

func DummyVideo

func DummyVideo(framerate float64, w, h int, hexc string, cb bool, timeS int) string

DummyVideo blank video file.

Types

type Dialog

type Dialog struct {
	Layer     int
	Start     string
	End       string
	StyleName string
	Actor     string
	Effect    string
	Text      string
	Tags      string
	Comment   bool
}

Dialog Represent the subtitle"s lines.

func NewDialog

func NewDialog(text string) *Dialog

NewDialog create a new Dialog Struct with defaults

func (*Dialog) String

func (d *Dialog) String() string

String get the generated Dialog as a String

type Script

type Script struct {
	Dialog             []*Dialog
	Style              map[string]*Style
	Comment            string
	Resolution         [2]int // WIDTH, HEIGHT map[string]string
	VideoPath          string
	VideoZoom          float64
	VideoPosition      int
	VideoAR            float64
	MetaFilename       string
	MetaTitle          string
	MetaOriginalScript string
	MetaTranslation    string
	MetaTiming         string
	Audio              string
}

Script SSA/ASS Subtitle Script.

func NewScript

func NewScript() *Script

NewScript create a new Script Struct with defaults

func (*Script) AddDialog

func (s *Script) AddDialog(d *Dialog)

AddDialog add a Dialog to SSA/ASS Script.

func (*Script) AddStyle

func (s *Script) AddStyle(sty *Style)

AddStyle add a Style to SSA/ASS Script.

func (*Script) GetStyle

func (s *Script) GetStyle(name string) *Style

GetStyle get the Style matching the argument name if exist else return the Default Style

func (*Script) Save

func (s *Script) Save(fn string)

Save write an SSA/ASS Subtitle Script.

func (*Script) String

func (s *Script) String() string

String get the generated SSA/ASS Script as a String

func (*Script) StyleExists

func (s *Script) StyleExists(name string) bool

StyleExists get if a Style exists matching the argument name

type Style

type Style struct {
	Name      string
	FontName  string
	FontSize  int
	Color     [4]*color.Color //Primary, Secondary, Bord, Shadow
	Bold      bool
	Italic    bool
	Underline bool
	StrikeOut bool
	Scale     [2]float64 // WIDTH, HEIGHT map[string]string
	Spacing   float64
	Angle     int
	OpaqueBox bool
	Bord      float64
	Shadow    float64
	Alignment int
	Margin    [3]int // L, R, V map[string]string
	Encoding  int
}

Style represent subtitle"s styles.

func NewStyle

func NewStyle(name string) *Style

NewStyle create a new Style Struct with defaults

func (*Style) String

func (sty *Style) String() string

String get the generated style as a String

Jump to

Keyboard shortcuts

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