Quote:
Originally Posted by olof-ynwa
Hello! I use obsidian quite a bit and I've wanted to easily insert highlights from my kindle into my obsidian notes. For this I've written a python script that parses the my clippings file and sorts them into note and highlight pairs where the note content may include commands that govern how and whether to check if there are valid commands in the note , how the content of the highlight should be modified (embedding words with pattern match in obsidian links, adding content above and below the highlight, basic search and replace) and how and where the note should be inserted (file pattern match, header pattern match/ which line, append/prepend etc).
This plugin has worked smoothly for me though  so I don't plan to parse MyClippings directly anymore. So I just wonder how you would go about accessing the notes and highlights from either the specified columns or the comments section. And deleting the command notes when they served their purpose.
|
It depends on where you are running the code. If you are writing a calibre plugin, then you can access any column in any book in the library. In this case, you can get the HTML code stored in the column, parse it how you want and update whatever it is that you need. I can point to code that does it. Or suggest other plugins that would be good references. The "Clean Comments" plugin would probably be a good start.
If you are doing it from outside calibre, you can use the calibredb command to get data from the library. I don't use it much but you can get any column from the library once you know the book id. And the book id can be found in various ways.
Quote:
Also, when you create a note directly in kindle, it automatically creates a highlight at the same time. If you edit the note it creates a new note in my clippings, and if you're highlights are extremely close to eachother there are no ways of distinguishing which note belongs to which highlight except for the timestamp (if created at the same time, no problem, if edited, no chance). This made me notice a bombshell bug, in the plugin notes, are always registered as being created one second before the corresponing highlight even though they should be timestamped at the same time !!! (obviously not an issue but oh well)
|
That's news to me. The plugin reads the files in order and uses the timestamp to sort them within the book. There is some checking for duplicate timestamps, but, all the code does is add a second to to them to make the timestamp unique. If there is a bug, then I need some examples and an explanation of what is wrong and how it should be handled. I don't have a Kindle, so I can't test it myself.