Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 07-06-2022, 06:03 PM   #1
wealthychef
Junior Member
wealthychef began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2017
Device: iBooks and Kindle and Calibre
Question How to programmatically insert book highlights imported from Apple Books?

Hello
I have a list of highlights from Apple Books app, and am trying to move them all to an open format.
The opf file in the Calibre directories looked promising but I'm told these files are not the Way as it is only used to restore the database, which never gets corrupted (q.v. https://www.mobileread.com/forums/sh...15&postcount=5). Is there a way to use a shell script and cram my highlights into Calibre from the command line? :-). Thanks
And conversely can they be easily exported? My goal here is to own my own data.
Thank you!
wealthychef is offline   Reply With Quote
Old 07-06-2022, 09:42 PM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 39,707
Karma: 154147706
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
The first question that comes to mind is what format are the exported hightlights in?
DNSB is online now   Reply With Quote
Advert
Old 07-06-2022, 10:07 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want to export calibre highlights you can do so in multiple formats including markdown and json. As for importing highlights, you would first need to write code to convert the highlights from whatever format they are to the format calibre uses, which will be a pretty non-trivial exercise.
kovidgoyal is offline   Reply With Quote
Old 07-08-2022, 08:03 PM   #4
wealthychef
Junior Member
wealthychef began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2017
Device: iBooks and Kindle and Calibre
Quote:
Originally Posted by DNSB View Post
The first question that comes to mind is what format are the exported hightlights in?
A very simple one, with just each line containing a highlight, a tag for the color, and a date. Apple does not give much information. I'm using Readwise at the moment until I figure a better way. It's really a mess.

I think I just want a spec for the format, the conversion is probably not that difficult using something like python. It seems to me that having my highlights in Calibre will allow a more rich exploration and integration with my other tools than Apple's proprietary approach.
wealthychef is offline   Reply With Quote
Old 07-08-2022, 08:06 PM   #5
wealthychef
Junior Member
wealthychef began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2017
Device: iBooks and Kindle and Calibre
Quote:
Originally Posted by kovidgoyal View Post
If you want to export calibre highlights you can do so in multiple formats including markdown and json. As for importing highlights, you would first need to write code to convert the highlights from whatever format they are to the format calibre uses, which will be a pretty non-trivial exercise.
Is the format really that complex? I was thinking to just spit out lines into a file using python. I've done file format conversions before, and it's just a matter of knowing the spec in my experience.

My thinking for storing the highlights in Calibre instead of Apple Books are:
1. I want to own my data
2. I want to use the data in other tools like Obsidian.md and bash scripts

The hard part is figuring out page numbers or file locations for the highlights, because Apple does not store that(!)
wealthychef is offline   Reply With Quote
Advert
Old 07-08-2022, 10:37 PM   #6
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by wealthychef View Post
A very simple one, with just each line containing a highlight, a tag for the color, and a date. Apple does not give much information. I'm using Readwise at the moment until I figure a better way. It's really a mess.

I think I just want a spec for the format, the conversion is probably not that difficult using something like python. It seems to me that having my highlights in Calibre will allow a more rich exploration and integration with my other tools than Apple's proprietary approach.
Quote:
Originally Posted by wealthychef View Post
Is the format really that complex? I was thinking to just spit out lines into a file using python. I've done file format conversions before, and it's just a matter of knowing the spec in my experience.

My thinking for storing the highlights in Calibre instead of Apple Books are:
1. I want to own my data
2. I want to use the data in other tools like Obsidian.md and bash scripts

The hard part is figuring out page numbers or file locations for the highlights, because Apple does not store that(!)
The complexity is if you want the annotation located in the book. The location of the annotation used by the other system has to be converted to that used by calibre. And that might not be easy. It gets harder if the books are not the same version (different formatting). And if there format differences, it gets even harder.

For what you want, the Annotations plugin possibly would work. This import annotations from some devices and export files, builds a bit of HTML and stores it in a column in calibre against a book. It doesn't attempt to match the the location of the annotations within the book, just shows them with the information available. The plugin is extendible with reader code for the device or export format. It should be fairly simple for what you want. The complexity in the code tends to be when matching the book on the device to books in the library, but, the format you describe sounds like the file is for a single book.
davidfor is offline   Reply With Quote
Reply

Tags
mac os


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When you look at a list of your highlights in Books, does it go to beginning of book? 2scre Apple Devices 2 10-24-2020 03:41 PM
Custom columns not being set when adding books programmatically Howlingwolf Development 4 12-10-2014 07:45 AM
Imported books faithify Kobo Tablets 0 04-02-2014 02:50 AM
Programmatically detecting B&N DRM in books chrisridd ePub 13 02-14-2012 01:10 AM
Books imported as articles Deciderization Library Management 4 12-29-2011 04:04 PM


All times are GMT -4. The time now is 03:34 PM.


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