Raffaelbdl / kuma-browser

Add-on to use JPDB directly inside Anki
MIT License
8 stars 1 forks source link

Missing cards when importing custom deck #14

Closed Baucmd closed 1 month ago

Baucmd commented 1 month ago

Hi,

Thank you for developing such a great plugin, it's been really good and I have not encountered any problem expect this one !

I'm importing a custom desk from top X words that I created on jpdb.io, when I review the cards in anki after the import, several card seems to have gone missing, for exemple いる (id 1577980) is not present in the cards list.

image ( the result is not いる it's 入いる)

I tried to see if the data fetched from the public API and it seems to be present:

image

it seems that there is two meaning for いる(1546640 and 1577980), could it be the issue ?

I have not checked the code yet, but do you know any problem on this topic ? I can take a look if you need :)

Baucmd commented 1 month ago

https://github.com/Raffaelbdl/kuma-browser/blob/0dddb6eeaff986a4ef51eda01aeb4032242265c9/kuma/jpdb_api.py#L247-L250

you are targeting the expression, both meaning have the same expression therefore iru (to be) is not written in anki deck

Raffaelbdl commented 1 month ago

Hi, thank you for using this addon !

Actually that is a known issue I should work on, I should store some kind of unique id for the cards. This would also allow to update the notes automatically even after the creation.

I will see if I can make something today, I have procrastinated on it for too long 😂

Raffaelbdl commented 1 month ago

Ok I think I managed to create some kind of note ID in the Pull Request. Could you try it and see if it fixes your problem in your case ?

Unfortunately this change is not backward compatible so if you had started learning your deck you might have to start again ^^'

Baucmd commented 1 month ago

Hi,

Thank for your work, I'll try it tomorrow, I have managed to make it work by using SId and VId provided by JPDB that are both primary key of the vocabulary.

Here is the pull request on the fork I did

https://github.com/Raffaelbdl/kuma-browser/pull/16

Baucmd commented 1 month ago

I think it's also resolve the problem of

Cards from the API and the scraper are not "compatible", so duplicates will be created when trying to download from both

Raffaelbdl commented 1 month ago

Thank you for the PR! That is basically what I did as well, I just merged Sid and Vid into a single id to have a single entry for both normal cards and API cards.

To make cards "compatible" we would need a way to retrieve the Sid and Vid from the HTML page. I will try to dig into it again to see if I can find this information.

Raffaelbdl commented 1 month ago

So I have decided to go with only the VID for the identifier, as it can be immediately read from the url If it is ok for you, I will push my PR and close this issue :hugs: Thank you for reminding me of this problem !

Raffaelbdl commented 1 month ago

I went ahead and merged it, please reopen the issue you want to add something :hugs: