Addon Help Needed (or Interesting in Taking Over an Addon?)

I’ve submitted a pull request to add two new hooks:

The add-on would look something like this with these hooks:

from aqt import gui_hooks
from anki.sound import SoundOrVideoTag
from aqt import mw


def get_sounds(config, card):
    sounds = []
    tags = [tag.lower() for tag in card.note().tags]
    for tag in config.keys():
        if tag in tags:
            sounds.append(SoundOrVideoTag(filename=config[tag]))
    return sounds

def myhook(card, sounds):    
    my_sounds = get_sounds(mw.addonManager.getConfig(__name__), card)
    for s in my_sounds:
        sounds.insert(0, s)

gui_hooks.reviewer_will_play_question_sounds.append(myhook)

2 Likes