dsnopek / anki-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
744 stars 95 forks source link

A way to get tags by deck ? #17

Open mickaelandrieu opened 10 years ago

mickaelandrieu commented 10 years ago

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,

dsnopek commented 10 years ago

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. :-)

mickaelandrieu commented 10 years ago

: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

dsnopek commented 10 years ago

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...