https://github.com/podlove/chapters
Elixir library to parse and format podcast chapters marks
https://github.com/podlove/chapters
elixir elixir-library podcasting
Last synced: 2 months ago
JSON representation
Elixir library to parse and format podcast chapters marks
- Host: GitHub
- URL: https://github.com/podlove/chapters
- Owner: podlove
- License: mit
- Created: 2019-04-02T08:43:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T10:07:17.000Z (about 6 years ago)
- Last Synced: 2025-07-17T17:53:49.066Z (3 months ago)
- Topics: elixir, elixir-library, podcasting
- Language: Elixir
- Size: 38.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Chapters
[](https://travis-ci.org/podlove/chapters)
[Online Documentation](https://hexdocs.pm/chapters).
[Github Changelog](https://github.com/podlove/chapters/blob/master/CHANGELOG.md)Podcast chapter parser and formatter.
Supports:
- [Podlove Simple Chapters](https://podlove.org/simple-chapters/) (xml/psc)
- mp4chaps
- JSON[Changelog](changelog.html)
## Basic Usage
Decode from mp4chaps
```elixir
iex(1)> chapters = Chapters.decode(~S"""
...(1)> 00:00:00 Intro
...(1)> 00:01:59 Podlove
...(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
```elixir
iex> Chapters.encode(chapters, :psc) |> IO.puts
```
Encode to mp4chaps
```elixir
iex> Chapters.encode(chapters, :mp4chaps) |> IO.puts
00:00:00.000 Intro
00:01:59.000 Podlove
```Encode to JSON
```elixir
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/"}]
```## Installation
The package can be installed by adding `chapters` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:chapters, "~> 1.0"}
]
end
```## License
Chapters is [MIT Licensed][license].
[license]: https://github.com/podlove/chapters/blob/master/LICENSE