How can go get data from only a specific deck in anki?

Say I want to get the amount of due cards from each anki deck that I have.

How can I do this? There is literally nowhere where I cant find the answer and ive tried for 3 days so Im posting here.

Additionally, I am making an addon where I would like to add a column to anki which displays an additionaly statistic on the menu page for a each deck. How can I add/modify the home page of anki as well? There is literally no information about this and i have no idea how the first add ons were made in teh first place…

Try something like this:

deck_id ="all")
node = mw.col.sched.deck_due_tree(deck_id)
print(node.new_count, node.learn_count, node.review_count)

If you mean the menu that appears when you click on the gear icon, try the deck_browser_will_show_options_menu hook. Here is a usage example:

There is not much documentation and guides about add-on development. You really have to learn to navigate the source code at some point. For example, I was aware there is a function called deck_tree, deck_due_tree or something to get due cards, but had to go check the source code to confirm this.


Thanks so much for your reply.

I actually did not mean the gear icon, but rather, you know the columns on the home page “deck”, “new”, “learn”, “due” etc? I want to create a NEW on “foo”, to the left of deck, which displays ADDITIONAL information about each deck.

Any ideas on that? To me it seems impossible :smile:

You probably have to patch the _renderDeckTree and _render_deck_node methods: anki/ at main · ankitects/anki · GitHub