Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 07-13-2021, 12:58 PM   #1
degiz
Junior Member
degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.
 
Posts: 3
Karma: 29060
Join Date: Jul 2021
Device: Kobo Forma
Script to import highlights from kobo device to Calibre reader

Hey everyone,

tl;dr I've written a script to import highlights from a kobo book to calibre app viewer; please go ahead and try it!

My reading workflow is very much about the highlights, so I like to have them backed up, and easy to come back to in the future. The key point is to be able to see not only the highlight but also the concrete page in the book as if it's a note in a paper book. I use Calibre to manage my ebook library, and would love to keep using it for my highlights collection as well.

I've recently got a Kobo Forma reader (which I love!) and was happy to find out that all highlights are stored in the SQLite database, with some precise location that looks like that:
Code:
span#kobo\.46\.1
I've figured out that this location system is very similar to the EPUB CFI, the one that calibre is using for its ebook viewer highlight, and wrote a python script that imports the highlights from Kobo database, and inserts them into a calibre database as if you annotated text in the Calibre (see the screenshots).

You can find the script here.

So in a nutshell the script does the following:
  • reads all highlights from Kobo DB
  • matches the Kobo-book to the Calibre-book
  • converts location from Kobo-CFI to Epub-CFI
  • inserts highlights to the calibre DB, making sure there're no duplicates

I don't think that amending the original calibre DB is the best approach, but consider that a hacky solution before I find out the proper one

Current limitations:
  • not a calibre plugin, but an external script, so you need some basic XP with terminal
  • works only for (k)epub books (hardcoded format), but tbh I don't have non-epub books at all

I've tested the script on ~10 epub books (in English and Russian), and it works well, I personally use it for each book I read now.

I've only tested this on Mac Os manually, and I'm planning to add some proper tests later when other people also give it a try.

Please make sure to backup your calibre library!

I hope the script will work for you too, and looking forward to hear your opinion!
Attached Thumbnails
Click image for larger version

Name:	screen_kobo.jpg
Views:	389
Size:	183.4 KB
ID:	188168   Click image for larger version

Name:	screen_calibre.png
Views:	392
Size:	267.0 KB
ID:	188169  
degiz is offline   Reply With Quote
Old 07-14-2021, 05:48 PM   #2
Cootey
Absentminded Reader
Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.
 
Cootey's Avatar
 
Posts: 1,258
Karma: 6467285
Join Date: Apr 2017
Device: Kobo Mini, Libra Colour & Elipsa; Kindle Paperwhite 3 & 4; iOS apps
I can't wait to try this! Does the sync go in the other direction? I'd love to be able to restore lost annotations on my Kobo if that happens.


Sent from my iPad using Tapatalk Pro
Cootey is offline   Reply With Quote
Advert
Old 07-14-2021, 07:45 PM   #3
Wolfsbruder
Connoisseur
Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.Wolfsbruder ought to be getting tired of karma fortunes by now.
 
Wolfsbruder's Avatar
 
Posts: 59
Karma: 260632
Join Date: Apr 2012
Location: US
Device: Kobo HD, Kobo Aura H2O, Kobo Aura One, Kobo Forma, Kobo Elipsa
I will be trying this out too, I look forward to being able to restore lost highlights to my kobo devices as well.

Of course my use case is also to keep highlights in sync across all my kobo devices.
Wolfsbruder is offline   Reply With Quote
Old 07-15-2021, 06:57 AM   #4
degiz
Junior Member
degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.degiz is faster than slow light.
 
Posts: 3
Karma: 29060
Join Date: Jul 2021
Device: Kobo Forma
Quote:
Does the sync go in the other direction?
It's only Kobo->Calibre now. But that's totally doable! I'd like to stabilize the existing functionality first, and then probably implement the other direction too.
degiz is offline   Reply With Quote
Old 07-16-2021, 05:02 AM   #5
Cootey
Absentminded Reader
Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.
 
Cootey's Avatar
 
Posts: 1,258
Karma: 6467285
Join Date: Apr 2017
Device: Kobo Mini, Libra Colour & Elipsa; Kindle Paperwhite 3 & 4; iOS apps
Quote:
Originally Posted by degiz View Post
It's only Kobo->Calibre now. But that's totally doable! I'd like to stabilize the existing functionality first, and then probably implement the other direction too.
Sounds great. Good luck.

I'll give your script a try this weekend.
Cootey is offline   Reply With Quote
Advert
Old 07-16-2021, 05:22 AM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,008
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Can this be converted to a Calibre plugin?
JSWolf is offline   Reply With Quote
Old 07-16-2021, 05:31 PM   #7
Cootey
Absentminded Reader
Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.Cootey ought to be getting tired of karma fortunes by now.
 
Cootey's Avatar
 
Posts: 1,258
Karma: 6467285
Join Date: Apr 2017
Device: Kobo Mini, Libra Colour & Elipsa; Kindle Paperwhite 3 & 4; iOS apps
I may have to experiment with this another time. I've got a big project this weekend, and I don't have poetry installed. I get that it's like homebrew or apt, but I only have a little window for playing this weekend, so I'll explore poetry another time, then revisit your script. Cheers!

Last edited by Cootey; 07-16-2021 at 05:34 PM.
Cootey is offline   Reply With Quote
Old 05-10-2024, 07:13 PM   #8
Bortex
Junior Member
Bortex began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2020
Device: Kobo Glo HD
Quote:
Originally Posted by degiz View Post
It's only Kobo->Calibre now. But that's totally doable! I'd like to stabilize the existing functionality first, and then probably implement the other direction too.
This would be nice 👌
Bortex is offline   Reply With Quote
Old 05-11-2024, 07:23 AM   #9
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,268
Karma: 89531599
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by degiz View Post
It's only Kobo->Calibre now. But that's totally doable! I'd like to stabilize the existing functionality first, and then probably implement the other direction too.
But Kobo Utilities on Calibre and Calibre Annotation both do that very well.
Also the optional menu item on MyBooks Book list.
Quoth is offline   Reply With Quote
Reply

Tags
cfi, highlights, kobo

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i import/export highlights in Calibre? Rbk95 Calibre 15 03-29-2024 09:10 PM
Exporting highlights from Kobo - not using Kobo device Docno Windows Devices 0 05-13-2021 01:50 AM
Kobo Reader Device Interface in Calibre - Disable? ZodWallop Kobo Reader 2 06-06-2020 04:21 PM
PRS-T1 Is it possible to import highlights with Calibre? diddy Sony Reader 53 01-13-2014 08:19 AM
Script: store calibre ebooks as symlinks to existing lib; advanced CLI import dancal Calibre 0 12-10-2012 07:09 PM


All times are GMT -4. The time now is 12:31 PM.


MobileRead.com is a privately owned, operated and funded community.