Chapters v1.0.1 Chapters.Parsers.Mp4chaps.Parser View Source
Mp4chaps parser.
Examples
iex> {:ok, [r | _], "", _, _, _} = mp4chaps("00:00:00 Intro")
iex> r
[start: [hours: 0, minutes: 0, seconds: 0], title: "Intro"]
iex> {:ok, r, "", _, _, _} = mp4chaps("00:00:00 Intro\r\n00:01:02 Podlove <https://podlove.org>")
iex> r
[
[start: [hours: 0, minutes: 0, seconds: 0], title: "Intro"],
[start: [hours: 0, minutes: 1, seconds: 2], title: "Podlove", href: "https://podlove.org"]
]
Link to this section Summary
Link to this section Functions
Link to this function
mp4chaps(binary, opts \\ [])
View Source
mp4chaps(binary, opts \\ [])
View Source
mp4chaps(binary(), keyword()) ::
{:ok, [term()], rest, context, line, byte_offset}
| {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
byte_offset: pos_integer(),
rest: binary(),
reason: String.t(),
context: map()
mp4chaps(binary(), keyword()) :: {:ok, [term()], rest, context, line, byte_offset} | {:error, reason, rest, context, line, byte_offset} when line: {pos_integer(), byte_offset}, byte_offset: pos_integer(), rest: binary(), reason: String.t(), context: map()
Parses the given binary
as mp4chaps.
Returns {:ok, [token], rest, context, position, byte_offset}
or
{:error, reason, rest, context, line, byte_offset}
where position
describes the location of the mp4chaps (start position) as {line, column_on_line}.
Options
:line
- the initial line, defaults to 1:byte_offset
- the initial byte offset, defaults to 0:context
- the initial context value. It will be converted to a map
Link to this function