gavd.co.uk

My games, code, writing

Deal With It

Getting an ePub onto Google Play

My book has been for sale on Leanpub and Lulu for almost 6 months now. I felt that I wanted it on Google Books, and if possible, for download over Google Play – after all, Play is how I read 90% of books now.

TL;DR version: Book is now up on Google Play and you can browse almost half of the text online for free!

Deal With It cover

Deal With It cover

Unfortunately, I hit some brick walls with it! The Google Books/Partner service UI is pretty dismal. It’s hard to figure out what’s going on! I got proper confused. Thankfully, it all got sorted. Here’s how!

First problem: my file isn’t working!

I set up a Partner Account with Google. I set up my book, using the ISBN that I read off the back of the hard copy I ordered from Lulu.com. Unfortunately, it got to kind of an impasse – it just say there saying “status: new”.

Getting it sorted

Google’s staff responded quickly to my support request. Yes, it took a few hours between each message but getting help of a person was fantastic. The Google crew quickly helped me figure out that firstly,

Turns out the ISBN number on the back of the print version of my book isn’t a “real” ISBN; Google couldn’t verify it. Perhaps this is why it wouldn’t publish? I elected to use a Google auto generated code instead.

Problem 2: My ePub wasn’t 100% valid

The ePub from LeanPub works, but when I scanned it with Google’s tool, it wasn’t 100% valid. Therefore, here’s how I fixed it.

Fixing the ePub

I downloaded Google’s epubcheck tool and ran it:

└─[$]  java -jar epubcheck-3.0.jar ~/Downloads/dealwithit.epub
Epubcheck Version 3.0

Validating against EPUB version 2.0
ERROR: /home/gavin/Downloads/dealwithit.epub/mimetype: Mimetype file should contain only the string "application/epub+zip".
WARNING: /home/gavin/Downloads/dealwithit.epub/OEBPS/stylesheet.css(255): Token '/' not allowed here
ERROR: /home/gavin/Downloads/dealwithit.epub/OEBPS/verso_page.xhtml(25,6): element "p" not allowed here; expected the element end-tag, text or element "a", "abbr", "acronym", "applet", "b", "bdo", "big", "br", "cite", "code", "del", "dfn", "em", "i", "iframe", "img", "ins", "kbd", "map", "noscript", "ns:svg", "object", "q", "samp", "script", "small", "span", "strong", "sub", "sup", "tt" or "var" (with xmlns:ns="http://www.w3.org/2000/svg")
ERROR: /home/gavin/Downloads/dealwithit.epub/OEBPS/verso_page.xhtml(26,6): element "p" not allowed here; expected the element end-tag, text or element "a", "abbr", "acronym", "applet", "b", "bdo", "big", "br", "cite", "code", "del", "dfn", "em", "i", "iframe", "img", "ins", "kbd", "map", "noscript", "ns:svg", "object", "q", "samp", "script", "small", "span", "strong", "sub", "sup", "tt" or "var" (with xmlns:ns="http://www.w3.org/2000/svg")
ERROR: /home/gavin/Downloads/dealwithit.epub/OEBPS/verso_page.xhtml(27,3): The element type "p" must be terminated by the matching end-tag "".
ERROR: /home/gavin/Downloads/dealwithit.epub/OEBPS/verso_page.xhtml: The element type "p" must be terminated by the matching end-tag "".

Check finished with warnings or errors

I unpacked the epub file (for epub is basically a zip file). Then I fixed the problems manually in Vim (there was some invalid CSS and an extraneous <p> tag, that was all) then repacked with:


zip -Xr dealwithit.epub mimetype META-INF OEBPS

It was still erroring though!:

    ERROR: /home/gavin/Downloads/dealwithit/dealwithit.epub/mimetype: Mimetype file should contain only the string "application/epub+zip".

So I somewhat clumsily stripped the newline and rebuilt:


cp mimetype m2 && tr -d "\n\r" mimetype
zip -X0 dealwithit.epub mimetype && zip -Xur9D dealwithit.epub META-INF OEBPS

Note the second line there – it’s important that “mimetype” is uncompressed.

And this FIXXXED IT YESSSSS!! I sent my file off to Google as they’d offered to upload it for me as I was having trouble. And here is my book in the preview program!

Explaining Google Partner Account

I found this quite confusing, so here’s my understanding. Books go up to the partner account. There are then TWO things:

  1. Preview program: this allows Google to display a summary of your book.
  2. Google e-books: this allows you to sell books via Google Play

I totally had them conflated but I thjink I’ve got it straight now! As I say, the poor interface doesn’t help.

I still can’t get rid of the one with the ISBN: I click “delete” and get a JavaScript error!

Google Books

Google Books

Aftermath… AND THEEEEEN

And then, I had to sort out the payment bits. That was relatively straightforward. Now, if someone buys my book, it seems that Google will give me money. Hooray!

I hope this helps somebody!

Deal With It on Google Play – you can browse almost half of the text online for free!

This article was posted in Blog. Bookmark the permalink. Follow comments with the RSS feed for this post.