Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant connect ankiconnect #29

Open
gaskell2024 opened this issue Jul 2, 2024 · 10 comments
Open

Cant connect ankiconnect #29

gaskell2024 opened this issue Jul 2, 2024 · 10 comments

Comments

@gaskell2024
Copy link

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.

@nairyosangha
Copy link
Member

Hello, a timeout usually indicates that you're using the wrong IP, how did you find your IP? On mac/linux I believe you can just run the following command in terminal: ip -4 addr. On windows the command ipconfig should work.

Whatever that ends up returning is what you should use. e.g. if it says your IPv4 address is 192.168.3.10 the ankiconnect URL should be http://192.168.3.10:8765

@gaskell2024
Copy link
Author

gaskell2024 commented Jul 3, 2024

Hi I tried this and when I sync the offline notes koreader crashed. and my configuration on general setting and anki note (word,context,glossary etc) on koreader changed back to the default ones.
IMG_20240702_203411.jpg

@nairyosangha
Copy link
Member

Can you post the actual crash.log file, I can't see the error reported on the image.
If you still have the actual json file stored in the e-reader as well I'd like to see it, this lives in the koreader/settings/anki.koplugin_notes.json folder on the device itself

Did you have multiple stored files on the device with different fields configured? I think it might've crashed on that

@nairyosangha
Copy link
Member

Not 100% convinced this is the issue you were having but I pushed a fix anyway: 9fdda26

and my configuration on general setting and anki note (word,context,glossary etc) on koreader changed back to the default ones.

I don't get this, there's nothing in the plugin that automatically updates this, you would have to do it through the menu or by modifying either config.lua or the settings/ankiconnect.lua file

@gaskell2024
Copy link
Author

hi, its working completly now,. (i deleted koreader as a whole and reinstalled and then copied the anki plugin folder).

@gaskell2024
Copy link
Author

hi, sorry but now when i create a card it wont pull the context (sentence) where it appeared in the book. instead it puts the word i looked up.
anki

@nairyosangha
Copy link
Member

hi, sorry but now when i create a card it wont pull the context (sentence) where it appeared in the book. instead it puts the word i looked up. anki

Either you just have it configured wrong and it's saving the word in your context field, or it might be because of the document you're reading. As far as I know this context thing only works on EPUBs, this plugin depends on KOReader functionality to get the context.

Sorry for the late reply, I didn't get notified about this for some reason

@gaskell2024
Copy link
Author

Hi , i solved that problem by changing the way i lookep up words. and it worked fine. But now i get the error " cant connect to forvo" so i looked up the other issses here on github and found one with the same error. So i changed my config.lua and deleted the audio_file part but i still get the same problem.
here is my config.lua.

-- This file contains all the user configurable options
-- Entries which aren't marked as REQUIRED can be ommitted completely
local Config = {
----------------------------------------------
---- [[ GENERAL CONFIGURATION OPTIONS ]] -----
----------------------------------------------
-- This refers to the IP address of the PC ankiconnect is running on
-- Remember to expose the port ankiconnect listens on so we can connect to it
-- [REQUIRED} The ankiconnect settings also need to be updated to not only listen on the loopback address
url = "http://192.168.1.8:8765",
-- [REQUIRED} name of the anki deck
deckName = "Enko",
-- [REQUIRED} note type of the notes that should be created
modelName = "Basico",
-- Each note created by the plugin will have the tag 'KOReader', it is possible to add other custom tags
-- A card with custom tags can be created by pressing and holding the 'Add to Anki' button, which pops up a menu with some extra options.
custom_tags = { "NEEDS_WORK" },

-- It is possible to toggle whether duplicate notes can be created. This can be of use if your note type contains the full sentence as first field (meaning this gets looked at for uniqueness)
-- When multiple unknown words are present, it won't be possible to add both in this case, because the sentence would be the same.
allow_dupes = false,
-- The scope where ankiconnect will look to to find duplicates
dupe_scope = "deck",


----------------------------------------------
--- [[ NOTE FIELD CONFIGURATION OPTIONS ]] ---
----------------------------------------------
-- [REQUIRED] The field name where the word which was looked up in a dictionary will be sent to.
word_field = "word",

-- The field name where the sentence in which the word we looked up occurred will be sent to.
context_field = "context",

-- [REQUIRED] The field name where the dictionary definition will be sent to.
def_field = "def",

-- The field name where metadata (book source, page number, ...) will be sent to.
-- This metadata is parsed from the EPUB's metadata, or from the filename
meta_field = "met",


-- list of extensions which should be enabled, by default they are all off
-- an extension is turned on by listing its filename in the table below
enabled_extensions = {
    --[[
    "EXT_dict_edit.lua",
    "EXT_dict_word_lookup.lua",
    "EXT_multi_def.lua",
    "EXT_pitch_accent.lua"
    --]]
}

}
return Config

Sorry for still coming back so many times u.u, but i really like this plugin since it makes using anki really easy.
Thanks for your help

@nairyosangha
Copy link
Member

I'm gonna need some more info here

But now i get the error " cant connect to forvo"

I assume that's Could not connect to forvo? Not nitpicking but I can tell where in the code that's happening. If you get to that point the plugin was able to determine the language of the word and is doing the lookup. This normally shouldn't fail, if the word isn't available on Forvo it will just not add anything. Sometimes just trying it twice helps. I often get a few of these errors when syncing a whole bunch of locally stored to Anki at once, just retrying them fixes it.

Also, you should never get that error if the audio field is not defined since that's checked right before that. Can you make sure you're using the latest version of the plugin (just reinstall it) and also make sure there's no audio_field saved in the ./settings/ankiconnect.lua file on your ereader device itself? This happens if you ever make changes through the menu from within koreader.

@nairyosangha
Copy link
Member

I'm also wondering if you're running into this when trying to sync a bunch of locally offline stored notes or while trying to add singular notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants