Closed sudomain closed 4 years ago
Would CrowdAnki know to stop when it finds Anki.json in the root of the project? Would it continue to search afterwards and possibly try to import some deep nested json that I wasn't aware of in e.g. sources/anki-manual/some/very/long/path.json?
To answer the second question, first, since that's something I remember off the top of my head (and can easily verify), CrowdAnki
only checks in the root directory that is "opened"*, and actually only accepts two possible JSON names there:
deck.json
name_of_root_directory.json
"(See get_deck_path
, called here if you want to verify this yourself — it should hopefully vaguely make sense even if you're not too familiar with Python.)
* the directory that is "opened" is either the one chosen by the user (when importing with CrowdAnki: Import from disk
) or the root of the Git repo (when importing with CrowdAnki: Import git repository
).
Hello, does the CrowdAnki importer check that a given json file is a valid file created by a CrowdAnki export? I
As for the first question, regarding importing a "random" JSON, I haven't looked into this in detail, and might have missed something, but CrowdAnki
doesn't seem to validate the contents, as such (other than implicitly checking that the file is a valid JSON). If the relevant fields/keys (e.g. "notes") aren't present, then the importer will throw an error (which is slightly messy, but harmless).
(Development aside: it might, perhaps, be cleaner to check for the presence of the key fields beforehand.)
PS I'd be curious about the collaborative decks once you make them! (Obviously no pressure, though :))
Thank you for the help, as well as developing the add-on. I'll reach out when I publish the decks.
Hello, does the CrowdAnki importer check that a given json file is a valid file created by a CrowdAnki export? I want to start making collaborative decks via CrowdAnki. Apart from the recommended collab process outlined in the README, I would also like to keep track of the source material for a deck via git submodules. For instance, if I was creating a deck with the name of "Anki", I would like to make a directory structure similar to:
where Anki.json is created/managed by CrowdAnki,
sources/
is a directory I created, andanki-manual/
is a git repo that I added as a submodule from https://github.com/ankitects/anki-manual. In this example, I happen to know thatanki-manual/
doesn't contain any json file, but suppose it did and I wasn't aware. Would CrowdAnki know to stop when it findsAnki.json
in the root of the project? Would it continue to search afterwards and possibly try to import some deep nested json that I wasn't aware of in e.g.sources/anki-manual/some/very/long/path.json
?