Commit Graph

97 Commits

Author SHA1 Message Date
Austin Siew
6e4bbfa0d6 Added getReviewsOfCard 2022-09-05 00:29:03 -06:00
Austin Siew
8ec078393a removed the bulk action in favor of the already existing 'multi' action 2022-08-16 19:35:32 -06:00
Austin Siew
ebdca1db6b Added model field name api points and skeleton documentation to README 2022-08-16 19:23:09 -06:00
debanjandhar12
504ac68b40
Fix storeMediaFile logic
Currently, when `skip` is true and `deleteExisting` is true the `storeMediaFile` will simply delete the media file. 
However, the intended behavior should be to not touch the media file when both conditions are true.
2022-06-06 13:47:22 +05:30
Alexei Yatskov
99d6256ade
Merge pull request #324 from toasted-nutbread/api-reflect
apiReflect
2022-05-29 12:58:38 -07:00
Alexei Yatskov
1d5b87b3f4
Merge pull request #322 from ZhengPeiRu21/fixDeckStatsTest
Fix getDeckStats test
2022-05-29 12:57:18 -07:00
Alexei Yatskov
23c25dd7ae
Merge pull request #319 from oakkitten/fix-bad-json-error
Produce a better error in case of malformed JSON
2022-05-29 12:56:51 -07:00
郑佩茹
1d7bf6969a Correct line endings 2022-05-23 11:37:18 -06:00
郑佩茹
5e701e30aa Only add total_in_deck to deckStats in supported Anki versions 2022-05-23 11:27:40 -06:00
toasted-nutbread
8d9163048a Add apiReflect 2022-05-20 17:08:29 -04:00
oakkitten
bffbb051f2 Produce a better error in case of malformed JSON
$ curl localhost:8777 -X POST -i -d '{"action": "version", "version": 6},' && echo ␄
HTTP/1.1 200 OK
Content-Type: text/json
Access-Control-Allow-Origin: http://localhost
Access-Control-Allow-Headers: *
Content-Length: 67

{"result": null, "error": "Extra data: line 1 column 36 (char 35)"}␄

$ curl localhost:8777 -X POST -i -d '{"action": "version", "version": 6},' -H "Origin: foo" && echo ␄
HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin: http://localhost
Access-Control-Allow-Headers: *

␄
2022-05-11 20:32:08 +01:00
郑佩茹
137554f522 Add getDeckStats action 2022-05-03 15:59:33 -06:00
oakkitten
8a84db971a Patch Anki 2.1.50 on Windows to have valid stdout
Something in Anki is setting stdout to Null.
This is a problem because Anki itself is writing to it,
particularly when printing warnings about
the deprecated methods that we are using.

This patches Anki using the same method that
the upcoming Anki 2.1.51 is using.
2022-04-26 15:22:07 +01:00
oakkitten
700c6ae218 Explicitly require Anki >= 2.1.45
Consolidate Anki version checks across files
2022-04-26 15:22:06 +01:00
oakkitten
901d92b067 Tests: make tests pass for Anki 2.1.50 (Qt6)
* Import things from `aqt.qt` not `PyQt5`/`PyQt6`
* When testing with Qt6, disable Anki's Qt5 compatibility mode
* Depend on `pytest-anki` that is also Qt version agnostic
2022-04-26 15:22:06 +01:00
oakkitten
e025a44ea3 Tests: make tests pass for Anki 2.1.50 (Qt5)
* require Python 3.10
* prevent Anki from doing backups, again
* restore cwd that deck exporter changes for some wild reason
2022-04-26 15:22:06 +01:00
Abdo
a433f600a4 Allow passing deleteExisting in addNote (#309) 2022-04-25 20:13:06 -07:00
introt
81fccbfac6 requestPermission: improve UX & docs (#312)
* requestPermission: change Ignore button to checkbox

* Update requestPermission documentation

- describe the possible results
- document ignoreOriginList
2022-04-25 20:10:36 -07:00
oakkitten
c688895c0e Edit dialog: make browser button show all history
Before, pressing the Browse button would only show browser
with the cards or notes corresponding to the currently edited note.

Now, it shows all cards or notes from the dialog history,
in reverse order (last seen on top),
with the currently edited note or its cards selected.
2022-04-14 01:55:41 +01:00
oakkitten
c53aa86a0d Ignore option closeAfterAdding of guiAddCards
The functionality was broken, creating a dialog that was not,
in fact, closing after adding a card.

See the deleted comment in `test_graphical.py`
2022-04-11 02:28:25 +01:00
oakkitten
8aa5fdd1de Add api method guiEditNote 2022-04-11 02:28:25 +01:00
oakkitten
748310def4 Make plugin importable
Don't start the web server if imported not from inside Anki

Make sure Anki Connect instance is not garbage collected.
This kills the timer that's responsible for the web server.
2022-04-07 09:48:37 +01:00
oakkitten
d6061affad Remove api method updateCompleteDeck
This method was broken and there are no issues regarding it on GitHub.
2022-04-07 09:48:37 +01:00
oakkitten
eac658716a Fix api method findAndReplaceInModels
I think this was a typo?
2022-04-07 09:48:37 +01:00
oakkitten
baed642489 Fix api method deleteDecks
The method was failing due to Anki API changes.

Also, make it mandatory to call the method with `cardsToo=True`,
since deleting decks on Anki >= 2.1.28 without cards is
no longer supported, and the deprecated `decks.rem()` method
on Anki >= 2.1.45 ignores keyword arguments.
2022-04-07 09:48:37 +01:00
thiswillbeyourgithub
54a7105bf9
implement setSpecificValueOfCard for user @TobiasWehrum (#303)
Co-authored-by: thiswillbeyourgithub <github@32mail.33mail.comm>
2022-02-22 18:31:43 -08:00
Ren Tatsumoto
418ebcb0de
Fix updateModelTemplates and updateModelStyling functionality on Anki 2.1.45 and later (#296)
* fix update functionality on anki 2.1.45+

* delete trailing semicolon in the statement
2021-12-26 22:21:21 -08:00
penginsan
064fbef413
Add guiSelectedNotes action (#292) 2021-12-06 08:59:10 -08:00
Marcel Graber
335de469c3
Save note after field update (#287)
Signed-off-by: Marcel Graber <marcel@clever.design>
2021-09-15 17:55:46 -07:00
Ripose
5bb02e7d21
guibrowse: fixes mockmodel error on new anki versions (#288)
Anki deprecated access to the model from the API and the new MockModel
contained no attribute 'cards' leading to an error message being thrown
instead of card ids being returned. This change uses findCards to find
card ids instead of the model so no error is thrown while keeping
guiBrowse functionally equivalent to the previous version.
Closes #277.
2021-09-14 20:30:36 -07:00
thiswillbeyourgithub
2d08fdd5e5
feat: cardsInfo now also returns the modification time (#279)
* feat: cardsInfo now also returns the modification time

* minor: wrong indentation

* new method: get modification time of cards

* docs: mentions new method cardsModTime

* docs: readme now mentions that modification time is in the result from cardsInfo

Co-authored-by: thiswillbeyourgithub <github@32mail.33mail.comm>
2021-08-24 20:55:23 -07:00
NSBum
4e41429165
Fixed deck config id actions (#273)
The follow deck configuration actions were updated to conform to Anki’s current deck configuration access. Specifically, `decks.conf` is no longer available.

setDeckConfigId no longer check for existence of configuration id, because the access to the list of config id’s appears to be only through decks; and the config may theoretically be orphaned.
2021-07-14 18:22:10 -07:00
NSBum
8404bd782d
Added guiCheckDatabase action and fix #202 in saveDeckConfig (#271)
* Added guiCheckDatabase action

This action initiates a check database action in Anki but doesn’t wait for the action to complete before returning.

* Fixed #202 no dconf attribute in saveDeckConfig

Anki manages access to deck configuration differently now. This adapts saveDeckConfig to new style of access.
2021-07-13 17:55:22 -07:00
toasted-nutbread
2150940c7e
More create note duplicate options (#269)
* Simplify access to note['options']

* Add checkAllModels option

* Update documentation
2021-07-12 19:46:22 -07:00
Jason Won
591ac06aa3
allow guiAddCards to add media (#266)
* add media to editing note

* update readme
2021-06-20 20:35:09 -07:00
grepmew
a6406107e4
Resolves #223 by removing unnecessary image markup (#260) 2021-06-03 14:36:04 -07:00
abdo
f8ff7c0c38
storeMediaFile: Add option to keep file with the same name (#257) 2021-05-22 12:21:12 -07:00
DegrangeM
9fec86f7fe
Add requestPermission API method (#255)
* Add requestPermission Api Method

* Add documentation about requestPermission method

* Update version documentation
2021-05-07 20:33:06 -07:00
Kirill Salnikov
17d8ecf60f
Update createModel method to create Cloze models (#250) 2021-05-06 19:11:03 -07:00
Konstantin Sukovatij
929716c7b1
Added "getMediaFilesNames" action (#247) 2021-04-11 21:26:03 -07:00
abdo
2081330c35
Compare field names in a case-insensitive manner (#242) 2021-03-13 16:10:58 -08:00
9a18ae0b11 Better compat with old versions of Anki 2021-03-06 21:16:19 -08:00
Quentin Harscoët
27a8678f88
added getNumCardsReviewedByDay action (#239)
* added getNumCardsReviewedByDay action

* added sample in statistics.md

* fix bad quotes and add basic test
2021-03-06 09:58:40 -08:00
Kirill Salnikov
b8a7151ed0
Fix handling of errors in several methods (#238)
* Fix error message in updateNoteFields method

* Fix error handling in cardsInfo, notesInfo methods

* Add more tests for updateNoteFields, notesInfo

* Fix error handling in several methods

Also fixed obvious bugs in replaceTags and replaceTagsInAllNotes
methods.

* Add more tests for cards methods

* Add more tests for notes methods

* Update documentation on cards methods
2021-03-04 20:06:25 -08:00
Tsung-Po Sun(Munehiro)
a4d723de3e
Add "forgetCards" and "relearnCards" (#234)
* Add "forgetCards" and "relearnCards"

* Add unit tests

Co-authored-by: Tsung-Po Sun <tsungpo.sun@smartnews.com>
2021-03-04 20:02:57 -08:00
Venkata Ramana
131a1c7cfc
Added findAndReplaceInModels (#228)
* added findAndReplaceInModels api call

* added documentation for findAndReplaceInModels

* added findAndReplaceInModels api call

* updatd findAndReplaceInModels function

* added unit test for findAndReplaceInModels in models

* updated findAndReplaceInModels

* added unit test for findAndReplaceInModels

* removed 'all_models' in findAndReplaceInModels
2021-02-26 21:17:51 -08:00
ripose-jp
aaf6b3a55b
Fixed bug where hash was calculated using the wrong variable (#235) 2021-02-26 21:16:39 -08:00
David Sauerwein
7ef10e92da
Allow to add media to notes by file path or base64 encoded data (#230)
* Allow to add media to notes by file path or base64 encoded data

* Adjust Media Actions documentation

* Adjust Note Actions documentation
2021-02-20 10:04:25 -08:00
Kirill Salnikov
4d2ab991c2
Fix bug in loadProfile method (#229)
Bug: if sync is enabled for profile, then we have alot of recursive
calls to loadProfile method because main window is still active until
sync is ended. And this freezes Anki app.
2021-02-07 17:40:44 -08:00
a8273d0e38 Fix tests 2021-01-18 21:03:27 -08:00