Overview
When you upload an audiobook to Google Play Books, you can specify a custom table of contents (TOC) as described in the W3C Audiobook Specification.
With this simplified example, you can learn how to upload audio files and a custom TOC. Detailed use cases are covered in the specification.
At a high level, to upload audio files and a custom TOC:
- Create an HTML file with a name “
toc.html” that specifies your TOC. - Create a manifest file with a name “
publication.json” that lists your audio files and points to your TOC. - Add “
toc.html” and “publication.json” to a folder alongside your audio files. - Zip the folder.
- Change the file extension from “
.zip” to “.lpf.” - Upload the “
.lpf” to Books Partner Center.
Simple example
Important: The sections below provide more detail with the use of a simple audiobook as an example.
To upload a custom TOC for an audiobook called “My Cool Audiobook” with an ISBN of “123,” that comprises 5 .mp3 files:
123_1of5.mp3- Prologue
123_2of5.mp3- Chapter 1: Beginning
123_3of5.mp3- Chapter 2: Middle
123_4of5.mp3- Chapter 3: End
123_5of5.mp3- Epilogue
Step 1: Create a directory
To start, create a directory or folder with the name “123,” since “123” is our audiobook’s ISBN.
Step 2: Put audio files in the directory
Add your audio files to the directory you created. The directory structure looks like this:
123/
├── 123_1of5.mp3
├── 123_2of5.mp3
├── 123_3of5.mp3
├── 123_4of5.mp3
└── 123_5of5.mp3
Step 3: Create a TOC file
Create a file with a name “toc.html” to hold the table of contents:
123/
├── 123_1of5.mp3
├── 123_2of5.mp3
├── 123_3of5.mp3
├── 123_4of5.mp3
├── 123_5of5.mp3
└── toc.html
Step 4: Populate the TOC file
With a list of the files and the names that should shown for them in the TOC, populate toc.html:
<nav role="doc-toc">
<h2>My Cool Audiobook</h2>
<ol>
<li><a href="123_1of5.mp3">Prologue</a></li>
<li><a href="123_2of5.mp3">Chapter 1: Beginning</a></li>
<li><a href="123_3of5.mp3">Chapter 2: Middle</a></li>
<li><a href="123_4of5.mp3">Chapter 3: End</a></li>
<li><a href="123_5of5.mp3">Epilogue</a></li>
</ol>
</nav>
Tips:
- The title of the book goes between the
<h2>tags. - There’s one
<li>for each audio file.- For example, if you want to split one audio file into multiple parts, it’s possible to specify multiple table of contents entries.
- The
hrefattribute is the relative location of the audio file.- In your case, this is just the name of the audio file since
toc.htmland the audio files are in the same directory. - If you put the audio files in a subdirectory with a name
audio, the value of the prologue’shrefattribute will beaudio/123_1of5.mp3.
- In your case, this is just the name of the audio file since
Step 5: Create a manifest
Create a file with a name “publication.json” to hold the audiobook’s manifest:
123/
├── 123_1of5.mp3
├── 123_2of5.mp3
├── 123_3of5.mp3
├── 123_4of5.mp3
├── 123_5of5.mp3
├── publication.json
└── toc.html
Step 6: Populate the manifest
Populate publication.json with details about the audiobook:
{
"@context": [
"https://schema.org",
"https://www.w3.org/ns/pub-context"
],
"conformsTo" : "https://www.w3.org/TR/audiobooks/",
"name": "My Cool Audiobook",
"resources": [
{
"name": "Table of Contents",
"rel": "contents",
"url": "toc.html"
}
],
"readingOrder": [
"123_1of5.mp3",
"123_2of5.mp3",
"123_3of5.mp3",
"123_4of5.mp3",
"123_5of5.mp3"
]
}
Tips:
- The value of the
nameis the title of the audiobook. - The
resourcesarray contains a reference totoc.html.- When you adapt this example to your own audiobook, you shouldn’t change this element of the
resourcesarray unless you put a different name for your TOC file other thantoc.html.
- When you adapt this example to your own audiobook, you shouldn’t change this element of the
- The
readingOrderarray contains a list of relative URLs for audio files, listed in the order they should be presented to the listener.- In your case, entries in the
readingOrderarray are just names of audio files sincepublication.jsonand the audio files are in the same directory.- For example, if you put the audio files in a subdirectory with the name
audio, the URL that represents the prologue file will beaudio/123_1of5.mp3.
- For example, if you put the audio files in a subdirectory with the name
- In your case, entries in the
Step 7: Zip the directory
Compress the 123 directory into a ZIP archive named “123.zip.” The exact steps vary by operating system, but here are instructions for:
Step 8: Rename the zipped directory
Change the file extension of the zipped directory from “.zip” to “.lpf.” So, 123.zip becomes 123.lpf.
Result
In the example, the above steps should produce a ZIP archive with this structure:
123.lpf
├── 123_1of5.mp3
├── 123_2of5.mp3
├── 123_3of5.mp3
├── 123_4of5.mp3
├── 123_5of5.mp3
├── publication.json
└── toc.html
Step 9: Upload to Google Play Books
Upload 123.lpf through the automated fetch process or in the Google Play Books Partner Center.