ajatt-tools / anki.koplugin Goto Github PK
View Code? Open in Web Editor NEWKOReader plugin enabling Anki card generations for words looked up in the internal dictionary.
KOReader plugin enabling Anki card generations for words looked up in the internal dictionary.
Hi it's me again:p
I have notice that with the May 29 version some words cause koreader to crash, for exemple:
When adding the word blench in this sentence
I got this crash:
And when trying to add man in this sentence (I thought that maybe the !’ was somehow causing problem):
I got this crash:
But then I tried to add mother from this sentence:
And it just worked, without any trouble.
So I don't know what's causing the crash, when a word in a specific sentence crash he always will. But the same word added to anki in other sentences won't cause any trouble.
Sorry for keeping creating new issues every two day:p
Hi!
When I change the settings in the config.lua, the plugin doesn't give me the option add to Anki anymore, but it shows add to vocabulary builder. Also user patch doesn't work for me.
Thanks in advance for helping me out :)
Greetings!
My device: Onyx Boox Leaf 2 (android 11)
I have installed a Koreader plugin using this tutorial guide: https://github.com/Ajatt-Tools/anki.koplugin
Then I installed AnkiconnectAndroid, put http://localhost:8765/ in CORS Host settings, start service. When I press add to anki in Koreader, I get these errors:
Any solutions?
Rikaitan allows the creation of SVG pitch accent graphs when adding notes to Anki. It's described in this .js: https://github.com/Ajatt-Tools/rikaitan/blob/24.4.29.0/ext/js/display/pronunciation-generator.js
I think these look better than the pitch accent graphs that the existing extension generates so I'd like to see this get implemented. It would also be ideal to implement an new output to a "Reading" field for the 'note' parameter so the new pitch accent graph can be displayed along side the reading of the word in hiragana.
Plugin appears to work well for mining vocab from my old kindle.
However, I notice that only the kanji, english definition and sentence context are extracted.
I'd like to also get the kana reading of the word added to the note.
(Sorry, this is more like request than an issue)
Describe the Issue
Setup everything, i have AnkiConnect bound to 0.0.0.0 as reinforced by lsof
:
emacs 1433 lynn 18u IPv4 917636 0t0 TCP 127.0.0.1:8080 (LISTEN)
anki 9316 lynn 18u IPv4 915375 0t0 TCP 127.0.0.1:36099 (LISTEN)
anki 9316 lynn 52u IPv4 923083 0t0 TCP *:8765 (LISTEN)
used ip a
to get my ipv4 IP, set that up in KOReader as http://[ip]:8765
. Any time I try to add a card, i will get the message that host is 'nil'. I'm not sure if that means the Hostname is not being saved properly, or if that's the object it's trying to bind and it is failing.
crash.log
crash.log
07-17 16:50:37.746 I/KOReader( 8074): Loading plugins from directory: /storage/emulated/0/koreader/plugins/
07-17 16:50:37.759 V/KOReader( 8074): Loaded 4 notes from disk.
07-17 16:50:37.762 V/KOReader( 8074): RD loaded plugin anki at /storage/emulated/0/koreader/plugins//anki.koplugin
--
07-17 16:50:37.968 V/KOReader( 8074): CreDocument: goto xpointer /body/DocFragment[14]/body/div/p[23]/text().312
07-17 16:50:37.971 V/KOReader( 8074): DocSettings: data is read from /storage/9C33-6BBD/Books/Deutsch/SAO/SAO 06.sdr/metadata.epub.lua
07-17 16:50:37.976 I/KOReader( 8074): AnkiWidget:extend_doc_settings# /storage/9C33-6BBD/Books/Deutsch/SAO/SAO 06.epub {
--
07-17 16:50:49.832 I/KOReader( 8074): (re)initializing context buffer with size: 50
07-17 16:50:49.841 I/KOReader( 8074): after reinit: prev table = 329, next table = 325
07-17 16:50:49.842 I/KOReader( 8074): AnkiNote#get_custom_context() 1 0 1 0
07-17 16:50:49.843 V/KOReader( 8074): AnkiConnect#is_running = code: invalid host 'nil', headers: nil, result: nil
07-17 16:50:49.843 I/KOReader( 8074): Displaying popup with message: 'Unable to reach AnkiConnect.
--
07-17 16:51:15.740 V/KOReader( 8074): _refresh: Enqueued fast update for region 72 646 1119 87 dithering: false
07-17 16:51:15.740 V/KOReader( 8074): setDirty fast from widget nil w/ region 72 646 1119 87 dithering: nil
07-17 16:51:15.741 V/KOReader( 8074): AnkiConnect#is_running = code: invalid host 'nil', headers: nil, result: nil
07-17 16:51:15.741 I/KOReader( 8074): Displaying popup with message: 'Synchronizing failed!
07-17 16:51:15.741 I/KOReader( 8074): Unable to reach AnkiConnect.
this time i remembered the -i
flag.
Currently using a Korean dictionary, and when I try to generate a note for Anki it says it cannot sync because the note is empty. Tried both in localhost (Ubuntu laptop) and koreader within Kindle using the same dictionary, and both give the same result.
Tested that notes are generated, for example, for English words without an available dictionary (but only stored offline, as it cannot figure out the language). When adding a dictionary, even English words fail with the same error.
Hello, I am trying to run this on my BOOX Palma but I’m not sure if it’s compatible or not, the Palma’s OS is Android 11 and I currently use the Ankidroid and Ankiconnect android apps along with the Yomitan broswer extension to automatically create flashcards while using my regular browser. I really needed something for when I’m reading though so when I saw this I was pretty excited and downloaded it and was able to install it to Koreader but unfortunately whenever I select the “add to anki” button after highlighting a word, I get an error that says “Couldn’t Synchronize Note, Couldn’t Get Deck ID” and then a bunch of other random words(see picture below) I just want to know if it’s even possible to use this plugin on Android so I don’t waste my time ripping my hair out trying to figure this out because it would be a huge lifesaver for me as I currently create anki cards by hand for all my reading vocab, thank you so much!
Describe the Issue
I have my laptop running anki with AnkiConnect. I have adjusted it as per the README. I have installed the latest (master) plugin on my ereader, and have verified it is in the plugin list. I have Anki settings. When I select a word, it does not give me the "Add to Anki" button. I have tested this with vocab builder both disabled and enabled.
How to Reproduce (if relevant)
Install anki.koplugin on KOReader 2024.07 . Change no other settings.
crash.log
crash.log
a quick grep shows no anki mention in the crash.log
Additional context
Using a BOOX Page if that matters.
Hello, thank you for this plugin! It's definitely something i've been looking for for a while.
I managed to install this plugin accordingly and edited the fields to match my own deck on Anki. However, when I click on "Add to anki", this gives me an error posted below. I also have my wifi connected + ssh server on whilst adding.
Wondering if this is something I messed up during installation.
Hey there, loving the extension. One thing I’d like to request if possible - right now, for adjectives and verbs, the target word that gets output to Anki is the conjugated word used in the sentence as opposed to the deinflected dictionary form of the word. For example, if my sentence contains 食べたり, the target word will export as 食べたり instead of 食べる.
Can this behavior - at least optionally - be altered to export the headword of the selected dictionary entry, or deinflected form of the word, as the target word instead? This would help avoid inflated known word counts for me.
Looks like this plugin and vocab builder conflict because they both try to set the same button, rather than creating two buttons for example.
When "Add to Anki" is pressed or long-pressed on a query via the manual dictionary lookup, KOReader crashes.
Not all documents are OCR-able, making this function essential.
The problem seems to be pretty straightforward. It fails to determine that there is no context and attempts to concatenate an uninitialized variable.
Hello nairyosangha,
I am very thankful for your work.
I managed to get your plugin running on my koreader on android. But now that I try to use it on my Kobo I run into an issue.
Here is what the crash.log is saying:
06/30/24-02:23:16 ERROR Failed to initialize anki plugin: plugins/anki.koplugin/main.lua:88: .../plugins/anki.koplugin/extensions/._EXT_pitch_accent.lua:1: unexpected symbol
I tried deleting this perticular _EXT_pitch_accent.lua as I do not use it, still the error did not go away.
I tried just to comment out the entire function in main.lua which loads these extensions... but then things started to go very sideways ^^
I am just not proficient enough in any of this. I could just fiddle around with it until something kinda works.
How come it works just fine on my Android phone, but here it does not?
I had the plugin working for a minute, but wasn't able to connect to ankiconnect. I realized I had missed putting in my IP address in the config file, so I added my IPv4 address (as I saw in a previous post). I did try to make a few cards before this, but since it wouldn't sync, it just stored them offline.
Starting up KOReader now though, the anki button disappeared and there isn't any editing options in the toolbar.
I took a look at the crash log and saw a few instances of this line:
ERROR Failed to initialize anki plugin: plugins/anki.koplugin/ankiconnect.lua:277: attempt to index local 'note' (a nil value)
Maybe I entered the IP incorrectly since that's the last thing I did, but I'm also trying to figure out what's going on with the error. Maybe they're connected?
Hello again!
I have noticed that the new versions (from May 18 and up) of the plugin suppress spaces in sentences sent to context_field.
I guess it has something to do with the "custom sentence context" addition (pretty cool feature btw).
Thanks again for your work, your plugin make my workflow SO much more streamlined.
hi, when i install the plugin on koreader it appears the botton to create a new anki card but then appears this message : Synchronizing failed! Unable to reach AnkiConnect, timeout.
i did trie changing the ip on koreader anki settings: ankiconnect url and here i put my pc ip + :8765. but it still doesnt work ( I tried this after reading other people messages here).
on ankiconnect configuration i only changed webBindAddress to 0.0.0.0.
would appreciate the help a lot
thanks.
First of all, thanks for your work. I have been using Koreader for a year now and was really hoping for an anki integration.
Sadly I can't get this plugin to work with both my kobo Clara 2e and my boox nova air. I have installed the plugin via USB on both my device and changed the ankiconnect config =>
{
"apiKey": null,
"apiLogPath": null,
"ignoreOriginList": [],
"webBindAddress": "0.0.0.0",
"webBindPort": 8765,
"webCorsOriginList": [
"http://localhost"
]
}
wifi on my devices is on (SSH works on my pc without trouble)
But every time I try to synchronize my note I get this error.
Maybe I'm missing something obvious, I'm a complete noob when it come to tech especially network stuff. Anyway thanks for your time and your work on this project.
I’ve got the program up and running and it works great, so thank you! When i mine I like to put a lot of definitions on my cards, like three monolingual dictionaries and one bilingual. I’ve gotten the multi-definition extension to run and edited the lua script so that I created “Definition 2,” “Definition 3,” and so on fields on my note type in anki and have each dictionary mapped to send to a particular field in the lua script.
However, when I actually use the program, instead of getting definitions from all of or most of the six custom dictionaries I have installed, I am only getting one to two definitions per card.
I think this is due to the part of the code where there is deconfliction of kana? When I am in koreader and do the lookup I get results for like five dictionaries but they aren’t sending to the card so I’m guessing it must be due to the deconfliction and formatting between dictionaries.
I get why the deconfliction exists but I’d rather get superfluous extra results I can edit out of my card later rather than getting shorted definitions from my other dictionaries. Could you advise if this is an issue I could remedy by commenting out a certain portion of the extension code, or changing something in it so that all the dictionary results that surface in koreader actually get sent to my card?
Thank you!
Kindle Paperwhite 11th
Dumb question but after following all the steps and successfully connecting with Anki-Connect, I can't add or sync anything because I "cannot create note because it is empty"???
Steps to reproduce the behavior:
Dictionary
Add to Anki
crash.log
08/05/24-00:36:58 INFO Displaying popup with message: 'Error while synchronizing note:
cannot create note because it is empty'
ffi.load: libs/liblodepng.so
08/05/24-00:38:04 INFO (re)initializing context buffer with size: 50
08/05/24-00:38:04 INFO after reinit: prev table = 254, next table = 274
08/05/24-00:38:04 INFO AnkiNote#get_custom_context() 1 0 1 0
08/05/24-00:38:05 INFO AnkiConnect#post_request: code: 200, header: table: 0xb4622560, status: HTTP/1.1 200 OK
Once again, thanks for this amazing script. I have noticed the script tends to only add the sentence the word is in until there's a comma or a dot.
Would it be possible to implement a system where you could highlight the whole context you would like to add in the note? Sometimes the sentence the word is, doesn't have enough context to remember it in the future while reviewing it.
Thanks in advance.
KOReader version: Most recent version as of posting
Issue description:
When highlighting an unknown word in a PDF with selectable text, an error is given: "1 note(s) failed to sync: - Could not determine language of word! (1)" which occurs despite having manually changed the document's language to the target language "fr"
Steps to reproduce the behavior:
No crash encountered but crash log file is still attached.
crash.log
Screenshot of the error in app:
This error does not occur with epub files (tested immediately after encountering this issue).
I feel like this addon would really benefit from support for the reading field. Almost all Mining notetypes I've seen have one, so why isn't it already implemented here? The reading already shows up in the first line of the dictionary entry, but since I already have a separate field for the reading, it clashes with the style of the rest of my mining cards from other sources.
Hello, first of all thank you for the plugin, it looks fantastic!
Second, here is the problem:
My ereader had the wifi off and I was adding a bunch of cards offline (as I have not yet successed in connecting the ereader with Anki) when all of a sudden Koreader crashed. I did not manage to get a picture before the error disappeared but I noticed that the plugin was not working anymore (the Add to Anki button had disappeared).
03/20/24-18:19:05 INFO (re)initializing context buffer with size: 50 03/20/24-18:19:05 INFO after reinit: prev table = 54, next table = 54 03/20/24-18:19:05 INFO AnkiNote#get_custom_context() 1 0 1 0 03/20/24-18:19:14 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:19:17 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:19:21 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:19:46 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:20:06 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:20:20 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:20:23 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:20:30 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:20:42 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:23:37 ERROR Failed to initialize anki plugin: plugins/anki.koplugin/ankiconnect.lua:277: attempt to index local 'note' (a nil value) 03/20/24-18:23:39 INFO opening file /mnt/onboard/神去なあなあ日常 -- 三浦しをん.epub 03/20/24-18:23:39 INFO Inhibiting user input 03/20/24-18:23:39 ERROR Failed to initialize anki plugin: plugins/anki.koplugin/ankiconnect.lua:277: attempt to index local 'note' (a nil value) 03/20/24-18:23:40 INFO Restoring user input handling 03/20/24-18:25:31 INFO Inhibiting user input 03/20/24-18:25:31 INFO Restoring user input handling 03/20/24-18:25:33 INFO Inhibiting user input 03/20/24-18:25:33 INFO Restoring user input handling 03/20/24-18:26:22 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:27:00 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:27:07 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:27:17 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory 03/20/24-18:27:38 WARN unwrapped dismissablePopen(), falling back to blocking io.popen() g_mkdir failed: No such file or directory g_mkdir failed: No such file or directory ./luajit: plugins/anki.koplugin/ankinote.lua:45: attempt to index field 'document' (a nil value) stack traceback: plugins/anki.koplugin/ankinote.lua:45: in function 'fn' plugins/anki.koplugin/ankinote.lua:172: in function 'build' plugins/anki.koplugin/ankiconnect.lua:224: in function 'add_note' plugins/anki.koplugin/main.lua:175: in function 'callback' frontend/ui/widget/buttontable.lua:81: in function 'callback' frontend/ui/widget/button.lua:472: in function 'handleEvent' frontend/ui/widget/container/inputcontainer.lua:266: in function 'handleEvent' frontend/ui/widget/container/widgetcontainer.lua:83: in function 'propagateEvent' frontend/ui/widget/container/widgetcontainer.lua:101: in function 'handleEvent' frontend/ui/widget/container/widgetcontainer.lua:83: in function 'propagateEvent' frontend/ui/widget/container/widgetcontainer.lua:101: in function 'handleEvent' ... frontend/ui/widget/container/widgetcontainer.lua:101: in function 'handleEvent' frontend/ui/widget/container/widgetcontainer.lua:83: in function 'propagateEvent' frontend/ui/widget/container/widgetcontainer.lua:101: in function 'handleEvent' frontend/ui/uimanager.lua:907: in function 'sendEvent' frontend/ui/uimanager.lua:53: in function '__default__' frontend/ui/uimanager.lua:1436: in function 'handleInputEvent' frontend/ui/uimanager.lua:1536: in function 'handleInput' frontend/ui/uimanager.lua:1580: in function 'run' ./reader.lua:280: in main chunk [C]: at 0x000140cd !!!! Uh oh, something went awry... (Crash n°1: 03/20/24 @ 18:28:02) Running FW 4.38.21908 on Linux 4.1.15-00866-g3a75628c73c (#96 SMP PREEMPT Thu Nov 17 14:25:47 CST 2022) Attempting to restart KOReader . . . !!!!
After seeing the "attempt to index local 'note' (a nil value)' error, I also looked at the anki.koplugin_notes.json
file and there is two notes with a different format:
So I guess a short term answer would be to clear the file but the problem remains.
I think there may be an error in the config.lua file
since I also can't connect but I don't seem to find it.
I wrote the url variable like this: url = "http://IPv4:8765" (IPv4 being my IP address of course.)
Maybe it is the space in "Word Audio" ?
If you have any idea that would be great, thank you!
Amazing idea! I was exporting my words and sentences manually so far!!!
Suring the setting up I'm stuck on SSH server commands in windows. I couldn't manage to connect the plugin with ankiconnect after trial & denials for some hours.
as a windows user (tips for the next rookie users);
About the setting up the SSH, An easy step by step guide for windows would be much appreciated.
On the other hand, eveb being able to saving the cards offlin, on the device is also fine for me. So thanks for this work already!
Thx for your amazing koplugin! I have reached an issue like this:
After clicking the button "Add to Anki" the first time,there goes an alert like above.
192.168.6.180 is the IP address of my PC where AnkiConnect is running, the connection through e-reader to PC is working fine I think
Is there any anything goes wrong with my settings in Anki Settings->General Settings? (I didn't change any item in Anki Settings->Anki Note Settings.)
Hello my friend,
Unfortunately I've been having issues again,this time with an ancient Greek dictionary, sometimes it works but about 6/10 times it crashes, and I'm confused because there seems to be no constant that stands out so I can determine why it's crashing for a particular word but not for another, anyway I've attached some of the crash logs which are usually some variation of this:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.