Closed rukit24 closed 8 months ago
This error is coming from forvo itself, I can't do much about that. Does this happen for all notes? I get occasional failures here and there, usually just pressing 'Keep' and trying to sync again fixes it.
This error is coming from forvo itself, I can't do much about that. Does this happen for all notes? I get occasional failures here and there, usually just pressing 'Keep' and trying to sync again fixes it.
Doesn't work for me. Can you help me to Delete completely Word_audio field because in computer i will backfill it again, So i think i dont need this forvo feature
You can delete the field from your config, the plugin only bothers to query for the audio if the field is there, when it's missing, querying forvo is skipped completely.
This won't fix your notes that are already stored offline, only for new ones created after you make that change
I have put this line in comment and detete all ankiconect file in setting. and then when i press add to anki it said that: Couldn't syncchronize note: Cannot create note because it is empty
Could you post your config.lua
file? I'm assuming you don't have any custom settings since that's what you deleted, right?
Cannot create note because it is empty
this is what's being returned by anki-connect, which means the first field on your note is empty, I'm not sure how that would happen
Posting the relevant part of your crash.log
would be nice too, with debug logging on. That would tell me the exact JSON string that's being sent to anki-connect
It's explained in the koreader issue template how to do so:
crash.log
(if applicable)
crash.log
is a file that is automatically created when KOReader crashes. It can normally be found in the KOReader directory:
/mnt/private/koreader
for Cervanteskoreader/
directory for Kindle.adds/koreader/
directory for Koboapplications/koreader/
directory for PocketbookAndroid logs are kept in memory. Please go to [Menu] → Help → Bug Report to save these logs to a file.
Please try to include the relevant sections in your issue description. You can upload the whole
crash.log
file (zipped if necessary) on GitHub by dragging and dropping it onto this textbox.If your issue doesn't directly concern a Lua crash, we'll quite likely need you to reproduce the issue with verbose debug logging enabled before providing the logs to us. To do so, from the file manager, go to [Tools] → More tools → Developer options, and tick both
Enable debug logging
andEnable verbose debug logging
. You'll need to restart KOReader after toggling these on.
---- [[ 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.73:8765",
-- [REQUIRED} name of the anki deck
deckName = "Mining Deck",
-- [REQUIRED} note type of the notes that should be created
modelName = "JP Mining Note",
-- 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 = "Sentence",
-- [REQUIRED] The field name where the dictionary definition will be sent to.
def_field = "PrimaryDefinition",
-- 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 = "Comment",
-- 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
Thanks, your config looks fine. Looking at your log I'm not seeing any DEBUG messages so I can't tell.
I told you in my previous message how to turn those on, you would need to be able to reproduce the issue after you do that
However, I do see:
03/26/24-18:51:17 ERROR Failed to initialize anki plugin: plugins/anki.koplugin/ankiconnect.lua:275: Could not parse note '': The document is empty. (0)
Is that the problem you were talking about? This sounds like something else. I assume the plugin stopped loading at some point?
crash.log this is my latest crash log after enable debug logging in Koreader. And when i use add to anki it still the error that: Cannot create note because it is empty
Thank you, now the log contains the part I needed:
03/28/24-13:04:58 DEBUG AnkiConnect#post_request: building POST request with payload: {"version":6,"action":"addNote","params":{"note":{"fields":{"Sentence":"敵も味方も食い殺す、<b>無差別殺人</b>鬼みたいな役割でだ。","PrimaryDefinition":"<div class=\"definition\"><ol>\n<link rel='stylesheet' href='common.css' type='text/css'>\n<link rel='stylesheet' href='jitendex.css' type='text/css'>\n<div dict=\"Jitendex.org [2024-03-24]\"><div class=\"headline\"><span class=\"headword\" lang=\"ja\"><span><ruby>無<rt>む</rt></ruby><ruby>差<rt>さ</rt></ruby><ruby>別<rt>べつ</rt></ruby><ruby>殺<rt>さつ</rt></ruby><ruby>人<rt>じん</rt></ruby></span></span></div><ul class=\"sense-groups\" data-sense-count=\"1\" data-sense-group-count=\"1\"><li class=\"sense-group\"><span class=\"part-of-speech-container\"><span class=\"tag part-of-speech-info\" data-code=\"n\" title=\"noun (common) (futsuumeishi)\">noun</span></span><ol class=\"sense-list\"><li class=\"sense\" data-sense-number=\"1\" style=\"list-style-type: '①';\"><ul class=\"glossary\"><li class=\"gloss\">indiscriminate killing</li><li class=\"gloss\">indiscriminate murder</li></ul></li></ol></li></ul><div class=\"entry-footnotes\"><a href=\"https://www.edrdg.org/jmwsgi/entr.py?svc=jmdict&q=2154820\">JMdict</a></div></div></ol></div>","Comment":"理不尽な孫の手 - 無職転生 ~異世界行ったら本気だす~ 01 (MFブックス) (116/339)","Word":"無差別殺人"},"tags":["KOReader"],"modelName":"JP Mining Note","audio":{"url":"https://audio00.forvo.com/ogg/9221075/76/9221075_76_3392575.ogg","filename":"forvo_無差別殺人.ogg","fields":["WordAudio"]},"options":{"allowDuplicate":false,"duplicateScope":"deck"},"deckName":"Mining Deck"}}}
Nothing looks wrong with this at first glance, I changed the deckName and modelName so it works with my own japanese deck and got the same error. Bit of a weird error, but I expected that to go wrong since those field names you're using don't exist on the note type that I'm using.
If I change your note JSON further to refer to fields that actually exist on my note type, then it saves the note fine. This made me wonder if it might just be missing the primary field on your note, and sure enough, if I remove that:
[~]$ curl localhost:8765 -X POST -T note.json
{"result": null, "error": "cannot create note because it is empty"}[~]$
So I can only guess, but you're probably not filling in any value for the primary field on your note. For example, for the note type I'm using, these fields are available:
If I don't have a 'SentKanji' field on my note, then I'm getting that error. Looking back at your note, can you make sure either 'Sentence', 'PrimaryDefinition', 'Comment' or 'Word' is the first field on your note?
It is really Weird that my note type contain all of this field . I dont know why it said that error. Even when i am fully reintall the plugin without remove the Audio_forvo line
This is unrelated to your Forvo issue. Did you ever get the plugin to work before?
Looking at the fields on your screenshot, it's not that there's a problem with you using fields that don't exist. The problem seems to be that anki-connect (so not this plugin) expects the first field on your note type to be present when you add a note. So in your case, it expects a 'Key' field to be present. I would try and use that field for something just to test, or move one of the fields you actually want to use to the top, so it becomes number 1
You are really Genius and very patient to help me throught this ! It 's actually work when i change to "Key". I just want to ask is it possible to i modify the config lua so that Field will add to both Key and Word Field? And we don't have the reading of the Word, Isn't it?
You currently can't modify the config in such a way that it would send the word you looked up to two different fields. I'd have to allow something like
{
"word_field" = [ "Key", "Word" ]
}
I don't see a good reason to do that to be honest, it would complicate things quite a bit and there's no real use case where this would actually be wanted, except yours, where you're really just trying to work around an Ank limitation.
FYI, you cannot create a note like that straight in Anki either, I tried adding a note with the first field empty, and it returns:
What you could do if you really don't want to update your note type, is create a custom extension and drop it in the extension folder, and make that copy the word field to key as well.
e.g.
local logger = require("logger")
local WordKeyExt = {}
function WordKeyExt:run(note)
note.fields['Key'] = note.fields[self.conf.word_field:get_value()]
logger.info("updated note fields: ", note.fields)
return note
end
return WordKeyExt
save that as a file, something like EXT_wordkey.lua
and drop that file in the ./extensions folder, then add the EXT_wordkey.lua
filename in your list of enabled extensions in config.lua itself.
That will, before saving the note, copy the value of the word_field
(in your case 'Word') to the 'Key' field
Thanks for writing extension for me. I think this will help people Using JP Miniing Note. Just one more question before you close this issue thread. Did you know anyway i can update this word Reading Field Other than manual update Note :)
You could try to extract that info from your dictionary definition, it looks like it might be possible with that JMDict one you're using. However, I'd recommend you just let something else do it, there's an Ajatt-tools anki addon that does just that: https://ankiweb.net/shared/info/1344485230
There's even a specific version made by other people for that note type you're using: https://ankiweb.net/shared/info/200813220
Thanks. Please close this issue for me
I am using IPV4 as ankiconnect But when i am add to anki, It show the error of Forvo Server, How can i handle this issue