Custom audiobook table of contents (TOC)

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:

  1. Create an HTML file with a name “toc.html” that specifies your TOC.
  2. Create a manifest file with a name “publication.json” that lists your audio files and points to your TOC.
  3. Add “toc.html” and “publication.json” to a folder alongside your audio files.
  4. Zip the folder.
  5. Change the file extension from “.zip” to “.lpf.”
  6. 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.
  • The href attribute is the relative location of the audio file.
    • In your case, this is just the name of the audio file since toc.html and 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’s href attribute will be audio/123_1of5.mp3.

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 name is the title of the audiobook.
  • The resources array contains a reference to toc.html.
    • When you adapt this example to your own audiobook, you shouldn’t change this element of the resources array unless you put a different name for your TOC file other than toc.html.
  • The readingOrder array 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 readingOrder array are just names of audio files since publication.json and 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 be audio/123_1of5.mp3.

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.

Related resources

Search
Clear search
Close search
Google apps
Main menu
11255017180236915687
true
Search Help Center
false
true
true
true
true
true
82437
false
false
false
false