Hello! I’m developing Sonaveeb Integration addon which allows you to generate Anki notes for Estonian words. The addon creates its own dedicated note type. It can also update it automatically if the upstream version changes.
Currently I’m working on allowing the user to create their own note types with custom card templates. I can distinguish if the note type is valid for the addon by checking if it has all the necessary fields. But I also want to support updating fields for the user note types, when outdated. So I also need to distinguish if the note type is intended for the addon, which it might be even if not valid.
For now I require the intended note type names to start with a predefined prefix (“Sõnaveeb”), but it’s not intuitive, and may also let false positives in (the user might want to have a note type named “Sõnaveeb Something” that is not related to my addon). Ideally I would want to plant some custom flag in the default addon’s note type when I create it programmatically, so that when user clones it the flag would be inherited. Is something like this possible? Alternatively, is it possible to check whether one note type was originally cloned from another, even after they were modified?
Thanks a lot for the answer! I considered adding a “marker” field, but now I have a lot more confidence knowing this is a recommended solution. Looking at the database structure, do I understand correctly that the size overhead of an empty field is just one separator byte (0x1f) per note?
do I understand correctly that the size overhead of an empty field is just one separator byte (0x1f) per note?
I hadn’t even considered how much extra data using a marker field would add to each note, but yeah that seems right according to the db details.
I didn’t realize until now but that seems to be the reason adding/removing/repositioning a field requires a full upload: every note for the note type needs to have those separators added/removed or the order of the values changed.
Arbitrary keyed values can be stored in a notetype, and doing so is going to be more efficient than adding an unused field. Just please avoid storing large amounts of data, as that will slow Anki down.
Oh, awesome! I haven’t released the update yet, so can still change to this easily. Will try it out and mark it as a solution if everything works. Thank you!
Seems to be included. I’ve exported my collection, then removed all my note types, then imported it back. The restored note type shows up in my addon, filtered by a custom key.