All cards added to the first deck name when multiple decks are added to a package.
See original GitHub issueDear KerrickStaley,
Thank you for sharing your library. I think I might have found an issue.
Example code:
data = {
'deck1':
[{
'a': 'content deck 1 a1',
'b': 'content deck 1 b1'
},
{
'a': 'content deck 1 a2',
'b': 'content deck 1 b2'
}],
'deck2':
[{
'a': 'content deck 2 a1',
'b': 'content deck 2 b1'
},
{
'a': 'content deck 2 a2',
'b': 'content deck 2 b2'
}],
'deck3':
[{
'a': 'content deck 3 a1',
'b': 'content deck 3 b1'
},
{
'a': 'content deck 3 a2',
'b': 'content deck 3 b2'
}]
}
# Create the model
a_to_b = genanki.Model(
2043134337, # unique identifier
'a-to-b', # human readable name
fields = [
{'name': 'a'},
{'name': 'b'},
],
templates=[
{
'name': 'Card 1',
'qfmt': '{{a}}',
'afmt': '{{FrontSide}}<hr id="answer">{{b}}',
},
]
)
decks = []
for deck_name in data:
deck = genanki.Deck(
2043134340,
deck_name
)
# Add the notes
for note in data[deck_name]:
note = genanki.Note(
model=a_to_b,
fields=[note.get('a',''),
note.get('b',''),
])
deck.add_note(note)
decks.append(deck)
# Create the file
genanki.Package(decks).write_to_file('output.apkg')
When I then load this apkg file into Anki, Anki adds all 6 cards that should be in deck1, deck2 and deck3 into only deck1.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Standard 52-card deck - Wikipedia
The standard 52-card deck of French-suited playing cards is the most common pack of playing cards used today. In English-speaking countries it is...
Read more >Card copies in multiple decks? - Fluent Forever
My idea is to create two separate decks. The first deck would have two cards per word - image:sound&pinyin and character:sound/pinyin (so ...
Read more >Programming Example: Card, Hand, Deck
In a typical card game, each player gets a hand of cards. The deck is shuffled and cards are dealt one at a...
Read more >Filtered Decks - Anki Manual
Display those cards first, that you have most recently added to the deck. (This is the opposite of 'Order added'.) Relative overdueness. Display...
Read more >Anki for Med School: Structuring Decks and Tags - YouTube
This video describes one method to systematically organize Anki decks related to medical school coursework. Check out some of my other ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PR submitted and complete #20. Please review
Hello sciencemanx,
I got the issue again. But the behavior is different
“When I then load this apkg file into Anki, Anki adds all 6 cards that should be in deck1, deck2 and deck3 into only deck3.”