anki-sync-server icon indicating copy to clipboard operation
anki-sync-server copied to clipboard

A way to get tags by deck ?

Open mickaelandrieu opened this issue 11 years ago • 3 comments

Hi,

in api I don't see how I can get tags from a deck instead of all decks of collections. Did you plan to implement an "list_tags_by_deck" or something like that ?

Regards,

mickaelandrieu avatar Jul 25 '14 13:07 mickaelandrieu

I don't currently have plans to implement such a method, but I'd definitely consider merging a PR that added it! It sounds like that could be useful. :-)

dsnopek avatar Jul 25 '14 13:07 dsnopek

:D

I'm not a python developper at all, but if you help me a little bit I can try

edit:

def list_tags_by_deck(self, col, req):
        return col.tags.byDeckName(req.data['deckName'])

but tags https://github.com/dae/anki/blob/master/anki/tags.py don't have this kind of method for now :s

mickaelandrieu avatar Jul 25 '14 13:07 mickaelandrieu

Yeah, I think you're going about this the right way! This is mostly about finding the Anki method that does it and then using it in AnkiServer. We're currently listing decks using col.decks.all(), maybe there is another method under col.decks that will list tags? Or a property on the deck object? Unfortunately, I don't have time to search through the code myself right now...

dsnopek avatar Jul 30 '14 11:07 dsnopek