Thursday, July 19, 2012

Koboish ebooks

I really like the kobo touch but I noticed that there is a difference in how side-loaded epubs and epubs downloaded from the kobo store are treated by the device. The thing that I liked most about the ones from kobo was the page numbering that corresponds to actual screens required to reach the end of a chapter. After noticing this I started combing the net and discovered the infamous kepub format. On finding this I also found that changing the extension of the files from .epub to to .kepub.epub should give me access to some of those features so I did just that.
Results were mixed:
  1. Hooray, we've got page numbering
  2. In addition to page numbering we can also control the text appearance  using the fonts menu
  3. hmmm, where did the covers go? (actually I did read about this happening)
  4.  the third thing is more subtle and I only noticed that after reading about 30 pages of a chapter, closing the book and then trying to pick up where I had left off: while the chapter was correct, it always loaded the first page. The problem here is that I could no longer add annotations to the book.
Since I really, really wanted that page numbering but I don't have the time to read a book in one go I started to poke around a little.
A warning first:
  1. this work on the kobo touch with the 2.0 firmware
  2. While I've managed to get covers and annotations working I don't know if anything else broke
The first thing you need to do is to change the extension of your epub to .kepub.epub and upload it to your kobo (disconnect the device to trigger it to detect the book). The rest I'll split into three parts:
Give me my cover back
Recover annotations
Get lazy with scripting

Give me my cover back

 The first thing I wanted to do was get rid of the ugly kobo generated covers. Even if the epub has a cover set after changing the extension to .kepub.epub the cover is no longer used and is replaced with some generated covers. 
In order to fix this you need to do the following:
  1. Assuming you cover is a jpeg file named mywonderfullcover.jpg
  2. you will need your cover in four sizes (you can also convert it to grayscale to reduce the size)  and each one of this files needs to have a special name and the extension changed from .jpg to .parsed:
    1.  "mywonderfullcover  - N3_LIBRARY_FULL.parsed" - size: 355 x 530 pixels
    2.  "mywonderfullcover  - N3_LIBRARY_GRID.parsed" - size: 149 x 223 pixels
    3.  "mywonderfullcover  - N3_LIBRARY_LIST.parsed" - size: 60 x 90 pixels
    4.  "mywonderfullcover  - N3_LIBRARY_SHELF.parsed" - size: 40 x 60 pixels
  3. Connect you kobo and copy the files you created to the .kobo/images folder 
  4. Next you'll need to update the sqlite database. The file can be found at .kobo/KoboReader.sqlite. I suggest making a back of this first. Open the database. I use SQLiteSpy but you can use any sqlite browser you like. Open up the content table and look for the row that contains your book name in the ContentID column and has the ContentType column set to 6. The ImageId column for this row should be empty. Set it to "mywonderfullcover".
  5. Save the changes and disconnect the reader
  6. In order for the cover to be detected you have to restart the reader (if anyone knows of another way of refreshing the data from the database please let me know) 
Now you should have your cover back, plus the additional benefits already listed but you still don't have any annotations

Recover annotations

At first I thought that the annotations are kept somewhere in the database...I was wrong.
I also tried putting the file in the .kobo/kepub folder and adding the required entried manually in the database but still there were no annotations  although I did learn some stuff about the database structure while doing this
After doing a little more reading on the forums I found some opinions that there are some special javascripts involved so I opened a free book that I got from the kobo site. This also proved wrong but it did lead me in the correct direction.
There doesn't seem to be any javascript involved but, in looking at the html files it look like the html files inside the kepubs have some special tags inserted that allow annotations to be retrieved. 
So what I did was open each html file and wrap the content of each top level h and p tags in a span tag with the id set to "kobo.[incremental_count]".1 where incrementa_count starts at 1 and goes as high as you need it to.
To illustrate this let's suppose you have the following insisde the body tag of your html:
<p>some paragraph</p>
<p>some other paragraph</p>
<p>the last paragraph</p>

This would be changed to:
<h1><span id="kobo.1.1">Chapter</span></h1>
<h2><span id="kobo.2.1">SubChapter</span></h2>
<p><span id="kobo.3.1">some paragraph</span></p>
<p><span id="kobo.4.1">some other paragraph</span></p>
<p><span id="kobo.5.1">the last paragraph</span></p>

Upload your .kepub.epub back on the device and enjoy the freshly recovered annotations.

Get lazy with scripting


Automatic renaming using calibre

If you use calibre you can configure it to rename your file when uploading it to the reader by going to "Preferences->Sending books to device" and  and adding ".kepub" at the end of the title template.

Automatic photo shop script for updating images

If you use photoshop you can use the script below to automatically create and rename your cover files (save the code in a file with the extension set to .jsx). Just open your jpeg file in photoshop and go to  File->Scripts->Browse and select the file where you saved the script code. Your original file will be left unchanged.
    #target photoshop
    function main(){
    if(!documents.length) return;
    var startRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
 var quality = 10
    var doc = app.activeDocument;
    var Name =\.[^\.]+$/, '');
    var Path = decodeURI(doc.path);
 var outFolder = Folder(Path);// +"/"+Name);
    if(!outFolder.exists) outFolder.create();

 doc.bitsPerChannel = BitsPerChannelType.EIGHT
    createNamedSnapshot("Snap 1");

    doc.resizeImage(355, 530, 96, ResampleMethod.BICUBIC);
    var saveFile = File(outFolder +"/"+Name+" - N3_LIBRARY_FULL.parsed");
    var saveFile = File(outFolder +"/"+Name+" - N3_LIBRARY_FULL.jpeg");
    revertNamedSnapshot("Snap 1");
    doc.resizeImage(149, 223, 96, ResampleMethod.BICUBIC);
    var saveFile = File(outFolder +"/"+Name+" - N3_LIBRARY_GRID.parsed");
    revertNamedSnapshot("Snap 1");
    doc.resizeImage(60, 90, 96, ResampleMethod.BICUBIC);
    var saveFile = File(outFolder +"/"+Name+" - N3_LIBRARY_LIST.parsed");
    revertNamedSnapshot("Snap 1");
    doc.resizeImage(40, 60, 96, ResampleMethod.BICUBIC);
    var saveFile = File(outFolder +"/"+Name+" - N3_LIBRARY_SHELF.parsed");
    app.preferences.rulerUnits = startRulerUnits;

    function SaveJPEG(saveFile, jpegQuality){
    jpgSaveOptions = new JPEGSaveOptions();
    jpgSaveOptions.embedColorProfile = true;
    jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
    jpgSaveOptions.matte = MatteType.NONE;
    jpgSaveOptions.quality = jpegQuality; //1-12
    activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);

    function createNamedSnapshot(name) {
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putClass( charIDToTypeID('SnpS') );
        desc.putReference( charIDToTypeID('null'), ref );
            var ref1 = new ActionReference();
            ref1.putProperty( charIDToTypeID('HstS'), charIDToTypeID('CrnH') );
        desc.putReference( charIDToTypeID('From'), ref1 );
        desc.putString( charIDToTypeID('Nm  '), name );
        desc.putEnumerated( charIDToTypeID('Usng'), charIDToTypeID('HstS'), charIDToTypeID('FllD') );
        executeAction( charIDToTypeID('Mk  '), desc, DialogModes.NO );

    function revertNamedSnapshot(name) {
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putName( charIDToTypeID('SnpS'), name );
        desc.putReference( charIDToTypeID('null'), ref );
        executeAction( charIDToTypeID('slct'), desc, DialogModes.NO );


Automatic kobofying

Now all that is fine but what if you don't want to spend twice as much time as is requred to read a book just to kobofy it.
No worries, since I'm a little lazy myself I create the small python script bellow. In order to run it you need python 2.7 and BeautifulSoup installed. 
In order to use it unpack your files to a folder, create file called inside that folder containing the code bellow and run it by calling "python". 
Warning: this script was hastily put toghether so it has a few restrictions:
  1. It always adds the spans to h and p tags so don't run it multple times on the same file 
  2. It only works on top level h and p tags so, for example, if your h and p tags are wrapped in a div or another tag it won't work.

import sys
from bs4 import BeautifulSoup
import re
import os, os.path
def altertags(soup):
 counter = 1
 for tag in soup.body.find_all(re.compile("^(p|h)"), recursive=False):
  new_tag = soup.new_tag("span", id="kobo."+str(counter)+".1")
  counter = counter + 1

def parsefile(infile, outfile):
 soup = BeautifulSoup(open(infile))
 output = open(outfile,'w')

if (len(sys.argv) > 2):
 infile = sys.argv[1]
 outfile = sys.argv[2]
 parsefile(infile, outfile)
if (len(sys.argv) == 2):
 infile = sys.argv[1]
 parsefile(infile, infile)

if (len(sys.argv) < 2):
 for file in os.listdir("."):
  if file.endswith("html"):
   parsefile(file, file) 
If someone can improve this please share.
I don't actually use this as it requires you to unpack the book, repack and so on and that's to much work for me so I just modified kiwidude's Modify Epub plugin for calibre to do this for me.

Well...that's about it. If anyone reads this and finds it useful feedback is always appreciated.


  1. Hi, may I ask if it's possible to get a copy of your modified "Modify Epub" plugin?

    1. Hi Massimiliano, I didn't publish those changes as they are just a patch and, I might add, a poor patch to the Modify epub plugin. First I had to pack BeautifulSoup inside the package as the one in calibre is an old version and second, the function that actually handles the updates is not very well written. I didn't have time to include any checks and it only works on direct children of the body tag. I have packed the plugin including the updates and you can download it at: . Please note that I don't plan on offering any updates to this so if someone could rewrite the code using lxml (I saw modify epub uses that) and maybe include it in the original plugin or create a stand alone plugin so that you can update modify epub separately I'd be happy to hear about it.

    2. Thanks you very much.
      I know nothing about python o lxml, so probably I wont be able to add anything new to your modified plugin.
      Anyway I'm very interested in epub optimization techniques and I want to try your plugin to see it it's possible to optimize and epub to have the same page turn speed of a kepub.
      I already done much testing about epub optimization (
      I'll keep you informed if I find anything interesting/useful

    3. I've posted a reply on your thread. I don't really bother about optimization as page turns on the modified epubs are fast enough. If you try this let me know if the page turns are as fast as for official kepubs. What I wanted most was page numbering and font tuning.

    4. I'm just doing some test :-)
      It seem that the only needed things to optimize the page turn speed is the file extension. Any .epub renamed .kepub.epub became fast as a real kepub without any modification (I didn't measure it precisely).
      Of course, as you already know, you'll loose cover and annotations functionality. It seem that the lxml optimization has nothing to do with page turn speed.

      A tiny bug thing I've found is that your modified plugin doesn't optimize the first file of the .xhtml files inside an epub.
      For example, If inside a specific epub there are 13 xhtml files, from index_split_000.xhtml to index_split_012.xhtml
      then only the files from index_split_001.xhtml to index_split_012.xhtml are optimized; the first file "index_split_000.xhtml" doesn't have any "span id="kobo.1.1"" tag.

    5. The added spans don't have anything to do with page turn speed as you pointed out. They are only used to be able to add annotations. The problem I had before adding those spans was that annotations were not saved so when you reopened the book it would always go the first page in the chapter (actually in the file).
      All files with .xhtml or .html extensions are processed. What actually happens is that the code grabs all the <h> <p> tags that are direct children of the <body> tag and wraps it's content in a span with that incremented id. What this mean is that if you have something between the h or p tags and the body (if they are wrapped in a div or something) they will not be processed. My assumption is that in your case you either had the situation I mentioned or you didn't have any h or p tags. Actually, this is a problem that I knew and also hit myself with some files. Unfortunately I don't have the time to devise the logic needed to address this problem. I just manually edited the files. So you should always check your files after processing.

      If you know of any plugin that strips out all tags except the ones I specifically request please let me know. I'd be very interested in that as the default formating the kobo offers is good enough for me

    6. Thanks for the explanation, in fact is exactly as you said, in the first index_split_000.xhtml everything is inside 2 nested "div".

      I've just measured the page turn speed of renamed .kepub.epub file, ad they are as fast as a real kepub file.

    7. Thanks, so that's probably why I didn't experience slow page turns. I assume the files inside kepubs are processed (or at least pre-processed) when they are loaded (or when you change the font).

    8. I'm just testing some koboified epub, I've found 2 thing that still doesn't works:
      1) Text search inside the opened book doesn't work, it doesn't find anything
      2) annotation works, but word/sentence highlighting doesn't (I can't add an annotation to highlighted sentence, when I try, the highlight simply vanish)

    9. Are you sure that the file containing the words you are trying to highlight contains the kobo spans? I use highlights to mark spelling errors because it's quocker than adding an annotation and it's ok. This is actually the reason that led me to try and see what was the difference between epubs and kepubs. The only case in which highlight didn't work was when the kobo spans were not added. You could open the epub with sigil and take a quick look at each file inside to make sure all of them have the kobo spans added

    10. I'll check this out, thanks for the suggestion

  2. Hi dsandrei
    Thanks so much for the uploaded my modified Modify Epub.
    Can not believe on 2 requests as it changes it to Kepub!
    Perhaps too busy complaining about V2. I bought mine only 3 weeks ago so I am learning. Knew nothing about epubs. If it was VBA for Access I would be OK.
    Just a bit of feed back and request for help.
    1st found had to add .kepub to the "Configure the device" for it to work. As putting it in Preference>Output Options had no effect.
    2nd download your zip file and used Preferences>Load Plugin from file. (I already had Modify Epub installed and did not remove it as I could not find it). Seemed to update as I now have "Add Kobo paragraph markers". Highlighted epub > tick "Add Kobo paragraph markers"> OK. Get calibre, version 0.8.61
    ERROR: Modify ePub failed: No ePub files were updated

    Modify ePubs
    Logfile for book ID 133 (Master and Commander / Patrick O'Brian)
    Modifying: C:\Users\Michael\AppData\Local\Temp\calibre_0.8.61_tmp_iq9uxm\uokqnn_modify_epub\133.epub
    Trying to add kobo page markers
    ePub not changed after 0.99 seconds
    Any thoughts on what I am doing wrong?
    Many thanks for your hard work.

    1. maybe that the data in xhtml files inside your epub is wrappend inside DIV tag or something like that... in this case it wont work

  3. Hi 1 epub I purchased from Amazon converted ok.
    Looked into another and found "eagerness in his step than the mere Lieutenant Aubrey would have shown./p
    div class="calibre1">/div
    div class="mbppagebreak" id="calibre_pb_1"/div
    /div" for example.
    Don't understand DIV tag any suggestions on what I can do?
    Many thanks
    ps had to remove <> as did not allow tags

    1. Hi Michael, I can't say for sure what is wrong with the files. You could open the epub in Sigil and have a look at how it's formated. What I can tell you is that the conversion only applies to <h> (h1, h2, h3 etc.) and <p> tags are are direct children of the <body> tag. So your files should look like
      <p>text </p>
      <p>text </p>
      <p>text </p>

      If you have some other tags wrapping the body contents it won't work. Something like:
      <p>text </p>
      <p>text </p>
      <p>text </p>
      won't get transformed.

      About the .kepub renaming: for me it worked as I described it but it's probably better to use your method expecially if you use multiple devices as I think your method will only change the names of books uploaded to the kobo.

      About changing to kepub: I'm not sure about that. It does unlock some features and I like to have proper page numbers but there is probably more to kepub than those extra tags and recovering the covers is quite involved.

      I hope you find this useful

  4. Hi Daniel
    Thanks for pointers and have had success in using "Search & Replace" in calibre convert to remove a DIV etc from HTML's in one easy click.
    Now with your jsx PS file I have the covers as well. Really please as my ebooks now work well. No really interested in Shelves as I read a book and the delete it.
    Calibre works no problem with V 2. Just go the CalibrePreferences "dialog" look for the Advanced section at the bottom, then Plugins, expand the line that reads Device Interface Plugins, select Kobo Reader Device Interface and then Customize, and finally, on that screen select the option Attempt to support new...
    In our libraries lend epubs so that where I hope to get my books from.
    Thanks again and any tips you have come across I would be interested in as I don't think Kobo will do a lot with epubs as they wish to sell Kepubs.

  5. Hi Daniel
    As I said "Search & Replace" in calibre convert to remove a DIV etc from HTML's in one easy click. Some CSS margins can be wrong and this can be change on convert by removing with "Look and Feel".
    Find to make sure it rememberer's where it is must goto sleep mode first. Although is set sleep 15mins off 60 or never works fine.
    You said you are not sure about converting to Kepubs. Have you found some problems? Be interested.
    Thanks Michael

    1. Hi Michael, sorry for the late reply, I've been on holiday last week. I didn't find any obvious problems but this process is purely experimental as I don't know for sure what the actual difference between kepub and epub is. There is probably more to it but this seems to work for now. I'll let you know if I find any other tricks. What I'd be interested in is a way to automatize the cover step as it's quite tedious having to modify the database and restart the device when setting the covers.

  6. Hi Daniel hope the holiday was good.
    Don't seem to notice any major problem in use except sleep mode first to remember position. A Kobofied epub is better in that making the bottom menu appear I see the little stripes indicating new chapter starts and how much of the book read by the thick black line from the left. Kobo books do not have this and I just read a Kobo book (purchased) which was in 5 parts with about 22 chapters in each, so really missed the little stripes in bottom menu to see how far I had read.
    I'm interest too if automation can be improved but it seems very few are interested!
    One change I make is to change "font-size: 1em;" to "font-size: 1.1em;" in stylesheet.css. I find that the font size is then the same as Kobo books and I can change between type without altering font size or margins

  7. I usually read one book at a time so it's not difficult changing the font size on the device. I just strip out the font formatting from the epubs.

  8. Hi Daniel
    Downloaded 2.1.1 seems to work great with Kobofied books.
    I am the same as you just keep books I am reading on my KT. If I want a lib keep it on PC.

  9. Thanks for the news. Didn't know they released a new version. Any improvements?

  10. It's a Japan release that people are trying. Forum reports are mixed but most have no problems. Clock is back and speed in epubs which I don't use now are improved. Still like to see, as you do, if adding to KoboReader.sqlite could be automated. Might try another forum post to see it it generates more interest?

  11. I'm working on an extension to the Calibre Kobo Touch driver to auto-magically handle most of this when sending an ePub file to a Kobo Touch/Glo/Mini. I only have a Glo to test with though, but it looks like everything should be the same from the database side. I'm using lxml directly, I found that using BeautifulSoup caused more issues than it was worth (mostly around poorly-converted ePubs or some ePubs from the Kobo store that have intermingled file encodings) and lxml handled them much better.

    Here's what the driver currently does if the uploaded file ends in '.epub':
    1. For all h[1-6] and p tags in every HTML file, wrap the contents of the tag in a span tag with id attribute "kobo.X.1", where X is an incrementing counter starting at 1, reset with each file. The driver checks for the existence of these span tags and skips this processing on a per-tag basis. There's no validation that existing tags aren't duplicated elsewhere so it would be a bad idea to pass a half-processed file through this. It will still work on the device, but annotations and last read position might get wonky.
    2. Ensure the file name on the device ends with the required '.kepub.epub', so adding this to preferences somewhere is not required.
    3. Generate the database entries for each ePub file. There's an entry for the book itself, entries for anything in toc.ncx, and an entry for each individual HTML file defined in content.opf. The database entries I add include series information and the proper Image ID, but this doesn't stop the Kobo device from processing the new books after unplugging the device, which strips out series and image ID data. Still working on how to prevent the device from automatically processing these files.
    4. Every time metadata is synced to the device, re-set the Image ID field for every book entry with a NULL ImageId field.

    The images are already uploaded and properly sized by Calibre so there isn't any need to deal with converting/sizing images. They (and series information, if you're setting it) won't display the first time you eject the device after copying the books but plug it back in after the Kobo does its processing, let calibre update the metadata, and it'll be ready to go.

    I'm not sure it's ready for publishing yet (I'm still testing some things around ePubs, haven't tried non-ePub files yet) but the source is on Github at for anyone that wants to try it out. The usual disclaimers (at your own risk, your mileage may vary, back up your data before you start, not my fault if anything breaks or explodes or ignites or if Zerg start crawling out of your computer) all apply.

    1. Hi Joel,
      Thanks for the heads up. I'll take a look at the driver when I get a little time to play with my kobo.
      I would have used lxml too as it's already available inside calibre but I don't know much (actually anything) about it and Beautifull Soup seemed easier specially as I only had a few hours available to pull this off.
      Please post back if you make any updates.
      I don't have much time but at least I can test a little.

    2. Hi Joel!!

      Firt thank you for your amazing work!! (and thank´s to Daniel too).

      I´m testing the driver.. the only thing I can´t make work is the cover... I don´t see the image... I made as you say: transfer the epub, disconnect, let kobo process (no cover...), plug again, enter Calibre (I need to do some???), exit calibre, disconnect, let kobo process again and no cover....

      I sure I´m doing something wrong....

      I upload a PDF and works great, no different from original driver

      I have a Kobo Touch 2.3.1.

      Thank´s a lot!!! (and sorry for my bad english....)

    3. Hi,
      thank you so much, calibre convert epub in kepub when i transfer it.
      But, same problem of jarruda, no cover.
      Maybe i'm doing something wrong too.
      Good work.

    4. I know why it's doesn't work.
      it's because the plug in don't add image in .kobo/libary, the modification on a sql database is good, but not the transfer of picture.
      I dunno how modify a code source, i'm not so good in python, i'm trying, but I don't know if I can.
      But if I can, i post a modification here, and on mobile read with credit for Joel, if I you want.
      Sorry for my bad english, i'm french

    5. Thanks Joel. It works!!! And I have to admit I'm stunned by how well it works. I followed the instructions for the driver you uploaded. I then connected my Kobo Glo to Calibre and uploaded a book to try it out. Not only the new book had a cover, all my previous epub books uploaded as kepub.epub had a cover too all the sudden!!!

    6. I would like to start by saying that I have a Kobo Glo and I know next to nothing about ebook formats or what is going on here. I tried to follow all the instructions but I don't know if I made a mistake somewhere. If someone could point out my error (if there is one) that would be greatly appreciated

      This is what I did to upload a kobofied book to my kobo:
      1) I downloaded the plugin, made the instructed files into a .zip and uploaded the plugin to calibre
      2) In calibre settings I set metadata managment to auto
      3) I modified my ebooks extension to be .kepub.epub
      4) I added my new ebook to calibre, then uploaded it to my device.

      Was there a point where I was supposed to apply the new plugin to my ebook? Or does my calibre now apply the plugin automatically to all .kepub.epub books?

      Also one last questions, does anybody know if there is some way to have a kepub.epub book remember the last page read (not just the beginning of my last chapter)? Or for me to be able to sync bookmarks between my android kobo app and my kobo ereader?

    7. First of all, you cannot sinc the kepub made this way with the android pp, becouse you have to buy the kepub, and have it saved in the cloud data managment of kobo to be able to use the snc between devices, and if you didn't buy the kepub, but just converted it from an epub, it won't be saved on the cloud storage.

      Second, you don't have to manually set the title.kepub.epub, that is what the plugin does, if you do i manually, your file will be something like title.kepub.kepub.epub, and i really don't have any idea about how the kobo will read thet file.

      For the remember of the last readed page, he kobo should remind it automatically... the problems can be or the strange format (kepub.kepub.epub) or, simply the firmware is bugged.
      If you didn't update it already, i would strongly raccomand to install the latest firmware (2.4.0) wich is fast, and, above all, really stable. You can find it here, with the instructions to install it, if needed:
      Hopeit helps ;)

    8. Thank you for your reply, but I still can't seem to get my kobo to remember my last page read when I exit my book then return back to it.

      I double checked and I already have the latest firmware (2.4.0) on my kobo. I then removed from by device and then from calibre all the books I manually changed to title.kepub.epub. Then I reloaded my original .epub files to calibre and added them back to my device. But everything is still as it was before.

      I get the proper cover images on my kobo, does this mean that I installed the plugin correctly?

      Alarin said:
      "Second, you don't have to manually set the title.kepub.epub, that is what the plugin does"

      After doing all of the above and not getting my desired results I checked my books file in the calibre library. It was not set to title.kepub.epub, but rather had the original title accompanied by the extension .epub

      I feel that I must be doing something wrong and missing a step somewhere, but I can't seem to figure out what it is

  12. Regarding Joel plugin, and the problems encauntered by peppe and jarruda:

    i got the same problems, and i found a solution: in calibre, you have to set the metadata managment to "automatic", then, copy the books in your kobo, unplug, plug back and the program calibre will send a new stream of metadata; unplug again, and you'll have your covers ;)
    to set the metadata managment to automatic go to Preferences | Import/Export | Sending books to devices and change it.

    Hope this will help ;)

    Tested with kobo glow 2.1.5