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