subtext

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ASSHeader = "[Script Info]\n; Script generated by Ether\nScriptType: v4.00+\nPlayResX: 384\nPlayResY: 288\nScaledBorderAndShadow: yes\nYCbCr Matrix: None\n\n" +
	"[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\n" +
	"Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,1\n\n" +
	"[Events]\nFormat: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n"

ASSHeader is the script header RenderASS writes: FFmpeg's own header for a converted text track (PlayRes 384x288, one "Default" style), so a player that restyles "Default" (Plex Web's subtitle colour, size and position settings) treats it like the converted stream PMS sends.

Variables

This section is empty.

Functions

func AcceptsUploadFormat

func AcceptsUploadFormat(format string) bool

AcceptsUploadFormat is the Plex Web upload format check: case-sensitive on the wire. PMS accepts srt/ass/ssa/smi/txt/psb; Ether also accepts vtt.

func FormatASSTimestamp

func FormatASSTimestamp(d time.Duration) string

FormatASSTimestamp formats a duration as an ASS timestamp, H:MM:SS.cc.

func RenderASS

func RenderASS(cues []Cue) string

RenderASS renders cues as an ASS script with ASSHeader: <i>, <b> and <u> become override tags, other markup is dropped and line breaks are \N.

func RenderSRT

func RenderSRT(cues []Cue) string

RenderSRT renders cues as SubRip.

func RenderVTT

func RenderVTT(cues []Cue) string

RenderVTT renders cues as WebVTT.

Types

type Cue

type Cue struct {
	Start, End time.Duration
	Text       string
}

Cue is one subtitle cue.

func ParseCues

func ParseCues(text string) ([]Cue, error)

ParseCues parses SRT or WebVTT text (already UTF-8) into cues.

Jump to

Keyboard shortcuts

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