Commit Graph

35 Commits

Author SHA1 Message Date
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
7e221f0acf update auto-sync code 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
38508c3ad7 use keyword args for calls with more than one argument 2020-05-24 09:12:47 +10:00
Damien Elmes
eec3fcf87a use qconnect everywhere, and fix some typing issues
a step towards check_untyped_defs in aqt, but there's still 100+
issues to resolve
2020-05-04 13:23:08 +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
b1a8107aa1 formatting 2020-03-23 19:54:01 +10:00
Damien Elmes
f889616ef1 don't pop up network errors for media sync
log them instead
2020-03-23 19:06:13 +10:00
雷宇辰
a2604b80f5
Use anki.consts.SYNC_BASE instead of hardcoded url
Use `anki.consts.SYNC_BASE` instead of hardcoded url in function `MediaSyncer._endpoint`
2020-03-06 18:55:07 +08:00
Alan Du
a63c9e5a9a Apply mypy improvements to aqt 2020-02-26 22:27:58 -05:00
Damien Elmes
0c49431719 FString -> TR 2020-02-27 12:25:19 +10:00
Damien Elmes
e439e8cdec add string for media log title, and add button in prefs to access it 2020-02-27 12:22:24 +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
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
d612aa0945 localize some error messages 2020-02-17 11:38:22 +10:00
Damien Elmes
67a741958c use new i18n infrastructure for more media check / media sync strings 2020-02-17 10:18:20 +10:00
Damien Elmes
f6a881f950 pass progress back as translated string(s) 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
d38c2c12d5 autosync media every ~15 minutes 2020-02-17 08:40:17 +10:00
Damien Elmes
12d009e503 autosync media on close 2020-02-17 08:40:17 +10:00
Damien Elmes
fdd850c0f0 add extra hook for media sync start/stop 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
c329759a88 catch DB errors in sync 2020-02-17 08:40:16 +10:00
Damien Elmes
ec9abf1ce5 pass in endpoint 2020-02-17 08:40:16 +10:00
Damien Elmes
0c124188cd catch network errors 2020-02-17 08:40:16 +10:00
Damien Elmes
93c768cab9 move more logic into mediasync.py, handle auth errors 2020-02-17 08:40:16 +10:00
Damien Elmes
347ac80086 remove unused code 2020-02-17 08:40:16 +10:00
Damien Elmes
cb0ce4146f show spinner when media sync active, click to reveal dialog 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