Vttyl

A dead simple vtt parser in Elixir.

CircleCI Hex version badge

Installation

To install Vttyl, add it to your mix.exs file.

def deps do
  [
    {:vttyl, "~> 0.2.0"}
  ]
end

Then, run $ mix deps.get.

Usage

Vttyl has two basic ways to use it.

String Parsing

iex> vtt = """
           WEBVTT

           1
           00:00:15.450 --> 00:00:17.609
           Hello world!
           """
...> Vttyl.parse(vtt) |> Enum.into([])
[%Vttyl.Part{end: ~T[00:00:17.609], part: 1, start: ~T[00:00:15.450], text: "Hello world!"}]

Stream Parsing

iex> "same_text.vtt" |> File.stream!([], 2048) |> Vttyl.parse_stream() |> Enum.into([])
[%Vttyl.Part{end: ~T[00:00:17.609], part: 1, start: ~T[00:00:15.450], text: "Hello world!"}]

License

Vttyl is Copyright © 2019 Grain Intelligence, Inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About Grain

Vttyl is maintained and funded by Grain Intelligence, Inc. The names and logos for Grain are trademarks of Grain Intelligence, Inc.

For more information, see the documentation.