Rename browse to findCards and add new findNotes function
This commit is contained in:
parent
a78d40457c
commit
30f3d5618a
@ -460,6 +460,20 @@ class AnkiBridge:
|
||||
return deck['name']
|
||||
|
||||
|
||||
def findNotes(self, query=None):
|
||||
if query is not None:
|
||||
return aqt.mw.col.findNotes(query)
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
def findCards(self, query=None):
|
||||
if query is not None:
|
||||
return aqt.mw.col.findCards(query)
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
def guiBrowse(self, query=None):
|
||||
browser = aqt.dialogs.open('Browser', self.window())
|
||||
browser.activateWindow()
|
||||
@ -474,13 +488,6 @@ class AnkiBridge:
|
||||
return browser.model.cards
|
||||
|
||||
|
||||
def browse(self, query=None):
|
||||
if query is not None:
|
||||
return aqt.mw.col.findCards(query)
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
def guiAddCards(self):
|
||||
addCards = aqt.dialogs.open('AddCards', self.window())
|
||||
addCards.activateWindow()
|
||||
@ -722,13 +729,18 @@ class AnkiConnect:
|
||||
|
||||
|
||||
@webApi
|
||||
def guiBrowse(self, query=None):
|
||||
return self.anki.guiBrowse(query)
|
||||
def findNotes(self, query=None):
|
||||
return self.anki.findNotes(query)
|
||||
|
||||
|
||||
@webApi
|
||||
def browse(self, query=None):
|
||||
return self.anki.browse(query)
|
||||
def findCards(self, query=None):
|
||||
return self.anki.findCards(query)
|
||||
|
||||
|
||||
@webApi
|
||||
def guiBrowse(self, query=None):
|
||||
return self.anki.guiBrowse(query)
|
||||
|
||||
|
||||
@webApi
|
||||
|
35
README.md
35
README.md
@ -383,14 +383,37 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
null
|
||||
```
|
||||
|
||||
* **guiBrowse**
|
||||
* **findNotes**
|
||||
|
||||
Invokes the card browser and searches for a given query. Returns an array of identifiers of the cards that were found.
|
||||
Returns an array of note IDs for a given query (same query syntax as **guiBrowse**).
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "guiBrowse",
|
||||
"action": "findCards",
|
||||
"params": {
|
||||
"query": "deck:current"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*Sample response*:
|
||||
```
|
||||
[
|
||||
1483959289817,
|
||||
1483959291695
|
||||
]
|
||||
```
|
||||
|
||||
* **findCards**
|
||||
|
||||
Returns an array of card IDs for a given query (functionally identical to **guiBrowse** but doesn't use the GUI
|
||||
for better performance).
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "findCards",
|
||||
"params": {
|
||||
"query": "deck:current"
|
||||
}
|
||||
@ -406,14 +429,14 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
]
|
||||
```
|
||||
|
||||
* **browse**
|
||||
* **guiBrowse**
|
||||
|
||||
Functionally identical to **guiBrowse**, but accesses the database without using the GUI for increased performance.
|
||||
Invokes the card browser and searches for a given query. Returns an array of identifiers of the cards that were found.
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "browse",
|
||||
"action": "guiBrowse",
|
||||
"params": {
|
||||
"query": "deck:current"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user