Subtitle.Cue.Builder (kim_subtitle v0.1.6)

View Source

Builder allows to format and align cues. Pass in unformatted, long sentenced cues and get back a stream of cues formatted with the provided defaults.

Supports Cue payloads with WebVTT tags.

Summary

Functions

Flushes the pending cue.

Adds a new cue and maybe returns built cues.

Types

new_option()

@type new_option() ::
  {:max_length, pos_integer()}
  | {:max_lines, pos_integer()}
  | {:min_duration, pos_integer()}

t()

@type t() :: %Subtitle.Cue.Builder{
  last: term(),
  max_length: pos_integer(),
  max_lines: pos_integer(),
  min_duration: pos_integer(),
  pending: Subtitle.Cue.t() | nil
}

Functions

flush(builder)

@spec flush(t()) :: {t(), Subtitle.Cue.t() | nil}

Flushes the pending cue.

new(opts \\ [])

@spec new([new_option()]) :: t()

put_and_get(builder, cue_or_cues, opts \\ [])

@spec put_and_get(t(), Subtitle.Cue.t() | [Subtitle.Cue.t()], Keyword.t()) ::
  {t(), [Subtitle.Cue.t()]}

Adds a new cue and maybe returns built cues.