Add cardsToNotes function
This commit is contained in:
parent
6a6f9d7d2a
commit
e02f8b2d65
@ -507,6 +507,10 @@ class AnkiBridge:
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def cardsToNotes(self, cards):
|
||||||
|
return self.window().col.db.list('select distinct nid from cards where id in ' + anki.utils.ids2str(cards))
|
||||||
|
|
||||||
|
|
||||||
def guiBrowse(self, query=None):
|
def guiBrowse(self, query=None):
|
||||||
browser = aqt.dialogs.open('Browser', self.window())
|
browser = aqt.dialogs.open('Browser', self.window())
|
||||||
browser.activateWindow()
|
browser.activateWindow()
|
||||||
@ -781,6 +785,11 @@ class AnkiConnect:
|
|||||||
return self.anki.findCards(query)
|
return self.anki.findCards(query)
|
||||||
|
|
||||||
|
|
||||||
|
@webApi
|
||||||
|
def cardsToNotes(self, cards):
|
||||||
|
return self.anki.cardsToNotes(cards)
|
||||||
|
|
||||||
|
|
||||||
@webApi
|
@webApi
|
||||||
def guiBrowse(self, query=None):
|
def guiBrowse(self, query=None):
|
||||||
return self.anki.guiBrowse(query)
|
return self.anki.guiBrowse(query)
|
||||||
|
23
README.md
23
README.md
@ -490,6 +490,29 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **cardsToNotes**
|
||||||
|
|
||||||
|
Returns an (unordered) array of note IDs for the given card IDs. For cards with the same note, the ID is only
|
||||||
|
given once in the array.
|
||||||
|
|
||||||
|
*Sample request*:
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"action": "cardsToNotes",
|
||||||
|
"params": {
|
||||||
|
"cards": [1502098034045, 1502098034048, 1502298033753]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Sample response*:
|
||||||
|
```
|
||||||
|
[
|
||||||
|
1502098029797,
|
||||||
|
1502298025183
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
* **guiBrowse**
|
* **guiBrowse**
|
||||||
|
|
||||||
Invokes the card browser and searches for a given query. Returns an array of identifiers of the cards that were found.
|
Invokes the card browser and searches for a given query. Returns an array of identifiers of the cards that were found.
|
||||||
|
Loading…
Reference in New Issue
Block a user