jefdongus / insert-symbols-anki-addon

Anki add-on to insert Unicode symbols into cards.
https://ankiweb.net/shared/info/2040501954
24 stars 10 forks source link

saving the config #2

Closed ijgnd closed 5 years ago

ijgnd commented 5 years ago

First of all thanks for creating and sharing this very useful add-on. The add-on works great and is a huge time saver.

I saw that you create an additional table in the anki database.

@Arthur-Milchior reported that creating an additional table caused him problems, see here:

when you do a full sync, the database is copied literally, as a single file, so a full sync would upload the new tables. And then, ankidroid would download a database with the new tables and would bug (I tried)...

I was curious but so far didn't encounter a problem with Ankidroid when I did a full sync of my test profile after using your add-on. But to be on the safe side I changed a few lines in your add-on so that I now store my config in the meta.json of the add-on.

As far as I know there's only one add-on (Incremental Reading Extension and View Size Adjust (fork by Aleksej)) that also creates an additional table in the collection. Several others seem to use their own sqlite database.

jefdongus commented 5 years ago

Glad to hear you find it helpful! I've actually been syncing with this plugin and AnkiDroid for quite a while now and haven't had any crashes, so I don't think the crash is simply caused by adding a new table to the database.

I think the biggest downside to the meta.json approach is that, to my knowledge, the meta.json is not supported in Anki 2.0. Furthermore, anything stored in the add-on folder could get deleted during an upgrade, which would not be good for users with custom symbols.

An alternative would be storing the symbols in config.json, but this is also a 2.1-only feature. In 2.0 configuration options can be stored in the mw.col.conf table, but I'd favor using a new table over that. Lastly, while having separate code for 2.1 and 2.0 is possible, I wouldn't unless it was absolutely necessary.

Bottom line is that I don't think creating a new table will actually cause a crash (if it crashes AnkiDroid they should fix it, since it's one of the recommended methods of storing data in the official Anki docs). Let me know what you think -- I'll leave this open for a bit!

Arthur-Milchior commented 5 years ago

Did you make a full sync ?  As far as I remember, the trouble only occurred when I did a full sync. Partial sync has no trouble has it does not send the database itself.

It's also possible that I did report the bug incorrectly. Or that it was already corrected. I never investigated a lot this question

jefdongus commented 5 years ago

I haven't had problems with full syncs either (eg. after a new card type is added).

ijgnd commented 5 years ago

@jefdongus: thank you very much for this comprehensive answer. I somehow missed the part from the official documentation. I guess that this should settle it.

@Arthur-Milchior: I guess your remark from a few months ago was just an offhand remark in a reddit thread that was about a different topic. It's very useful that you liberally share your experiences. So sorry for digging this comment out over and over and sharing it so prominently.