GithubHelp home page GithubHelp logo

ajatt-tools / anki.koplugin Goto Github PK

View Code? Open in Web Editor NEW
41.0 4.0 5.0 132 KB

KOReader plugin enabling Anki card generations for words looked up in the internal dictionary.

Lua 100.00%
ajatt anki ankiconnect koreader koreader-plugin

anki.koplugin's People

Contributors

nairyosangha avatar tatsumoto-ren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

anki.koplugin's Issues

Crashing when creating a card

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.

PXL_20230329_160433557
PXL_20230329_174914456_2

Wondering if this is something I messed up during installation.

Cannot synchronize note because it's empty

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.

[Feature Request] Being able to select my own context sentence

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.

Cannot send notes to anki

Hello everyone,

I am having problems with adding word notes to anki. I have set AnkiConnect per the instructions and I am able to connect to it.
Reader_2023-08-26_134002

However, when I want to send note to anki, it always fails with timeout.
Reader_2023-08-26_134043

Does anyone have any idea what might be the problem?

No "Add to anki" button

The addon is installed but there's no "Add to anki" button, I've tried reinstalling but to no avail.
Device: ONYX BOOX VOLTA3
photo_2_2023-10-13_17-26-04
photo_1_2023-10-13_17-26-04

Sentences are sent to context_field without spaces

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.

Apr 16:
anki_kRIAOd8bcc

May 18:
anki_FnhPGpndNk

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.

Koreader crashing when adding certain word to anki

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
blench
I got this crash:
BlenchCrash
And when trying to add man in this sentence (I thought that maybe the !’ was somehow causing problem):
Man
I got this crash:
ManCrash
But then I tried to add mother from this sentence:
mother
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

Difficulty with multi definition extension

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!

Koreader crashes after adding a lot of offline cards.

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).

But here is what the crash.log file says (Huge wall of text)
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:
image
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.
image
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!

Deconjugation of Target Word

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.

Couldn't manage SSH Server and ankiconnect setup in windows 11

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);

  • DONE: I could pass the "Permission Denied" error with this workaround in Windows
  • DONE-ish : I believe with the ankiconnect server IP [0.0.0.0] I am fine with the server and also via SSH+powershell I can access [root@kobo koreader]# so I believe SSH is fine. 🤷‍♂️
  • FAILED : Although I installed rsync (after installing Git) from here, I couldn't run the last line of the snippet.
  • At the end simply, I receive "unable to reach server, sored offline" error.

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!

KOReader crash on "Add to Anki"

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.
crash

Could not determine language of word! Stored note offline

Thx for your amazing koplugin! I have reached an issue like this:
IMG_20231230_131330
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
Screenshot_20231230-125444
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.)

No "Add to Anki" button, but appears in plug-in list

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?

“Couldn’t Synchronize Note, Couldn’t Get Deck ID 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!

Unable to transfere my note to anki

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.

Screenshot_20230521-095734 1

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.