Code Monkey home page Code Monkey logo

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

anki.koplugin's Issues

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

[Feature Request] Support for Rikaitan-style pitch accent graphs

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

image

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.

image

Add kana reading to created note

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)

Anki Connect invalid host 'nil'

  • KOReader version:
    2024.07

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.

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.

“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!

Unclear README (user error?)

  • KOReader version:
    2024.07

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.

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.

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.

Play nice with vocab builder plugin

Looks like this plugin and vocab builder conflict because they both try to set the same button, rather than creating two buttons for example.

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

Can not install on Kobo

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?

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?

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?

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.

Cant connect ankiconnect

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.

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.

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!

Error while synchronizing note: cannot create note because it is empty

Kindle Paperwhite 11th

  • KOReader version: v2024.04

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"???

Reader_2024-08-05_003659

Steps to reproduce the behavior:

  1. Select any word (spanish or english)
  2. Click on Dictionary
  3. Click on Add to Anki
  4. See pop up: "Error while synchronizing note: cannot create note because it is empty"

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

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

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

Plugin can't determine language of a word in PDF files.

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:

  1. Open a selectable text PDF in KOReader.
  2. Hamburger menu > Book information > Page 2 > Tap and hold "Language" and enter "fr" > go back to document
  3. Highlight a word and tap "Add to Anki"
  4. See error

No crash encountered but crash log file is still attached.
crash.log

Screenshot of the error in app:
IMG_9572
This error does not occur with epub files (tested immediately after encountering this issue).

Feature Request: Reading Field

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.

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!

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!

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

Constant Crashing When Trying To Add Greek Words

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:

Screenshot_20240508-155059

Screenshot_20240508-155031

Screenshot_20240508-155008

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.