Change behaviour of tag/suspend functions
This commit is contained in:
parent
e8088146f3
commit
a78d40457c
@ -375,18 +375,15 @@ class AnkiBridge:
|
||||
return note
|
||||
|
||||
|
||||
def addTags(self, query, tags, add=True):
|
||||
notes = aqt.mw.col.findNotes(query)
|
||||
def addTags(self, notes, tags, add=True):
|
||||
aqt.mw.col.tags.bulkAdd(notes, tags, add)
|
||||
|
||||
|
||||
def suspend(self, query, suspend=True):
|
||||
cards = aqt.mw.col.findCards(query)
|
||||
def suspend(self, cards, suspend=True):
|
||||
if suspend:
|
||||
suspendFunction = aqt.mw.col.sched.suspendCards
|
||||
aqt.mw.col.sched.suspendCards(cards)
|
||||
else:
|
||||
suspendFunction = aqt.mw.col.sched.unsuspendCards
|
||||
suspendFunction(cards)
|
||||
aqt.mw.col.sched.unsuspendCards(cards)
|
||||
|
||||
|
||||
def startEditing(self):
|
||||
@ -677,23 +674,23 @@ class AnkiConnect:
|
||||
|
||||
|
||||
@webApi
|
||||
def addTags(self, query, tags, add=True):
|
||||
return self.anki.addTags(query, tags, add)
|
||||
def addTags(self, notes, tags, add=True):
|
||||
return self.anki.addTags(notes, tags, add)
|
||||
|
||||
|
||||
@webApi
|
||||
def removeTags(self, query, tags):
|
||||
return self.anki.addTags(query, tags, False)
|
||||
def removeTags(self, notes, tags):
|
||||
return self.anki.addTags(notes, tags, False)
|
||||
|
||||
|
||||
@webApi
|
||||
def suspend(self, query, suspend=True):
|
||||
return self.anki.suspend(query, suspend)
|
||||
def suspend(self, cards, suspend=True):
|
||||
return self.anki.suspend(cards, suspend)
|
||||
|
||||
|
||||
@webApi
|
||||
def unsuspend(self, query):
|
||||
return self.anki.suspend(query, False)
|
||||
def unsuspend(self, cards):
|
||||
return self.anki.suspend(cards, False)
|
||||
|
||||
|
||||
@webApi
|
||||
|
16
README.md
16
README.md
@ -307,14 +307,14 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
|
||||
* **addTags**
|
||||
|
||||
Adds tags to notes matching a query (same syntax as **browse**/**guiBrowse**).
|
||||
Adds tags to notes by note ID.
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "addTags",
|
||||
"params": {
|
||||
"query": "deck:French or deck:Spanish",
|
||||
"notes": [1483959289817, 1483959291695],
|
||||
"tags": "european-languages"
|
||||
}
|
||||
}
|
||||
@ -327,14 +327,14 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
|
||||
* **removeTags**
|
||||
|
||||
Remove tags from notes matching a query (same syntax as **browse**/**guiBrowse**).
|
||||
Remove tags from notes by note ID.
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "removeTags",
|
||||
"params": {
|
||||
"query": "deck:Japanese or deck:Chinese",
|
||||
"notes": [1483959289817, 1483959291695],
|
||||
"tags": "european-languages"
|
||||
}
|
||||
}
|
||||
@ -347,14 +347,14 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
|
||||
* **suspend**
|
||||
|
||||
Suspend cards matching a query (same syntax as **browse**/**guiBrowse**).
|
||||
Suspend cards by card ID.
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "suspend",
|
||||
"params": {
|
||||
"query": "tag:difficult"
|
||||
"cards": [1483959291685, 1483959293217]
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -366,14 +366,14 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
|
||||
* **unsuspend**
|
||||
|
||||
Unsuspend cards matching a query (same syntax as **browse**/**guiBrowse**).
|
||||
Unsuspend cards by card ID.
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "unsuspend",
|
||||
"params": {
|
||||
"query": "tag:easy"
|
||||
"cards": [1483959291685, 1483959293217]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user