Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Extract" Button stays red and unclickable #362

Open
s3raphic opened this issue Nov 5, 2024 · 18 comments
Open

"Extract" Button stays red and unclickable #362

s3raphic opened this issue Nov 5, 2024 · 18 comments

Comments

@s3raphic
Copy link

s3raphic commented Nov 5, 2024

Hi there,

When I click "choose file" and select "koboreader.sqlite", the "extract" button remains red and I can't click it. Is there something in the settings I need to adjust first?

Thanks!

@markedwardcampos
Copy link

+1, in my vault and in Sandbox:

My Vault

SYSTEM INFO:
Obsidian version: v1.7.5
Installer version: v1.7.5
Operating system: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031 24.1.0
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: Minimal v7.7.18
Snippets enabled: 1
Restricted mode: off
Plugins installed: 7
Plugins enabled: 7
1: Git v2.28.2
2: Advanced Tables v0.22.1
3: Tasks v7.13.0
4: Style Settings v1.0.9
5: Minimal Theme Settings v8.1.1
6: Dataview v0.5.67
7: Kobo Highlights Importer v2.0.0

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Sandbox (same behavior):

SYSTEM INFO:
Obsidian version: v1.7.5
Installer version: v1.7.5
Operating system: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031 24.1.0
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 1
1: Kobo Highlights Importer v2.0.0

RECOMMENDATIONS:
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

@cyprienflx
Copy link

+1

i have the same issue on windows 11 and Macos :/

@chigh
Copy link

chigh commented Nov 20, 2024

Same, I've even tried opening a backup copy of the sqlite database that's on my laptop.

@danicotillas
Copy link

Please try to fix this!!!! I really enjoy this plugin

@FrnklyN
Copy link

FrnklyN commented Dec 14, 2024

I fixed the main.js file. Change this:

this.inputFileEl.addEventListener("change", (ev) => {
  const file = ev.target.files[0];
  if (!file) {
    console.error("No file selected");
    return;
  }

  // Convert File to ArrayBuffer
  const reader = new FileReader();
  reader.onload = () => {
    this.fileBuffer = reader.result;  // Store the ArrayBuffer
    this.goButtonEl.disabled = false;
    this.goButtonEl.setAttr("style", "background-color: green; color: black");
    new import_obsidian2.Notice("Ready to extract!");
  };

  reader.onerror = (error) => {
    console.error("FileReader error:", error);
    new import_obsidian2.Notice("Error reading file");
  };

  reader.readAsArrayBuffer(file);
});

And:

fetchHighlights() {
  return __async(this, null, function* () {
    if (!this.fileBuffer) {
      throw new Error("No file buffer available...");
    }
    
    const SQLEngine = yield (0, import_sql.default)({
      wasmBinary: binary
    });
    
    // Use the buffer directly instead of reading from file
    const db = new SQLEngine.Database(new Uint8Array(this.fileBuffer));
    
    const service = new HighlightService(
      new Repository(db)
    );

    // Rest of the function remains the same...
  });
}

@danicotillas
Copy link

danicotillas commented Dec 16, 2024

Thanks @FrnklyN but would you mind to share a main.js file with the changes included?
I'm not very proficient at coding and I don't know where to change that exactly.

Thanks!

@cyprienflx
Copy link

cyprienflx commented Dec 16, 2024

i found a workaround with koreader https://koreader.rocks/

I install this on my Kobo, and now I can export my note in Markdown 🎉

@Xethgnur
Copy link

I am also unable to extract. Whether its the .sqlite file on the device or offloaded into my desktop, the extraction button doesn't change and remains locked.

Unfortunately I am not code Savvy and have no idea what needs to be replaced in the Main.js file via @FrnklyN's find/fix

@chigh
Copy link

chigh commented Dec 17, 2024

This worked like a charm! Thanks, @FrnklyN!

I fixed the main.js file. Change this:

--8<--

@danicotillas
Copy link

This worked like a charm! Thanks, @FrnklyN!

I fixed the main.js file. Change this:

--8<--

Please! Can you copy/paste here he complete code of the main.js file so I can replicate on mine???

@danicotillas
Copy link

PLease @FrnklyN or @chigh could you help me? I have tried copying/pasting in different ways but I can't find the way to do it and it's really helpfull for me. Can you share a main.js file where everything is properly changed??
Thanks!!

@Danhicsuntdracones
Copy link

I have the same issue on Obsidian 1.7.7 AppImage version for Linux. The issue persist in the Sandbox Vault, so it isn't a plugin conflict issue.

@Danhicsuntdracones
Copy link

Danhicsuntdracones commented Jan 3, 2025

@FrnklyN fix works, but on the output markdown files I get a lot of unnecessary commented text surrounding each extracted quote (see below for an example). Haven't used the plugin before, so I can't say if this is quirk was already present in it or if it is introduced by the fix.

%%START-6e22513d-e422-4f52-947e-e1ceb5bcc982%%

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

%%START-EXTRACTED-HIGHLIGHT-6e22513d-e422-4f52-947e-e1ceb5bcc982%%
> Can I teach you something? Don’t say the word tired, or you will become more tired.
%%END-EXTRACTED-HIGHLIGHT-6e22513d-e422-4f52-947e-e1ceb5bcc982%%

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

%%END-6e22513d-e422-4f52-947e-e1ceb5bcc982%%

@Danhicsuntdracones
Copy link

@danicotillas I'm not coding-literate either, but I managed to copy-paste the code fix successfully by opening and editing the main.js file with VS Code. Hope this helps!

@danicotillas
Copy link

@danicotillas I'm not coding-literate either, but I managed to copy-paste the code fix successfully by opening and editing the main.js file with VS Code. Hope this helps!

Hi! Me neither and I copy/paste the code and I didn't succeed. Can you share with me the main.js file please?

@Danhicsuntdracones
Copy link

Danhicsuntdracones commented Jan 4, 2025

@danicotillas I'm not sure how I can share a .js file through here, this file type isn't supported to be added as an attachment.

What's exactly your issue during copy-pasting? Are you able to find the lines of code you need to change by using the search function of VS Code (ctrl+F)? Searching this.inputFileEl.addEventListener and then fetchHighlights() { will bring you straight to them.

You then need to copy-paste the provided code so that it looks exactly like in the images I attach (the highlighted text is exactly what I copy-pasted). Use the code lines just before and after as a reference point, they should remain the same after you make the changes. Pay special attention to the indentation of all the code lines, make sure they're as shown.

tutorial1
tutorial2

Save the file and you should be good to go. Hope this helps!

@danicotillas
Copy link

danicotillas commented Jan 4, 2025

@danicotillas I'm not sure how I can share a .js file through here, this file type isn't supported to be added as an attachment.

What's exactly your issue during copy-pasting? Are you able to find the lines of code you need to change by using the search function of VS Code (ctrl+F)? Searching this.inputFileEl.addEventListener and then fetchHighlights() { will bring you straight to them.

You then need to copy-paste the provided code so that it looks exactly like in the images I attach (the highlighted text is exactly what I copy-pasted). Use the code lines just before and after as a reference point, they should remain the same after you make the changes. Pay special attention to the indentation of all the code lines, make sure they're as shown.

At last!!! Thank you!!! I don't know what I was copying/pasting wrongly, maybe something about the indentation.

Thanks again

@Danhicsuntdracones
Copy link

You're welcome, glad it worked!

I'm guessing the issue could be that in your previous copy-paste you also included the last 3-4 lines with extra brackets from the second code fix:

    // Rest of the function remains the same...
  });
}

I think those were added by FrnklyN just for convention and reference, but aren't meant to be copy-pasted as the rest of the code because they will mess up the syntax of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants