コード例 #1
0
def getRows():
    finder = Finder(mw.col)
    #all notes
    cids = finder.findCards("")
    for cid in cids:
        card = mw.col.getCard(cid)
        deck = mw.col.decks.get(card.did)
        deckName = deck["name"]
        note = card.note()
        model = note._model
        modelName = model["name"]
        try:
            template = model["tmpls"][card.ord]
        except IndexError:
            print(
                f"""Card {cid} has ord {card.ord} and model {modelName}, which have only {len(model["tmpls"])} cards.""",
                file=sys.stderr)
            continue
        templateName = template["name"]
        try:
            yield (card.id, card.nid, deckName, templateName, card.mod,
                   card.usn, card.type, card.queue, card.due, card.ivl,
                   card.factor, card.reps, card.lapses, card.odue, card.odid)
        except:
            raise
コード例 #2
0
def getReviewCards():
    finder = Finder(mw.col)
    cids = finder.findCards("is:review")
    return cids