Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deck name vs. repository name #15

Closed
axelboc opened this issue Dec 28, 2016 · 4 comments
Closed

Deck name vs. repository name #15

axelboc opened this issue Dec 28, 2016 · 4 comments

Comments

@axelboc
Copy link

axelboc commented Dec 28, 2016

  • On export, CrowdAnki outputs a folder named after the deck - e.g. My Deck becomes My_Deck.
  • To import from GitHub, CrowdAnki requires the repository to be named after the deck - e.g. My_Deck.

I'm not very keen on having the name of my GitHub repo bound to the name of the deck. I think the add-on would really benefit from a bit more flexibility in this regard.

I can think of a couple of options:

  1. Include the name of the deck in the JSON and allow exporting the deck to any folder (i.e. the export doesn't create the folder).
    • Upside: nice separation of concern; during the import CrowdAnki can just look for the JSON file and the media folder at the root of the repo and parse the content of the file to get the name of the deck.
    • Downside: changing the format is not ideal... although for backward compatibility, if the JSON file doesn't contain the name of the deck, its filename could be used as fallback.
  2. Keep the export as is, but allow selecting a custom folder inside the git repository during the import.
    • Upside: probably more straightforward to implement; no change to the JSON format.
    • Downside: superfluous folder nesting; makes import more complex for end users.
@Stvad
Copy link
Owner

Stvad commented Jan 2, 2017

Hi, I'm not sure I'm following what is your concern.
The name of the deck is already included in the JSON. And correspondingly code, internally, can handle any correct JSON file (though admittedly there is no UI to do that).
I've chosen to enforce the convention for deck directories to be the representation of the deck name as it was easier to implement and I haven't seen any particular advantage in the 'pick first json file strategy' (though it can be changed without breaking thins).
I've chosen to enforce convention name of the repository==the name of the deck directory for the same reason (and also to reinforce the notion one-repository=one-deck). I can see how the name of the repository may not be the nicest one as a consequence, with hierarchy and platform-specific name limitations.
Do I understand correctly that you would prefer mentioned 'pick first json file strategy' to be in place (that would imply that the repositories can have any valid name as long as they have the correct content in place)?

@axelboc
Copy link
Author

axelboc commented Jan 3, 2017

Ah sorry, I can indeed see the name of the deck in the JSON - not sure how I missed that. It makes my second option irrelevant...

So what I'm suggesting is to remove the first convention you mention that the deck directory has to match the name of the deck.

I think the import can still work the same way: select a folder and look for a JSON file with the same name. No need for a 'pick first json file strategy'.

The problem is with the export. A solution might be to have a checkbox that says something like "Create deck directory":

  • If the box is ticked, the behaviour is the same as it is now.
  • If the box is unticked, CrowdAnki outputs the JSON file and media folder directly at the root of the folder selected by the user, and names the JSON file after that folder.

Does that make sense?

@Stvad
Copy link
Owner

Stvad commented Jan 3, 2017

I see, the thing is that right now plugin integrates into export infrastructure already present in Anki (not that it fits well or the infrastructure is any good). And within this constraints, I'm not sure how/where to elegantly fit additional ui options for the export.

ELLIOTTCABLE added a commit to ELLIOTTCABLE/greek-characters that referenced this issue Oct 31, 2017
evolverine added a commit to evolverine/CrowdAnki that referenced this issue Apr 19, 2019
… jsons be called deck.json. This way their name doesn't need to be tied to the deck name or to the folder name or to the github repo name. Did some tests and it seems to work just fine. A repo called 'myRepo', when imported, will create a deck called 'Spanish castellano' from a json called 'deck.json'
evolverine added a commit to evolverine/CrowdAnki that referenced this issue May 26, 2019
…kwards compatibility in the importer, and changed the function description
Stvad pushed a commit that referenced this issue Jul 30, 2019
…s be called deck.json. This way their name doesn't need to be tied to the deck name or to the folder name or to the github repo name. Did some tests and it seems to work just fine. A repo called 'myRepo', when imported, will create a deck called 'Spanish castellano' from a json called 'deck.json'
Stvad pushed a commit that referenced this issue Jul 30, 2019
…s compatibility in the importer, and changed the function description
@Stvad
Copy link
Owner

Stvad commented Jul 30, 2019

#56

@Stvad Stvad closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants