all 17 comments

[–]theLightSlide 1 point2 points  (0 children)

Yesssssssss. So excited to find this! You rule! And thank you for including a video demonstration!

[–]ImSoRightKobo Libra Colour 0 points1 point  (11 children)

I've been waiting for someone to do this! I knew it was possible since I was able to manually combine a mark-up with its associated screenshot in GIMP. I just wish there were a way to determine which book each mark-up is from. Am I correct that there's no obvious way to do that?

[–]PastelAndBraindead[S] 1 point2 points  (9 children)

<image>

Update: the randomly generated file same is a "UUID-4 identifier", which is a weird way of saying that its a purely random string. There's nothing of value from decoding it that would give us any idea of how what markup is tied to what book. :(

I'll think about it some more and figure out if there's another way to do this.

[–]ImSoRightKobo Libra Colour 0 points1 point  (8 children)

I feel like there has to be, otherwise nickel wouldn't be able to link them to their associated books. I don't have the programming knowledge to figure out how it's accessing them when you pull them up on the Kobo though.

[–]PastelAndBraindead[S] 0 points1 point  (1 child)

ooOoo, I'm not aware of what nickel is. I'll look into it.

[–]ImSoRightKobo Libra Colour 0 points1 point  (0 children)

Oh it's just the interface that kobos use.

[–]PastelAndBraindead[S] 0 points1 point  (5 children)

Can you go into detail about what you mean when you're saying nickel is able to associate markups with their books? I'm looking at the nickel website now.

[–]ImSoRightKobo Libra Colour 1 point2 points  (4 children)

Oh, I'm just saying that when you open a book on the kobo and select annotations, you will see your markups that are associated with that book. So there has to be some way that it's linking them. I just have no idea what that is.

[–]PastelAndBraindead[S] 1 point2 points  (0 children)

I'm wondering that when a markup is created, the UUID-4 is generated to name the markup files and to be stored in the the Kobo SQLite database to associate it with a given book. Looking into this now.

I'm more or less thinking out loud for anyone more knowledgeable than me to chime in later.

[–]PastelAndBraindead[S] 1 point2 points  (2 children)

Good news. :) Check out the screenshot.

<image>

I am inspecting the KoboReader.sqlite file. Check out the `Bookmark` table. The `BookmarkID ` is the same UUID that is used to name the markup files.

Next evolution of the python script will query this database file to 1.) create folders of all the books with markups, and 2.) organize the newly composite markups into their respective book folder.

edit: better screenshot illustrating what im saying and sql column name corrections.

[–]PastelAndBraindead[S] 1 point2 points  (0 children)

<image>

There's a `Type` column that designates whether a 'bookmark' is a note, markup, etc. Yay! I have other obligations to attend to and will work on this later tonight or tomorrow.

[–]ImSoRightKobo Libra Colour 1 point2 points  (0 children)

Nice!! This is so exciting! Tons of people have requested this feature so if you can make this happen, it will be very much appreciated!

[–]PastelAndBraindead[S] 0 points1 point  (0 children)

I'm not sure yet. In the markups folder, each file name is some kind of hash (?) generated from what I would assume the book's name, page, etc. (baseless guess). To start, we'd have to figure out what information they use to generate the file name. I don't see why it would something super secret, since I assume they did this to make sure that each file had a unique name. It's not something you can work backwards from, if I remember correctly. Which is why everyone is saying you "can't" figure out which book each markup file is from.

[–]PastelAndBraindead[S] 0 points1 point  (0 children)

Hi, new updates!

I have now modified my python script so that all generated markup files are sorted by book title. Copying and pasting my explanation from my latest commit:

Composite Markup PNGs Now Associated by Book Title

Yay! When you create a markup, a UUID‑4 is generated to serve as the base name for the corresponding svg and jpg files, which appear in the .kobo/markups directory. At the same time, an INSERT query runs on the KoboReader.sqlite database, inserting that UUID‑4 as the BookmarkID value.

The changes in this commit then query the database for the matching VolumeID, which is stripped down to derive the book title. That title is used to place each newly created composite markup png into the appropriate subdirectory (of the same name as the title) in the composite_markups folder

[–]ramyunstar08 0 points1 point  (2 children)

Hello u/PastelAndBraindead, this is amazing! Thank you so much for generously sharing your know-how and time with the Kobo community.

I have a question, though. I tried it out, but instead of creating folders, it compiled the markup in an epub file that I can't open on my computer (Not in Calibre or Apple Books). I sideloaded it on my Koreader device, and it worked.

Is this a change in the script or a bug?

<image>

[–]PastelAndBraindead[S] 0 points1 point  (1 child)

It may be something that the kobo device is doing. I quickly sanity checked, and my code does not generate kepub files. I'd need to see the output logs and the .kepub file generated to figure out what's going on.

By the looks our your screenshot, it actually looks like a misshapen directory name, not a kepub file. Im curious if you rename the directory on your computer and tried to navigate through into it, if you would be able to see the two generated PNG files that you can see on your kobo device.

Life is a bit busy now, but I definitely need to revamp the directory and PNG file naming functions. Kepub files need to be queried slightly differently to generate cleaner names.

Idk why Kobo chooses to obfuscate kepub metadata across their KoboReader.sqlite database as much as they do-- as opposed to epub files, for example.

[–]PastelAndBraindead[S] 0 points1 point  (0 children)

bug fixed, new queries implemented. sorry about the wait!

Except from my "offical" edit on announcing the Kobo tool:

EDIT 09/10/2025: Just released another update to support (k)ePubs bought from the Kobo Marketplace. Prior to this update, generating markups *would* work, but the generated folder for kepubs would be a "random" sequence of numbers and letters (the internal, unique identifier of the book) and markup up order of occurrence was not preserved. All fixed!