Commit Graph

328 Commits

Author SHA1 Message Date
Damien Elmes
48c121e4f3 filtered decks w/ scheduling disabled in v3 now log reviews 2021-08-19 20:25:29 +10:00
Damien Elmes
7ba35b7249 support updating multiple notes in one transaction/undo op 2021-08-02 17:07:26 +10:00
Damien Elmes
88a3fd8d7b support updating multiple cards in one transaction/undo op 2021-08-02 16:59:02 +10:00
RumovZ
c0dd769090 Skip new notetype checks when importing apkg 2021-07-28 21:46:51 +02:00
RumovZ
f2f19e8b45 Remove native HelpPage enum
Also remove oneof from pb enum and handle strs in Python.
2021-07-22 16:32:49 +02:00
RumovZ
55e1f178ef Add links.proto and backend module 2021-07-22 10:05:38 +02:00
Damien Elmes
bf507cca98 move from Python's URI escaping to IRI escaping in Rust
Should make non-Latin text readable in the HTML editor, without the
breakages reverted in the previous change.
2021-07-16 10:38:00 +10:00
Damien Elmes
0e7411188b configs.proto plural workaround no longer necessary 2021-07-11 19:35:18 +10:00
Damien Elmes
e61a611af7 rename Config in protobuf to avoid conflict with module name
+ use the enum directly, instead of wrapping it in an object

Python code retains the old "Config" name.
2021-07-11 19:27:08 +10:00
Damien Elmes
372a28be29 rename workspace
I'd forgotten that Bazel "helpfully" adds __init__.py files into folders
that match the workspace name, breaking imports.
2021-07-10 23:58:53 +10:00
Damien Elmes
185e9acd22 split out remaining tags, stats, media and rendering 2021-07-10 23:16:18 +10:00
Damien Elmes
35b059ecdb split out sync, search, scheduler & config 2021-07-10 21:33:12 +10:00
Damien Elmes
9e0a295ab9 split out decks, deckconfig, notes, notetypes 2021-07-10 20:44:22 +10:00
Damien Elmes
18851ace47 split out cards and collection 2021-07-10 19:52:31 +10:00
Damien Elmes
616db33c0e refactor protobuf handling for split/import
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:

- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.

The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.

The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.

Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
2021-07-10 19:17:05 +10:00
Damien Elmes
80b98e0db8 move protobuf into separate folder in preparation for multiple files 2021-07-09 21:02:40 +10:00
Damien Elmes
e0817c004d move backend.proto into rslib/ 2020-11-02 16:28:31 +10:00
Damien Elmes
aea0a6fcc6 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
Damien Elmes
56ceb6ba76 set_deck() 2020-09-03 17:42:46 +10:00
Damien Elmes
b65174a026 move card sorting and resetting to backend 2020-09-03 15:54:15 +10:00
Damien Elmes
ce49ca9401 log manual reschedule, but ignore the log entry in the stats 2020-09-02 17:56:23 +10:00
Damien Elmes
39212a38aa move reschedCards() to backend 2020-09-02 17:56:23 +10:00
Damien Elmes
8f9037cf0f move filtered deck empty/fill to backend
emptying of individual card ids still to be done
2020-09-02 17:56:23 +10:00
Damien Elmes
a834df60ce rename some card+note fields in backend 2020-09-01 10:24:38 +10:00
Damien Elmes
d3dede057a move bury/suspend into backend 2020-09-01 10:24:38 +10:00
Damien Elmes
ccfa989c62 move unbury/unsuspend routines into backend 2020-09-01 10:24:38 +10:00
Damien Elmes
e5685254c6 reimplement congrats screen in Rust+Typescript 2020-09-01 10:24:38 +10:00
Damien Elmes
469272659f fix hour graph not handling timezones west of UTC
https://forums.ankiweb.net/t/statistics-bugs-after-update-2-1-5-to-2-1-29/1620
2020-07-31 13:33:41 +10:00
Damien Elmes
f7a7c95fc0 fix early reviews not appearing in graph
https://forums.ankiweb.net/t/differences-between-new-and-old-stats-2-1-28/1602
2020-07-31 13:33:41 +10:00
Damien Elmes
19541c4a9d fix deck tree with a day delta, and support arbitrary timestamps 2020-07-06 19:16:03 +10:00
Damien Elmes
28a6755c75 i18n card counts 2020-06-29 15:48:01 +10:00
Damien Elmes
41d77b0255 get i18n working in typescript 2020-06-29 15:48:01 +10:00
Damien Elmes
329186f140 qt's js code now shares ts/node_modules; more graph work 2020-06-29 15:48:01 +10:00
Damien Elmes
0cab26d40c cards added graph 2020-06-29 15:48:01 +10:00
Damien Elmes
82568a1f3e experiment with exposing raw card/revlog data to frontend 2020-06-29 15:48:00 +10:00
Damien Elmes
510f8b86cb some initial work on updating the graphs 2020-06-29 15:48:00 +10:00
Damien Elmes
3ca4a13cf2 protobuf package should be in PascalCase 2020-06-29 15:48:00 +10:00
Damien Elmes
b51f03085e migrate card stats to backend
Currently this renders the HTML directly like the previous Python
implementation - doing it in JS would probably make more sense in the
future.
2020-06-15 17:22:16 +10:00
Damien Elmes
7c444b4d35 add progress to db check 2020-06-08 21:07:36 +10:00
Damien Elmes
1fe18718f7 add daily count updating to backend 2020-06-05 19:49:53 +10:00
Damien Elmes
fee6cdff22 support generating a due tree for a different date 2020-06-05 09:38:31 +10:00
Damien Elmes
4a69b55a90 add note/card removal to backend 2020-06-04 18:21:04 +10:00
Damien Elmes
4d7e23111e change sync label to indicate sync state
- blue for normal sync, red for full sync required
- refactor status fetching code so we don't hold a collection lock
during the network request, which slows things down
- fix sync spinner restarting when returning to deck list
2020-06-02 13:23:01 +10:00
Damien Elmes
90e19daec2 handle aborting normal sync
- Use a separate abort handle, as the media sync is running
in the background and we need to be able to target them separately.
The current progress handling is going to need a rethink if we introduce
any other background tasks in the future.
- Roll back the transaction when interrupting.
2020-06-01 13:57:10 +10:00
Damien Elmes
c6f0710ce7 report normal sync progress
Also:
- provide a way for the progress handler to skip the throttling so that
we can ensure progress is updated at the end of a stage
- show 'checking' at the end of full sync
2020-06-01 13:57:10 +10:00
Damien Elmes
0e5b7da62a login/full up/full down plugged in 2020-06-01 13:57:10 +10:00
Damien Elmes
ee6d7f82e7 rework progress handling
- client now polls status instead of backend pushing it
- supports multiple threads
- update throttling happens in one place
2020-06-01 13:57:10 +10:00
Damien Elmes
b254b1f722 another snapshot of sync work
progress handler is going to need to be reworked to function across
threads
2020-06-01 13:57:10 +10:00
Damien Elmes
f10d0ee0cb more syncing work
no checks yet
2020-06-01 13:57:10 +10:00
Damien Elmes
c8d13209cd move dupe check to backend 2020-05-24 19:48:56 +10:00
Damien Elmes
38508c3ad7 use keyword args for calls with more than one argument 2020-05-24 09:12:47 +10:00
Damien Elmes
89dde3aeb0 migrate the remaining methods 2020-05-24 08:36:50 +10:00
Damien Elmes
4bf8175bcb migrate more scheduling/media/etc
almost there
2020-05-23 21:34:19 +10:00
Damien Elmes
a105037ec9 migrate notetypes, update GIL list 2020-05-23 20:43:55 +10:00
Damien Elmes
6710e3d528 add some more newtypes to the RPC defs 2020-05-23 16:58:01 +10:00
Damien Elmes
95735f106a migrate cards and notes 2020-05-23 16:19:48 +10:00
Damien Elmes
7550e6241c migrate decks and dconf methods 2020-05-23 15:09:16 +10:00
Damien Elmes
081a61a438 more methods 2020-05-23 14:01:36 +10:00
Damien Elmes
175afa9fee migrate more methods to service 2020-05-22 22:09:33 +10:00
Damien Elmes
9c20d9a02b start reworking protobuf handling
Will allow us to cut down on boilerplate by automatically generating
code from RPC service definitions
2020-05-22 20:56:15 +10:00
Damien Elmes
68465ae07b protobuf tidyups 2020-05-18 09:26:14 +10:00
Damien Elmes
6114836484 move deck config to protobuf 2020-05-17 13:28:41 +10:00
Damien Elmes
54670580ad add option to limit deck tree counts to a particular node 2020-05-17 08:38:49 +10:00
Damien Elmes
f2086fc2e3 switch to new deck tree in deck browser
Saves us having to look up collapsed/filtered as we render, and gives
us type completion.
2020-05-16 10:52:14 +10:00
Damien Elmes
964a69e54e handle default deck and filtered deck suppression in the backend 2020-05-15 21:21:10 +10:00
Damien Elmes
2ac33500eb fetch stock notetypes from backend 2020-05-15 17:08:24 +10:00
Damien Elmes
782911471b add "fill empty" checkbox 2020-05-14 20:58:45 +10:00
Damien Elmes
f23eb350e4 drop availOrds(), and use backend for getting cloze numbers 2020-05-14 12:14:00 +10:00
Damien Elmes
6680cdf1d3 update the card layout screen
- changes are now committed in bulk when closing the dialog,
and can be canceled
- it's not necessary to save the note to the database to preview it
- duplicate fields are now shown as duplicates in the top list
- redraw preview more quickly
- use + instead of _ when deduplicating names, as the latter is a
glob character
2020-05-13 17:24:49 +10:00
Damien Elmes
826cbb0108 fetch template and note fields in backend during normal card render
Saves having to serialize the note fields and q/a templates, which
is particularly a win when rendering question/answer in the browse
screen.

Also some work towards being able to preview notes without having to
commit them to the database.
2020-05-13 10:38:49 +10:00
Damien Elmes
9317cee9ba handle scheduling preferences in the backend 2020-05-12 21:13:34 +10:00
Damien Elmes
ea4f150455 fetch timing_today() params in backend 2020-05-12 21:13:34 +10:00
Damien Elmes
eee0d7e92f switch server back into a bool and rely on config 2020-05-12 21:13:34 +10:00
Damien Elmes
70cc1699a6 rewrite DB check
- notes with wrong field count are now recovered instead of
being deleted
- notes with missing note types are now recovered
- notes with missing cards are now recovered
- recover_missing_deck() still needs implementing
- checks required
2020-05-12 21:13:34 +10:00
Damien Elmes
2413f286b1 bulk tag add/remove/update; canonify on note save
also remove the tag list updated hook - we'll need a better solution in
the future than having the library code call back into the GUI code
2020-05-12 21:13:34 +10:00
Damien Elmes
a7a485d550 use backend for genCards() and updateFieldCache() 2020-05-12 21:13:34 +10:00
Damien Elmes
8b557ec382 move find&replace to backend 2020-05-12 21:13:34 +10:00
Damien Elmes
238441f2d9 use the backend for the deck due tree
- approx 3x faster on a large test deck
- counts are no longer capped to 1000 in the tree
2020-05-12 21:13:33 +10:00
Damien Elmes
5fb5338d97 add missing decks in backend
- need to compare parents with unicode case folding
- duplicate check enforced by the DB
2020-05-12 21:13:33 +10:00
Damien Elmes
67421e02ec add browserCollapsed as part of tree build 2020-05-12 21:13:33 +10:00
Damien Elmes
a88bc1e836 speed up browser load by rendering deck tree in Rust and skipping counts 2020-05-12 21:13:33 +10:00
Damien Elmes
f592672fa9 add separate decks table, and start on moving deck handling to Rust
The Python tests are passing, but there are still a number of issues
to work through, and the table/protobuf schema is not yet finalized.
2020-05-12 21:13:33 +10:00
Damien Elmes
6e1d2990a0 remove unused _updateRequired and associated code 2020-05-12 21:13:33 +10:00
Damien Elmes
bee0eb1264 empty card handling 2020-05-12 21:13:33 +10:00
Damien Elmes
6cc2bdbf87 start on exposing notes and individual note type methods
changes to note:

- add_note() now takes a provided deck id instead of looking it up
in the notetype
- note type use counts fetched using a single table scan
- make sure note type changes are persisted
- expose optionalness of ords in templates and fields json
2020-05-12 21:13:33 +10:00
Damien Elmes
527c8bf867 embed enum to avoid conflicts 2020-05-12 21:13:33 +10:00
Damien Elmes
a17ddfdccd native struct for CardTemplate 2020-05-12 21:13:33 +10:00
Damien Elmes
9080f602b1 native struct for NoteField
ord is made optional so we can keep track of changes in the future
2020-05-12 21:13:33 +10:00
Damien Elmes
d6646a6db5 expose stock notetypes 2020-05-12 21:13:33 +10:00
Damien Elmes
540892639f add stock note types in backend 2020-05-12 21:13:33 +10:00
Damien Elmes
805a3a710e split note types into separate tables
- store the config in protobuf instead of json
- still loading+saving in bulk for now
- code using the schema11 structs needs to be migrated
2020-05-12 21:13:33 +10:00
Damien Elmes
b55742509a embed sort kind enum to avoid future namespace conflicts 2020-04-14 20:31:10 +10:00
Damien Elmes
4c7210b430 (de)serialize decks in backend 2020-04-09 12:41:59 +10:00
Damien Elmes
36ec7830a9 load/save note types in backend
This allows us to normalize bad data, and is the first step towards
splitting note types into separate tables.
2020-04-08 10:05:07 +10:00
Damien Elmes
75faba1667 add separate json error 2020-04-06 16:29:31 +10:00
Damien Elmes
dc62d5072c use bytes for deck config proto 2020-04-06 15:39:47 +10:00
Damien Elmes
164bd29438 use bytes for config proto 2020-04-06 15:39:47 +10:00
Damien Elmes
676f4e74a8 store config in separate DB table
- mtime is tracked on each key individually, which will allow
merging of config changes when syncing in the future
- added col.(get|set|remove)_config()
- in order to support existing code that was mutating returned
values (eg col.conf["something"]["another"] = 5), the returned list/dict
will be automatically wrapped so that when the value is dropped, it
will save the mutated item back to the DB if it's changed. Code that
is fetching lists/dicts from the config like so:

col.conf["foo"]["bar"] = baz
col.setMod()

will continue to work in most case, but should be gradually updated to:

conf = col.get_config("foo")
conf["bar"] = baz
col.set_config("foo", conf)
2020-04-06 15:39:47 +10:00
Damien Elmes
ac4284b2de update tag handling
- tag list stored in a separate DB table
- non-wildcard searches now do full unicode case folding
(eg tag:masse matches 'Maße')
- wildcard matches do simple unicode case folding
- some functions haven't been updated yet, so ascii folding will
continue to be used in some operations
2020-04-03 19:34:46 +10:00
Damien Elmes
333d0735ff preserve mtime/usn when syncing deck config, and add snake_case names 2020-04-03 19:34:46 +10:00
Damien Elmes
c9da4bc1a6 allow aborting a media sync while http req in flight
The progress handling code needs a rethink, as we now have two separate
ways to flag that the media sync should abort. In the future, it may
make sense to switch to polling the backend for progress, instead of
passing a callback in.
2020-04-01 09:49:25 +10:00
Damien Elmes
35c03af520 split deck config into separate SQL table
- on collection load, the schema is upgraded to 12
- on collection close, the changes are reversed so older clients
can continue to open the collection
- in the future, we could potentially skip the reversal except
when exporting/doing a full sync
- the same approach should work for decks, note types and tags in the
future too
- the deck list code needs updating to cache the deck confs for the
life of the call
2020-03-30 20:01:16 +10:00
Damien Elmes
004cc2b5f8 move deck conf handling to backend 2020-03-30 14:39:46 +10:00
Damien Elmes
84b84ae31c use add_card() 2020-03-27 15:11:07 +10:00
Damien Elmes
7f16f436c3 handle mtime/usn bump in backend, and tweak integer sizes 2020-03-26 20:55:04 +10:00
Damien Elmes
47504245dc update_card() 2020-03-26 18:54:20 +10:00
Damien Elmes
7ddaf93f7a use backend to get card 2020-03-26 17:47:43 +10:00
Damien Elmes
69d8cdd9ed use backend for v1 and v2 cutoff calculations
this should also fix the CI failures, which were happening because
the datetime module wasn't matching the shifted time.time()
2020-03-22 14:28:26 +10:00
Damien Elmes
f28e57a367 add enum for controlling sort order
eg col.find_cards("", order=BuiltinSortKind.CARD_DUE)
2020-03-22 12:59:24 +10:00
Damien Elmes
a5787781d7 add note searching 2020-03-21 09:00:05 +10:00
Damien Elmes
5debd3e0f8 add the ability to provide a custom sort order; use backend for find 2020-03-21 07:55:21 +10:00
Damien Elmes
bca5f2ddff prototype of integration
no ordering yet, and no tests
2020-03-20 21:15:23 +10:00
Damien Elmes
874bc085fe support opening and closing the DB while keeping backend alive
This is safer than just dropping the backend, as .close() will
block if something else is holding the mutex. Also means we can
drop the extra I18nBackend code.

Media syncing still needs fixing.
2020-03-20 21:15:23 +10:00
Damien Elmes
1322d8c617 make the collection optional 2020-03-20 21:15:23 +10:00
Damien Elmes
b51e575a9d drop the protobuf prototype 2020-03-20 21:15:23 +10:00
Damien Elmes
04ca8ec038 initial work on DB handling in Rust
committing the Protobuf implementation for posterity, but will replace
it with json, as Protobuf measures about 6x slower for some workloads
like 'select * from notes'
2020-03-20 21:15:23 +10:00
Damien Elmes
0f4c3ab611 add restore media action 2020-03-10 13:35:09 +10:00
Damien Elmes
6ad2a1f9a3 add empty trash action in aqt 2020-03-10 12:49:40 +10:00
Damien Elmes
3d3fe17132 add missing newline to .proto 2020-03-09 18:58:49 +10:00
Damien Elmes
ba4fe71eba make logging explicit, and support logging to a file 2020-02-29 20:44:01 +10:00
Damien Elmes
b610ff781f info is superfluous 2020-02-27 10:53:49 +10:00
Damien Elmes
644670d0d6 return a localized error for all error kinds
some errors are not yet localized, but now the Python code
doesn't need to think about which property to use
2020-02-27 10:46:24 +10:00
Damien Elmes
71c18a9372 separate out infallible and fallible commands in .proto 2020-02-27 08:46:09 +10:00
Damien Elmes
fbbbbd6a7d tweak rounding
- avoid rounding minutes
- round the seconds taken in the card info screen
- provide different precise and imprecise modes, since we need
to display seconds to multiple decimals in some areas
2020-02-25 17:29:06 +10:00
Damien Elmes
9f7c3a2fcf expand clozes before rendering LaTeX
https://anki.tenderapp.com/discussions/ankidesktop/39071-latex-media-windows-version-2121-683b7983-fail-rendering-latex
2020-02-24 18:34:08 +10:00
Damien Elmes
0e931808c9 translations no longer require an open collection 2020-02-23 14:57:02 +10:00
Damien Elmes
4430c67069 rework Fluent handling
- all .ftl files for a language are concatenated into a single file
at build time
- all languages are included in the binary
- external ftl files placed in the ftl folder can override the
built-in definitions
- constants are automatically generated for each string key
- dropped the separate StringsGroup enum
2020-02-23 13:22:50 +10:00
Damien Elmes
6fd3d1e8b4 add deck config category 2020-02-21 20:53:20 +10:00
Damien Elmes
972aee5f7a add next learning due time + remaining count to congrats screen
https://anki.tenderapp.com/discussions/ankidesktop/38000-v2-scheduler-learning-cards
2020-02-21 19:54:50 +10:00
Damien Elmes
49fe080636 add studied_today(), move to statistics.ftl 2020-02-21 18:01:15 +10:00
Damien Elmes
2fc15d0d3a add non-abbreviated timespan translation; update existing short=True calls
- drop the '5m3s' special casing done in the card stats screen, and
just use decimals
- change alignment of the review log so that the non-abbreviated
spans are easier to read
2020-02-21 15:29:38 +10:00
Damien Elmes
99c07cfdcb move answer_button_time to the backend, split sched into separate module 2020-02-21 15:29:38 +10:00
Damien Elmes
232a8625bf move answer button labels into fluent 2020-02-21 15:29:38 +10:00
Damien Elmes
370bb38b8b update to latest fluent-rs and add basic locale-aware decimals
- git version pinned at the moment until the concurrency fix
lands in 0.10.2
- currently float values are hard-coded at 2 decimal places;
we should switch to using NUMBER() in the future
2020-02-21 15:29:38 +10:00
Damien Elmes
1524e7dcac split "Due" into three different contexts for translators 2020-02-17 14:41:01 +10:00
Damien Elmes
d612aa0945 localize some error messages 2020-02-17 11:38:22 +10:00
Damien Elmes
c395003def expose translations to Python 2020-02-17 08:40:17 +10:00
Damien Elmes
f6a881f950 pass progress back as translated string(s) 2020-02-17 08:40:17 +10:00
Damien Elmes
cc99f221be expose StringsGroup enum in protobuf 2020-02-17 08:40:17 +10:00
Damien Elmes
33367c8edf make template errors translatable 2020-02-17 08:40:17 +10:00
Damien Elmes
5c8e3df612 include report in MediaCheckOutput 2020-02-17 08:40:17 +10:00
Damien Elmes
dc9362d4ed add i18n support to Rust code using Fluent 2020-02-17 08:40:17 +10:00
Damien Elmes
d73fec3280 shorten add_file_to_media_folder 2020-02-17 08:40:17 +10:00
Damien Elmes
4c0f216df2 use media.trash for unused media deletion as well 2020-02-17 08:40:17 +10:00
Damien Elmes
7f365faf3f add extract_latex to backend; use it for latex build 2020-02-17 08:40:17 +10:00
Damien Elmes
6f158c8555 plug new media check in 2020-02-17 08:40:17 +10:00
Damien Elmes
aa832e9117 backend stores media folder/db locations; don't need to pass them in 2020-02-17 08:40:17 +10:00
Damien Elmes
7ae6244f6a log media DB change registration progress, and allow aborting it 2020-02-17 08:40:17 +10:00
Damien Elmes
5fe1bfc5b4 simplify code by accumulating stats at the source 2020-02-17 08:40:17 +10:00
Damien Elmes
98279add15 defer errors on upload to media check 2020-02-17 08:40:17 +10:00
Damien Elmes
6a64c8dfcc use enums for some common errors 2020-02-17 08:40:16 +10:00
Damien Elmes
ea4de9a6de connect media sync progress to Python, add a progress dialog 2020-02-17 08:40:16 +10:00
Damien Elmes
c82cff3836 add progress hook to media sync 2020-02-17 08:40:16 +10:00
Damien Elmes
f20b5b8db6 media sync working, but unpolished 2020-02-17 08:40:16 +10:00
Damien Elmes
01470c4854 backend init can now fail, and update media db when file is added
- Adding files inside Anki now updates the media DB, so a full file
scan at sync time is no longer required if no other changes have been
made.
- Use a protobuf message for backend initialization, and return a
string error if initialization fails.
2020-02-17 08:40:16 +10:00
Damien Elmes
056c2d3fd1 initial rs implementation of media database 2020-02-17 08:40:16 +10:00
Damien Elmes
4096d21c07 add add_file() and write_data() 2020-02-17 08:40:16 +10:00
Damien Elmes
bd96c27096 show which side the template error occurred on 2020-02-08 11:54:08 +10:00
Damien Elmes
c075191697 reuse reveal_cloze_text() for LaTeX cloze expansion 2020-01-28 07:40:44 +10:00
Damien Elmes
21cbb5a766 support speed control in tts tags 2020-01-26 14:31:07 +10:00
Damien Elmes
17ebdfc099 extract and flag AV tags as part of the render process
We can now show replay buttons for the audio contained in {{FrontSide}}
without having to play it again when the answer is shown.

The template code now always defers FrontSide rendering, as it wasn't
a big saving, and meant the logic had to be implemented twice.
2020-01-24 11:06:11 +10:00
Damien Elmes
4fb227ca4c added flag_av_tags() for replay button support 2020-01-21 14:44:27 +10:00
Damien Elmes
c713683f63 add rank handling to TTS; parse TTS args in get_av_tags() 2020-01-21 12:41:37 +10:00
Damien Elmes
0942ffbff6 add a simple TTS field filter
This simply wraps the field in extra text that the frontend will
deal with. Also added some helpers for extracting and stripping
audio and TTS tags from the rendered text.
2020-01-20 19:16:24 +10:00
Damien Elmes
bead03e858 drop plus_one test 2020-01-17 18:54:38 -07:00
Damien Elmes
12c60f20fe _localOffsetForDate() was broken
It was including the elapsed time of day when calculating
the offset, leading to incorrect results
2020-01-17 18:52:36 -07:00
Damien Elmes
9bb0348fdd more template rendering tweaks
- The front and back are rendered in one call now. If the front
side contains no custom filters, we can bake {{FrontSide}} into the
rear side. If it did contain custom filters, we return the partially
complete rear template instead, and the calling code can inject
the FrontSide in after it has been fully rendered.

- Instead of modifying "cloze" into something like "cq-2", the card
ordinal and whether we're rendering the question or answer are now
passed in to the rendering filters as context.

- The Rust code doesn't need to support filter names split on '-'
anymore.

- Drop the "Show" part of hint descriptions so i18n support can be
deferred.

- Ignore blank filter names caused by user using two colons instead
of one.

- Fixed hint field and text transposition.
2020-01-12 21:34:07 +10:00
Damien Elmes
3f724e5c98 replace fields and apply standard filters in rslib
The filters still need to be implemented.
2020-01-10 18:02:26 +10:00
Damien Elmes
f7ff0d1c17 flatten->render; pass field content in
This is paving the way to move the standard filters into Rust.

Non-empty fields are now determined in Rust, using a single regex
instead of the overkill stripHTMLMedia(). The old implementation
has been moved into the Pystache code for now.
2020-01-10 14:59:29 +10:00
Damien Elmes
a5613523ee rework new timezone code
We now store the UTC offset that was in effect at creation time,
and use that to determine the starting date.
2020-01-09 16:58:27 +10:00
Damien Elmes
0087eee6d9 handle conditional replacement in Rust
This extends the existing Rust code to handle conditional
replacement. The replacement of field names and filters to text
remains in Python, so that add-ons can still define their own
field modifiers.

The code is currently running the old Pystache rendering and the
new implementation in parallel, and will print a message to the
console if they don't match. If you notice any problems, please
let me know.
2020-01-08 20:28:04 +10:00
Damien Elmes
8df5f49c52 add some more protobuf messages 2020-01-06 12:18:20 +10:00
Damien Elmes
0bfc90f52f update readme, remove submodule readmes 2020-01-04 12:21:58 +10:00
Damien Elmes
b23b6fbe35 move the separate components back into this monorepo
Earlier today I pushed a change that split this code up into multiple
repos, but that has proved to complicate things too much. So we're
back to a single repo, except the individual submodules are better
separated than they were before.

The README files need updating again; I will push them out soon.

Aside from splitting out the different modules, the sound code has
moved from from anki to aqt.
2020-01-02 19:43:19 +10:00
Damien Elmes
92673c99d8 rework the new scheduler's rollover/day counting code
The previous implementation interpreted the creation date as a local
time, and applied the rollover to that. If the initial creation date
was around midnight local time, even a one hour change due to daylight
savings could result in Anki skipping or doubling up on a day. To
address this, the rollover is now applied to the current time instead
of the creation date.

The new code needs the current time passed into it. This makes it
easier to unit test, and for AnkiWeb to be able to use the user's local
timezone.

The new timezone code is currently disabled, as this code needs to be
ported to all clients before it can be activated.
2019-12-27 21:53:20 +10:00
Damien Elmes
3e1b474dca bridge->backend 2019-12-25 08:59:33 +10:00
Damien Elmes
3ce4d5fd3d compute template requirements in Rust
on a 100 field template, what took ~75 seconds now takes ~3 seconds.
2019-12-24 19:57:54 +10:00
Damien Elmes
252a0cb54f use protobuf for python/rust bridge
If we go ahead with betterproto on the Python side, it will mean
bumping the minimum Python dependency to 3.7.
2019-12-24 19:57:54 +10:00