Skip to content

Commit

Permalink
Stvad#15 added the convention, for import as well as export, that all…
Browse files Browse the repository at this point in the history
… 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'
  • Loading branch information
evolverine committed Apr 19, 2019
1 parent 732e232 commit 7e2ef5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crowd_anki/export/anki_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def export_to_directory(self, deck: AnkiDeck, output_dir=Path("."), copy_media=T
deck = deck_initializer.from_collection(self.collection, deck.name)
self.last_exported_count = deck.get_note_count()

deck_filename = deck_directory.joinpath(deck_fsname).with_suffix(DECK_FILE_EXTENSION)
deck_filename = deck_directory.joinpath('deck').with_suffix(DECK_FILE_EXTENSION)
with deck_filename.open(mode='w', encoding="utf8") as deck_file:
deck_file.write(json.dumps(deck,
default=Deck.default_json,
Expand Down
2 changes: 1 addition & 1 deletion crowd_anki/importer/anki_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def load_from_directory(self, directory_path, import_media=True):
aqt.mw.progress.start(immediate=True)

try:
self.load_from_file(directory_path.joinpath(directory_path.name).with_suffix(DECK_FILE_EXTENSION))
self.load_from_file(directory_path.joinpath('deck').with_suffix(DECK_FILE_EXTENSION))

if import_media:
media_directory = directory_path.joinpath(MEDIA_SUBDIRECTORY_NAME)
Expand Down

0 comments on commit 7e2ef5b

Please sign in to comment.