How can I collect data from reviewer?

Hello, everyone. After maaaaany questions I am finally able to barely create addons. I understand how hooks work and how to query from the database. However, I’d like to know something else. How can I collect the actual data Anki is displaying? Let’s say I need to get the current shown card text from reviewer. I can call a hook like reviewer_will_play_question_sounds to trigger my function. However, how can I actually get the card data or anything else I might need?

The reviewer_will_play_question_sounds hook already provides you with a Card object that you can use to get all kinds of data about the card. You can use card.question() and card.answer() to get the card text.

By the way, the card_will_show hook could be more suitable if you want to get card info from all cards the reviewer shows regardless of whether they have audio files playing.


1 Like

So the syntax would be reviewer_will_play_question_sounds(cards.question)?

No, it would be something like this:

from aqt import gui_hooks

def myfunc(card, tags):


Be sure to read the add-ons guide if you have not already: Writing Anki Add-ons