-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Workflow question #74
Comments
Hi, first of all you don't need to export anything from koreader. This plugin automatically retrieve notes/highlights from the native koreader format. The only issue I see is the path you set. You must be sure that the path point to the native koreader notes so that the plugin can do it's magic. Try to check with a file manager what you see in that path once koreader is mounted |
Hey thank you for your reply. I was able to make progress by going straight to the root of /Volumes/Kindle. This however only got me a bit further. The sync seems to pull and create the folders for each book, but none of the actual files come over. Have you seen this happen before? |
I have the same problem, I can import the folders for each book, but no highlights come over. I'm on windows but the device is mounted to a folder. |
i fixed it (with some jank) Rename the file to main.js and drop it into the obsidian-koreader-plugin folder in .obsidian/plugins, rewrite the old file with this one |
Hey @TheOnlyWayUp Thanks for your reponse here. The linked file is no longer available. Can you share with me once more perhaps? Thanks in advance. |
First of all, I want to sincerely apologize to everyone for the long silence and the lack of updates on this plugin. I noticed that some users collaborated on a workaround to address certain issues, but unfortunately, the file seems to have been lost or is no longer accessible. If anyone still has access to that modified version, I’d greatly appreciate it if you could share it with me. It would help me understand which problems were tackled and how they were resolved, so I can integrate those fixes (or improved versions of them) directly into the official release. I’m actively working on bringing the plugin back to life with a proper refactor, and I’d love for you to stay in the loop. If you haven’t already, consider subscribing to notifications—you’ll be the first to know about future updates and releases! |
Ah, sorry for the linkrot. I'm pretty sure this is the file I was referring to, https://files.rambhat.la/s/MKQzpbTByW3nYgj diff --git "a/origin" "b/updated"
index 9e7b39e..e70392e 100644
--- "a/origin"
+++ "b/updated"
@@ -12497,8 +12497,8 @@ var KOReaderMetadata = class {
} = jsonMetadata;
if (Object.keys(highlight).length && Object.keys(bookmarks).length) {
metadatas[`${title} - ${authors}`] = {
- title,
- authors,
+ title: (title ? title : jsonMetadata.stats.title),
+ authors: (authors ? authors : 'Unknown'),
bookmarks,
percent_finished: percent_finished * 100
};
@@ -12523,6 +12523,7 @@ var ErrorType;
(function (ErrorType2) {
ErrorType2["NO_PLACEHOLDER_FOUND"] = "NO_PLACEHOLDER_FOUND";
ErrorType2["NO_PLACEHOLDER_NOTE_CREATED"] = "NO_PLACEHOLDER_NOTE_CREATED";
+ ErrorType2["SKIPPING_INVALID_FORMAT"] = "SKIPPING_INVALID_FORMAT"
})(ErrorType || (ErrorType = {}));
var NoteType;
(function (NoteType2) {
@@ -12705,7 +12706,8 @@ var KOReader = class extends import_obsidian.Plugin {
const {
content: newContent,
frontmatterData,
- notePath
+ notePath,
+ SKIP
} = yield this.createNote({
path: path2,
uniqueId: "",
@@ -12729,6 +12731,9 @@ var KOReader = class extends import_obsidian.Plugin {
},
keepInSync: frontMatter.metadata.keep_in_sync
});
+ if (SKIP) {
+ throw new Error(ErrorType.SKIPPING_INVALID_FORMAT)
+ }
diff2 = diffTrimmedLines(originalContent, newContent);
} catch (e) {
console.error(e);
@@ -12784,8 +12789,20 @@ var KOReader = class extends import_obsidian.Plugin {
createNote(note) {
return __async(this, null, function* () {
const { path: path2, uniqueId, bookmark, managedBookTitle, book, keepInSync } = note;
- const page = bookmark.text ? parseInt(bookmark.text.match(/\d+/g)[0]) : -1;
- const noteItself = bookmark.text ? bookmark.text.split(bookmark.datetime)[1].replace(/^\s+|\s+$/g, "") : "";
+ try {
+ var page = bookmark.text ? parseInt(bookmark.text.match(/\d+/g)[0]) : -1
+ } catch {
+ var page = -1
+ }
+ try {
+ var noteItself = bookmark.text ? bookmark.text.split(bookmark.datetime)[1].replace(/^\s+|\s+$/g, "") : "";
+ } catch {
+ var noteItself = bookmark.notes;
+ }
+ if (noteItself == 'placeholder') {
+ noteItself = bookmark.notes
+ }
+
const noteTitle = noteItself ? this.manageTitle(noteItself, this.settings.noteTitleOptions) : `${this.manageTitle(bookmark.notes, this.settings.noteTitleOptions)} - ${book.authors}`;
const notePath = (0, import_obsidian.normalizePath)(`${path2}/${noteTitle}`);
const defaultTemplate = `## Title: [[<%= it.bookPath %>|<%= it.title %>]]
@@ -12798,7 +12815,7 @@ Page: <%= it.page %>
**==<%= it.highlight %>==**
-<%= it.text %>`;
+<%= it.text %>\n`;
const templateFile = this.settings.customTemplate ? this.app.vault.getAbstractFileByPath(this.settings.templatePath) : null;
const template = templateFile ? yield this.app.vault.read(templateFile) : defaultTemplate;
const bookPath = (0, import_obsidian.normalizePath)(`${path2}/${managedBookTitle}`);
@@ -12833,7 +12850,7 @@ Page: <%= it.page %>
}
}
};
- return { content, frontmatterData, notePath };
+ return { content, frontmatterData, notePath, SKIP_ME: false };
});
}
createDataviewQueryPerBook(dataview, updateNote) {
@@ -12917,12 +12934,18 @@ return n['koreader-sync'] && n['koreader-sync'].type == '${NoteType.SINGLE_NOTE}
book: data[book]
}, this.app.vault.getAbstractFileByPath(`${path2}/${managedBookTitle}.md`));
}
+
for (const bookmark in data[book].bookmarks) {
+ console.log(data[book].bookmarks[bookmark])
+
const updateNote = false;
const uniqueId = crypto.createHash("md5").update(`${data[book].title} - ${data[book].authors} - ${data[book].bookmarks[bookmark].pos0} - ${data[book].bookmarks[bookmark].pos1}`).digest("hex");
- if (!Object.keys(this.settings.importedNotes).includes(uniqueId)) {
+
+ console.log("om")
+ if (Object.keys(this.settings.importedNotes).includes(uniqueId)) {
+ console.log("in 1")
if (!Object.keys(existingNotes).includes(uniqueId)) {
- const { content, frontmatterData, notePath } = yield this.createNote({
+ const { content, frontmatterData, notePath, SKIP } = yield this.createNote({
path: path2,
uniqueId,
bookmark: data[book].bookmarks[bookmark],
@@ -12930,21 +12953,40 @@ return n['koreader-sync'] && n['koreader-sync'].type == '${NoteType.SINGLE_NOTE}
book: data[book],
keepInSync: this.settings.keepInSync
});
+
+
+ if (SKIP) {
+ continue
+ }
this.app.vault.create(`${notePath}.md`, import_gray_matter.default.stringify(content, frontmatterData));
}
+ console.log("setting to truthy")
this.settings.importedNotes[uniqueId] = true;
- } else if (Object.keys(existingNotes).includes(uniqueId) && existingNotes[uniqueId].keep_in_sync && !existingNotes[uniqueId].yet_to_be_edited) {
+ }
+
+ else if (Object.keys(existingNotes).includes(uniqueId) && existingNotes[uniqueId].keep_in_sync && !existingNotes[uniqueId].yet_to_be_edited) {
+ console.log("in 2")
+
const note = existingNotes[uniqueId].note;
- const { content, frontmatterData, notePath } = yield this.createNote({
+ const { content, frontmatterData, notePath, SKIP } = yield this.createNote({
path: path2,
uniqueId,
bookmark: data[book].bookmarks[bookmark],
managedBookTitle,
book: data[book],
keepInSync: (_a = existingNotes[uniqueId]) == null ? void 0 : _a.keep_in_sync
- });
+ })
+
+ if (SKIP) {
+ continue
+ }
this.app.vault.modify(note, import_gray_matter.default.stringify(content, frontmatterData));
}
+
+ else {
+ console.log("All false", this.settings.importedNotes, existingNotes)
+ }
+ console.log("done")
}
}
yield this.saveSettings();
|
@TheOnlyWayUp thank you for your effort. I think I got the point of the problem. I'll try to integrate your job in the next release but there's a lot more that I must do in order to have the plugin works fine again. |
Thank you everyone. You are all much smarter than I am. I wish I could
help, but instead I can only cheer you on. This is a wonderful and much
needed plugin, I cannot overstate my gratitude for your efforts!!
…On Mon, Jan 6, 2025 at 9:01 AM Federico Granata ***@***.***> wrote:
@TheOnlyWayUp <https://github.com/TheOnlyWayUp> thank you for your
effort. I think I got the point of the problem. I'll try to integrate your
job in the next release but there's a lot more that I must do in order to
have the plugin works fine again.
—
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BCY66I4MRNOUANFZVDX6UIT2JKEDJAVCNFSM6AAAAABUUU2EGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZTGE3TENJVGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sorry if I am dense, but I want to be clear on workflow here.
I set the path to /Volumes/Kindles/koreader/clipboard
Then I, from Koreader went to highlights export all highlights and selected the Markdown format (correct format?)
I go into Obsidian and click sync, but nothing comes over. Is there a way to view logs? Is my workflow correct? Am I missing something obvious?
I exported ALL highlights as markdown maybe thats why?
Thanks
The text was updated successfully, but these errors were encountered: