Export: solved my_clippings OOM#12107
Conversation
|
I'd propose building each line and then |
| local content = table.concat(tbl) | ||
| return content |
There was a problem hiding this comment.
Oh gosh ahah thanks for pointing it out!
|
I've tried using the concat "\n" but the result is inconsistent..? Can you help me out? I'm not very familiar with lua local function format(booknotes)
local tbl = {}
for ___, entry in ipairs(booknotes) do
for ____, clipping in ipairs(entry) do
if booknotes.title and clipping.text then
table.insert(tbl, booknotes.title)
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))
table.insert(tbl, header)
table.insert(tbl, "")
table.insert(tbl, clipping.text)
table.insert(tbl, "==========")
if clipping.note then
table.insert(tbl, booknotes.title)
header = T(_("- Your note on page %1 | Added on %2"), clipping.page,
os.date("%A, %B %d, %Y %I:%M:%S %p", clipping.time))
table.insert(tbl, header)
table.insert(tbl, "")
table.insert(tbl, clipping.note)
table.insert(tbl, "==========")
end
end
end
end
local content = table.concat(tbl, "\n")
return content
endThe outputs; notice how some titles are in the same line as the divider |
|
At the beginning insert an extra |
|
That is, if you do concat with \n you get |
97c9d2e to
ddbed8d
Compare
|
Oh, I've got it now! It actually needed to be added to the end part :) I lost focus of the fact that the format function is called separately for each book, instead of the entry i'm iterating through being a continuous stream. tysm, fixed ! :) |
1cfcf71 to
2d11f0d
Compare
2d11f0d to
6b81b51
Compare
|
@Mochitto and @pazos In order to include the features in #12106 (now with conflicting changes) you need to change the following in line - table.insert(tbl, booknotes.title)
+ if booknotes.author then
+ table.insert(tbl, booknotes.title .. " (" .. booknotes.author .. ")" )
+ else
+ table.insert(tbl, booknotes.title .. " (Unknown)" )
+ endAnd the following in line - table.insert(tbl, booknotes.title)
+ if booknotes.author then
+ table.insert(tbl, booknotes.title .. " (" .. booknotes.author .. ")" )
+ else
+ table.insert(tbl, booknotes.title .. " (Unknown)" )
+ end |
|
Also @Mochitto and @pazos, I have noticed something, that is worth fixing. The time in the added export are in local time. But I assume Kindle uses GMT/UTC timestamps so when importing to myclippings, it auto-converts them to local time based on browser timezone/system time. I have illustrated an example here - As you can see, 05:30 was added to the timestamp given in the file ( I am from GMT + 5:30 time zone ) I am not sure what is the format of the time in |
It is converted exactly to the Kindle format: koreader/plugins/exporter.koplugin/target/my_clippings.lua Lines 21 to 22 in 6b81b51 |
The problem is outlined above. What I meant is I do not know what object |
|
What does myclippings.io import from the Kindle? |
Yes, It imports the My Clippings.txt file (The exact format we are trying to replicate here) |
|
And our Export plugin provides the same timestamp as the Kindle does. |
I don't have a kindle right now with me, but can you check if the exported file has the timestamp converted to UTC? |
|
Okay, I got your point. |
Ah, Thank you. So you mean it's the local time and not UTC. Do you mind uploading that to the service ( you just need a simple https://clippings.io account ) to see if the time appears right? May I see a preview of that file please? |
|
I haven't used apps that integrate with my clippings, only obsidian plugins which worked fine; I just made the plugin since kindle has a huge market-share and thought it would make for a very compatibility with other projects. I'll wait for the updates but my 2 cents are: I don't think kindle end-users would know what timestamps other than local timestamps would be. Maybe you can shoot an email to the app's support services and ask about it :) |
|
Maybe a new issue can be opened about this as it's out of scope with the out of memory fix and the authors fix and, maybe, a bug on the app's end instead of koreader's, so if we have to wait for updates this PR wouldn't be the best to store that information for the future. |
Then I assume that is the issue with the web service (clippings.io) itself. Don't bother about it. For now, I will be happy with merging #12106 and #12107 (both looks approved, but have conflicting changes). I am not sure how @pazos or @Frenzie will resolve the conflict, but in case of any issue, I am down to help. |


This should take care of #10745 regarding my_clippings; I'm not sure if it's the last one remaining and the issue can be closed.
The result is the same and I've followed the instructions given by @pazos; hopefully the OOM risk is no more.
Thanks for tagging me in #12106 (probably needs to solve conflicts with this fix)
This change is