Code Monkey home page Code Monkey logo

obsidian-kobo-highlights-import's Introduction

Obsidian Kobo Highlight Importer

This plugin aims to make highlight import from Kobo devices easier.

How to use

Once installed, the steps to import your highlights directly into the vault are:

  1. Connect your Kobo device to PC using a proper USB cable
  2. Check if it has mounted automatically, or mount it manually (e.g. open the root folder of your Kobo using a file manager)
  3. Open the import window using the plugin button
  4. Locate KoboReader.sqlite in the .kobo folder ( this folder is hidden, so if you don't see it you should enable hidden files view from system configs )
  5. Extract

Templating

The default template is:

---
title: {{Title}}
author: {{Author}}
publisher: {{Publisher}}
dateLastRead: {{DateLastRead}}
readStatus: {{ReadStatus}}
percentRead: {{PercentRead}}
isbn: {{ISBN}}
series: {{Series}}
seriesNumber: {{SeriesNumber}}
timeSpentReading: {{TimeSpentReading}}
---

# {{Title}}

## Description

{{Description}}

## Highlights

{{highlights}}

Variables

Tag Description Example
highlights Will get replaced with the extracted highlights. {{highlights}}
title The title of the book. {{title}}
author The author of the book. {{author}}
pulbisher The publisher of the book {{publihser}}
dateLastRead The date the book was last read in ISO format. {{dateLastRead}}
readStatus Can be: Unopened, Reading, Read. {{readStatus}}
isbn The ISBN of the book. {{isbn}}
series The series of which the book is a part of. {{series}}
seriesNumber The position of the book in the series. {{seriesNumber}}
timeSpentReading The time spent reading the book. {{timeSpentReading}}

Highlight markers

The plugin uses comments as highlight markers, to enable support for keeping existing highlights. All content between these markers will be transferred to the updated file.

%%START-<MARKER IDENTIFIER>%%

%% Here you can type whatever you want, it will not be overwritten by the plugin. %%

%%START-EXTRACTED-HIGHLIGHT-<MARKER IDENTIFIER>%%
...highlight
%%END-EXTRACTED-HIGHLIGHT-<MARKER IDENTIFIER>%%

%% Here you can type whatever you want, it will not be overwritten by the plugin. $$

%%END-<MARKER IDENTIFIER>%%`

Helping Screenshots

Obsidian Callouts

Kobo Highlight Importer uses Obsidian callouts for the highlights and annotations imported; Which can be configured individually. Turning this toggle off will fallback to the standard markdown block quotes for highlights only.

Check the documentation to get a list of all available callouts that obsidian offers.

Contributing

Please feel free to test, send feedbacks using Issues and open Pull Requests to improve the process.

obsidian-kobo-highlights-import's People

Contributors

android272 avatar bitwiseops avatar dependabot[bot] avatar github-actions[bot] avatar nathanstrik avatar niciliketo avatar ogkevin avatar ogkevin-bot avatar ogkevin-robot[bot] avatar rsletta avatar tjex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

obsidian-kobo-highlights-import's Issues

I'm getting a "Disk Image Is Malformed" error

Hi, I was trying to import my highlights to add new books I read since the last time I imported them but I am getting this error

Error: database disk image is malformed at f.handleError (plugin:obsidian-kobo-highlights-importer-plugin:599:19) at c.step (plugin:obsidian-kobo-highlights-importer-plugin:326:31) at Repository.parseContentStatement (plugin:obsidian-kobo-highlights-importer-plugin:17700:22) at Repository.eval (plugin:obsidian-kobo-highlights-importer-plugin:17659:29) at Generator.next (<anonymous>) at eval (plugin:obsidian-kobo-highlights-importer-plugin:54:61) at new Promise (<anonymous>) at __async (plugin:obsidian-kobo-highlights-importer-plugin:38:10) at Repository.getAllContentByBookTitleOrderedByContentId (plugin:obsidian-kobo-highlights-importer-plugin:17654:12) at HighlightService.eval (plugin:obsidian-kobo-highlights-importer-plugin:17491:40)

How can I fix it?

bookmark seems to link to a non existing content

I have this error when I run the plugin in Obsidian

Error: bookmark seems to link to a non existing content: OEBPS/xhtml/73_Chapter.xhtml
    at HighlightService.eval (plugin:obsidian-kobo…ter-plugin:17348:17)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-kobo…porter-plugin:41:24)

Obsidian: 1.5.8
Plugin: 1.5.4

I don't know how to properly debug this. I appreciate all the help that can be provided.

[Feature Request] Import words from internal Kobo «saved words» file

Why
It could be useful for all who read books in foreign languages
For example, I still learn English and regularly come across words in books that I don’t know. And I mark them in Kobo «for learn».

Because learning words is very inconvenient with Kobo. And Obsidian has a useful Anki plugin for learning words.

What
Make an option to import in a separate note in Obsidian all words that are marked as «saved»
If Kobo has such data, it would be cool to indicate the date when the word was marked when importing. To remove duplicates. Or at least indicate the book within which they are marked.

Unable to install

I'm not sure what is causing my vault to send an error message every time I try to install this plugin, is there a way to install manually?

typo in src/settings/Settings.ts

I was looking through the code and found these two typos.

src/settings/Settings.ts
38:        this.add_temaplte_path();
59:    add_temaplte_path(): void {

the function is both declared and called as a misspelling. So everything is working fine of course, however it could be a recipe for a bug down the track.

I have fixed it on a branch and can push if I get granted access :~)

Be able to link to specific highlights

In Obsidian, you can link to a specific heading.
Translated to exported highlights, I would like to be able to link to a specific highlight.

In the Kindle exporter that I use (https://github.com/hadynz/obsidian-kindle-plugin) this can easily be done, because

  • the per-highlight template is editable (apart from the general template)
  • there are variables for (for example) location

Ideally, this kind of structure makes it very flexible to export highlights.

Alternatively, just putting a heading above every highlight with the location (i.e. ### location {{ location_number }}) would do the trick even without customizable highlight templates.
We could then immediately "deep-link" to the specific highlights by using [[BookTitle#location loc_number]]

Instructions on how to obtain the sqlite database used by the test suite?

I am trying to run the test suite for this repo.
I am using the command

npm run test

However, when I run the tests, I get the following

Error: ENOENT: no such file or directory, open 'KoboReader.sqlite'

Is it possible to provide instructions on how to obtain the sqlite database used by the test suite?

Bookmark column returned unexpected null

Hello,
while trying to import my huge database (2695 highlights) I encountered this error:

"Bookmark column returned unexpected null"

After some trial and error, I found that my database, for some reason, had some highlights rows with a blank "text" column (not NULL, blank), and the plugin throws an error thinking the column is NULL.

Deleting those rows fixed the issue.

I suggest changing the SQL WHERE clause in the getAllBookmark() function to check if Text is not null and Text <> '' to fix it

Add Highlight page-number

Is it possible to add the page-number where the highlight was made? The highlights seem to be inserted in random order and by adding the page-number it will be easier sorting them.

Edited for clarification

Import all book content

Thanks for the plugin! Just great.
I would like to know if there is any chance to import all the book content to the note as well.
It would be very useful to me if I could read from the note the context where I did the highlight or comment.

Thanks!

Error during import of KoboReader.sqlite

Error: bookmark seems to link to a non existing content: ops/xhtml/appendixb.html at HighlightService.eval (plugin:obsidian-kobo-highlights-importer-plugin:17348:17) at Generator.next (<anonymous>) at fulfilled (plugin:obsidian-kobo-highlights-importer-plugin:41:24)

Upon selecting extract from the KoboReader.sqlite file, I receive this error. Unsure on how to proceed from here. Device details are as follows:
Kobo Libra 2
Software version: 4.37.21586 (42535ad976, 7/6/23)

First time downloading and trying to use the plugin from the community plugin store, and here is my settings. Thank you and appreciate any guidance.
Image 16-7-23 at 6 07 PM

Error filtering by contentId yielded more then 1 result

Hello there :)

I got the following error when trying your plugin. Is there anything I can do to fix this?

plugin:obsidian-kobo-highlights-importer-plugin:17595 Error: filtering by contentId yielded more then 1 result: /mnt/onboard/Martraire, Cyrille/Living Documentation - Cyrille Martraire.kepub.epub!OEBPS!chap17.xhtml#leanpub-auto-accuracy-mechanism
    at Repository.eval (plugin:obsidian-kobo-highlights-importer-plugin:17442:15)
    at Generator.next (<anonymous>)
    at eval (plugin:obsidian-kobo-highlights-importer-plugin:50:61)
    at new Promise (<anonymous>)
    at __async (plugin:obsidian-kobo-highlights-importer-plugin:34:10)
    at Repository.getContentLikeContentId (plugin:obsidian-kobo-highlights-importer-plugin:17432:12)
    at HighlightService.eval (plugin:obsidian-kobo-highlights-importer-plugin:17311:35)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-kobo-highlights-importer-plugin:37:24)

Integrate with Obsidian Book search

Obsidian Book search is a great plugin for automatically creating notes for the books you are reading. It pulls meta data from the web and allows you to replace {{Variables}} in your notes much like this plugin does.

I would like to use book search to create the book note, and then kobo highlights import to get all my highlights and notes and add them to the same note. But currently I can't mix the two just yet as this plugin saves the highlights/notes, whipes all properties, re-applies the template, and then re-applies the highlights/notes.

This is ok if I am only using Kobo to get the meta data for my notes properties. But I just combined my two templates used for book search and kobo highlights import. I then transferred some of the properties from the book note to the highlight note such as Cover link, and rating and this plugin did not save the values but reverted them to their template form. Which sinse kobo highlight import does not recognizes coverUrl as a tag for example just left it as {{coverUrl}}

image

Renovate Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • ci(github-action): update actions/setup-node action to v3.6.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
.devcontainer/Dockerfile
  • mcr.microsoft.com/vscode/devcontainers/javascript-node 18-bullseye@sha256:ed57dd8755b4e75a0426bd10ab1d3a60a22bb21fc2e093801375990978c42fb5
.devcontainer/base.Dockerfile
  • node 18-bullseye@sha256:8cdf7234449f35e579f7491137807ddb3a089f028862f7ab69af437cc9f47ff1
github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v3
  • actions/setup-node v3.4.1
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/main.yaml
  • siderolabs/conform v0.1.0-alpha.27
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/publish.yaml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/create-release v1
  • actions/upload-release-asset v1
  • actions/upload-release-asset v1
  • actions/upload-release-asset v1
.github/workflows/release.yaml
  • google-github-actions/release-please-action v3
npm
package.json
  • @popperjs/core 2.11.8
  • @types/better-sqlite3 7.6.3
  • esbuild-plugin-wat 0.2.7
  • moment 2.29.4
  • sanitize-filename-ts 1.0.2
  • sql.js 1.8.0
  • @types/chai 4.3.5
  • @types/mocha 10.0.1
  • @types/node 18.16.18
  • @types/sql.js 1.4.4
  • @typescript-eslint/eslint-plugin 5.59.11
  • @typescript-eslint/parser 5.59.11
  • builtin-modules 3.3.0
  • chai 4.3.7
  • esbuild 0.18.0
  • eslint 8.42.0
  • mocha 10.2.0
  • nyc 15.1.0
  • obsidian 1.2.8
  • ts-node 10.9.1
  • tslib 2.5.3
  • typescript 5.1.3

Deleting highlight from Kobo does not delete its corresponding entry in markdown note file

As revealed in #91 , deleting a highlight in the kobo does not delete the highlight from its corresponding markdown file upon resyncing.

The ramification of this is that users will only ever be able to add additional highlights in the document. They cannot remove a highlight.

Examples of use case:

  • a highlight is perhaps no longer relevant
  • a highlight was created by accident and only noticed on initial sync

Link highlight date to daily note

Add setting for using daily note path, to make the highlight creation date link navigate to daily note.

OPTIONAL: Make link creation optional?

Allow a different callout per colour

On the new colour kobo ereaders there's an extra column in the Bookmark (Color) which is an int indicating the highlight colour of the highlight:

  • 0 yellow
  • 1 pink
  • 2 blue
  • 3 green

it would be great to be able to set different callouts for each of these in the plugin options!

great plugin , thank u

Possible to have chapter?

hello, is it possibile to have also chapter? So a note would populate like:

### Chapter 1
- Highlight
- Highlight

### Chapter 2
- Highlight
...
...

Thank's

Add highlights to existing file

It would be nice to be able to sync highlights to an existing file (such as notes created by Book Search). Initially, I considered using the ISBNs from the SQLite database and matching them with an ISBN field in the frontmatter for this purpose. However, the complexity arises due to the nature of ISBNs. Since a single book may have multiple ISBNs, varying with the publisher and edition, this method might result in incorrect identification of many books. A more reliable, albeit slightly unorthodox, approach could be to perform string matching between the book's title/author fields between the SQLite database and frontmatter.

Should this feature seem like a viable addition to the code base, I am happy to contribute by submitting a PR.

Renovate Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Errored

These updates encountered an error and will be retried. Click on a checkbox below to force a retry now.

  • ci(github-action): update renovatebot/github-action action to v40.1.7
  • fix(deps): update @types/chai to 4.3.14
  • fix(deps): update @types/node to 20.11.30
  • fix(deps): update esbuild to 0.20.2
  • fix(deps): update typescript to 5.4.3
  • feat(deps): update mocha to 10.4.0
  • feat(deps): update sql.js to 1.10.2
  • feat(deps): update typescript-eslint monorepo to 7.4.0 (minor) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ci(github-action)!: Update DeterminateSystems/magic-nix-cache-action action to v4
  • feat(deps)!: Update chai to 5.1.0

Detected dependencies

dockerfile
.devcontainer/Dockerfile
  • mcr.microsoft.com/vscode/devcontainers/javascript-node 20-bullseye@sha256:e992931c34a109beaf3c4ace9ad1caa7cdfaeb499b20430ea21eb829c93a5769
github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • actions/setup-node v4.0.2
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/npm.yaml
  • actions/checkout v4
  • cachix/install-nix-action v26
  • DeterminateSystems/magic-nix-cache-action v3
.github/workflows/pre-commit.yaml
  • actions/checkout v4
  • cachix/install-nix-action v26
  • DeterminateSystems/magic-nix-cache-action v3
  • actions/checkout v4
  • siderolabs/conform v0.1.0-alpha.29
.github/workflows/publish.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • sekwah41/upload-release-assets v1.1.0
  • sekwah41/upload-release-assets v1.1.0
  • sekwah41/upload-release-assets v1.1.0
.github/workflows/release-please.yaml
  • actions/create-github-app-token v1
  • actions/checkout v4.1.1
  • google-github-actions/release-please-action v4
.github/workflows/renovate.yaml
  • actions/create-github-app-token v1
  • actions/checkout v4.1.1
  • renovatebot/github-action v40.1.4
npm
package.json
  • @popperjs/core 2.11.8
  • @types/better-sqlite3 7.6.9
  • esbuild-plugin-wat 0.2.7
  • moment 2.30.1
  • sanitize-filename-ts 1.0.2
  • sql.js 1.8.0
  • uuid ^9.0.1
  • @types/chai 4.3.12
  • @types/mocha 10.0.6
  • @types/node 20.11.26
  • @types/sql.js 1.4.9
  • @types/uuid ^9.0.7
  • @typescript-eslint/eslint-plugin 7.1.1
  • @typescript-eslint/parser 7.1.1
  • builtin-modules 3.3.0
  • chai 4.4.1
  • esbuild 0.20.1
  • eslint 8.57.0
  • mocha 10.3.0
  • nyc 15.1.0
  • obsidian 1.4.11
  • ts-node 10.9.2
  • tslib 2.6.2
  • typescript 5.4.2
  • node >=18.0.0 <21.0.0

[Feature Request] Append to highlight note instead of overwriting.

Painfully realised that currently when importing highlights, the entire highlights page is generated fresh.
This means that any caret references, edits to highlight notes are broken / overwritten on each import.

This limits the usefulness of the plugin quite severely as the highlights page can only then ever be used as a visual reference to read and remind ones self (or copy and paste 😵), and therefore not truly integrated into the Obsidian / Zettelkasten note making workflow.

I think the simplest solution around this would be to simply append new highlights / notes to the highlights file instead of overwriting the whole file completely with a fresh import. From memory the Kindle highlights plugin works this way.

Is it realistic to look into something like this? Would be immensely appreciated.
I want to help, but my programming chops are probably not going to do much.

I'd be happy to update and extend the documentation if needs be though.

not getting template details

Hey, why I am not getting the template details. They are stored on the kobo, like the descriptions etc. but nothing else.

image

Thanks in advance!

Extracting Notes - Something went wrong

When i tried to extract notes from my kobo i get an error that something went wrong.
Kobo and plugin are up to date.

Here is the output of the console:

plugin:obsidian-kobo-highlights-importer-plugin: 17638 TypeError: Cannot read properties of undefined (reading 'values')

at Repository.eval (plugin:obsidian-kobo-highlights-importer-plugin:17399:14)

at Generator.next (<anonymous>)

at eval (plugin:obsidian-kobo-highlights-importer-plugin:54:61)

at new Promise (<anonymous>)

at __async (plugin:obsidian-kobo-highlights-importer-plugin:38:10)

at Repository.getAllBookmark (plugin:obsidian-kobo-highlights-importer-plugin:17396:12)

at HighlightService.eval (plugin:obsidian-kobo-highlights-importer-plugin:17330:41)

at Generator.next (<anonymous>)

at eval (plugin:obsidian-kobo-highlights-importer-plugin:54:61)

at new Promise (<anonymous>)`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.