[Highlight Export Plugin] Include book author name in myclippings export format for better book identification#12106
Conversation
|
Closes #11593 |
pazos
left a comment
There was a problem hiding this comment.
LGTM
BTW, this exporter might still OOM on the whole history export. It is explained in #10745 (comment)
A fix can come later
|
AFAIK, if the author is absent, Amazon writes on the home screen and in My Clippings: "Unknown". |
|
I've solved the OOM issue; the PRs will be in conflict And thanks for building on top of this export target; I'm happy it's being used by someone :) |
|
@Mochitto It's hard to merge with conflicting changes and your fix is essential for large exports. As my contribution is minor, It can be included in #12107 directly as I mentioned in my latest comment on that thread. Also I did make a change here to use Unknown when author is not present matching kindle format as mentioned by @hius07 How we go about merging both of the pull request changes without making a lot of trouble for @pazos? |
|
I'll wait for further indications from the maintainers regarding solving conflicts :) You can also open a PR towards my fix branch, if they don't mind them being together in the PR; that way your name will show up in the commits so it will be easier for them to credit you when they make a release or for people to tag you in the future. |
|
This one's just a couple of lines, so easy to update. |
One line |
|
I've checked other interface languages in my Kindle, the "Unknown" string is not translatable. |
|
It looks like the title string is the same for highlights and notes, it can be reused. |
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
|
Can you optimize diff --git "a/my_clippings.lua" "b/my_clippings.lua"
index 0e2ee9b..3c0d63d 100644
--- "a/my_clippings.lua"
+++ "b/my_clippings.lua"
@@ -16,11 +16,8 @@ local function format(booknotes)
for ___, entry in ipairs(booknotes) do
for ____, clipping in ipairs(entry) do
if booknotes.title and clipping.text then
- if booknotes.author then
- table.insert(tbl, booknotes.title .. " (" .. booknotes.author .. ")" )
- else
- table.insert(tbl, booknotes.title .. " (Unknown)" )
- end
+ local title_str = booknotes.title .. " (" .. (booknotes.author or "Unknown") .. ")"
+ table.insert(tbl, title_str)
local header = T(_("- Your highlight on page %1 | Added on %2"), clipping.page,
os.date("%A, %B %d, %Y %I:%M:%S %p", clipping.time))
@@ -31,11 +28,7 @@ local function format(booknotes)
table.insert(tbl, "==========")
if clipping.note then
- if booknotes.author then
- table.insert(tbl, booknotes.title .. " (" .. booknotes.author .. ")" )
- else
- table.insert(tbl, booknotes.title .. " (Unknown)" )
- end
+ table.insert(tbl, title_str)
header = T(_("- Your note on page %1 | Added on %2"), clipping.page,
os.date("%A, %B %d, %Y %I:%M:%S %p", clipping.time))
|
Thank you. Done. I think it's ready to merge :) |
Extension of #10263 by @Mochitto and @pazos
Currently there is no Author name in the exported file of myclippings. This adds the Author name (if present) which helps in better book recognition. The app is able to fetch book frontcover preview on the site (myclippings.io) if the Author name is present.
Before
After
This change is