Chapters v1.0.1 Chapters View Source
Podcast chapter parser and formatter.
Supports:
- Podlove Simple Chapters (xml/psc)
- mp4chaps
- JSON
Basic Usage
Decode from mp4chaps
iex(1)> chapters = Chapters.decode(~S"""
...(1)> 00:00:00 Intro
...(1)> 00:01:59 Podlove <http://podlove.org/>
...(1)> """, :mp4chaps)
[
%Chapters.Chapter{href: nil, image: nil, start: 0, title: "Intro"},
%Chapters.Chapter{
href: "http://podlove.org/",
image: nil,
start: 119000,
title: "Podlove"
}
]
Encode to PSC
iex> Chapters.encode(chapters, :psc) |> IO.puts
<?xml version="1.0" encoding="UTF-8"?>
<psc:chapters version="1.2" xmlns:psc="http://podlove.org/simple-chapters">
<psc:chapter start="00:00:00.000" title="Intro"/>
<psc:chapter start="00:01:59.000" title="Podlove" href="http://podlove.org/"/>
</psc:chapters>
Encode to mp4chaps
iex> Chapters.encode(chapters, :mp4chaps) |> IO.puts
00:00:00.000 Intro
00:01:59.000 Podlove <http://podlove.org/>
Encode to JSON
iex> Chapters.encode(chapters, :json) |> IO.puts
[{"start":"00:00:00.000","title":"Intro"},{"start":"00:01:59.000","title":"Podlove","href":"http://podlove.org/"}]
Link to this section Summary
Link to this section Types
Link to this type
chapter_format()
View Source
chapter_format()
View Source
chapter_format() :: :psc | :mp4chaps | :json
chapter_format() :: :psc | :mp4chaps | :json
Link to this section Functions
Link to this function
decode(input, type)
View Source
decode(input, type)
View Source
decode(binary(), chapter_format()) :: [Chapters.Chapter.t()]
decode(binary(), chapter_format()) :: [Chapters.Chapter.t()]
Decode podcast chapter binary.
Supported formats: :psc, :mp4chaps, :json
Link to this function
encode(input, type)
View Source
encode(input, type)
View Source
encode([Chapters.Chapter.t()], chapter_format()) :: binary()
encode([Chapters.Chapter.t()], chapter_format()) :: binary()
Encode podcast chapter object into binary.
Supported formats: :psc, :mp4chaps, :json