Commit Graph

186 Commits

Author SHA1 Message Date
Damien Elmes
e0951e4cfe add 'new #' prefix to new cards in the due column 2020-02-18 11:16:15 +10:00
Damien Elmes
683b7983f8 pin coarsetime for now, as .12 requires Sierra 2020-02-17 17:55:39 +10:00
Damien Elmes
44053f0715 fix deletion notices being sent unnecessarily 2020-02-17 17:21:58 +10:00
Damien Elmes
1524e7dcac split "Due" into three different contexts for translators 2020-02-17 14:41:01 +10:00
Damien Elmes
771452c227 media check required message is no longer required 2020-02-17 13:51:33 +10:00
Damien Elmes
cb9ebf748c match older string 2020-02-17 13:41:02 +10:00
Damien Elmes
63f08535e9 add some more comments 2020-02-17 11:43:18 +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
0217cff099 add some comments to card-template-rendering.ftl 2020-02-17 09:06:54 +10:00
Damien Elmes
c395003def expose translations to Python 2020-02-17 08:40:17 +10:00
Damien Elmes
4fe47b7be4 cache i18n categories 2020-02-17 08:40:17 +10:00
Damien Elmes
9247e5de7d don't hard-code available ftl languages
Instead of trying to define which languages we support, just check
if an appropriate folder is available on disk. This allows users
to drop their own translations into the locale folder and have things
just work.
2020-02-17 08:40:17 +10:00
Damien Elmes
8cd76bee92 wrap i18n struct in a shared mutex so we can start caching 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
d1e587fca9 add ftl to the build process, and a sync-git script
also
- ensure po files are checked when updated
- add start of sync.ftl
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
61b9f70ab9 bump version 2020-02-17 08:40:17 +10:00
Damien Elmes
319390f0c6 more frequent progress updates 2020-02-17 08:40:17 +10:00
Damien Elmes
b8e516b47c rename card-templates.ftl 2020-02-17 08:40:17 +10:00
Damien Elmes
0cc1938657 move empty card check into template code 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
ee27711b65 remove redundant test_ prefix 2020-02-17 08:40:17 +10:00
Damien Elmes
23483b0a57 mark deletions in media DB when files are deleted 2020-02-17 08:40:17 +10:00
Damien Elmes
1b0e8485fd ignore errors when file to delete is already gone
May be marked as pending upload or in media check screen, then removed
by user.
2020-02-17 08:40:17 +10:00
Damien Elmes
df201c164f make sure we don't leave a trailing dot or space when truncating 2020-02-17 08:40:17 +10:00
Damien Elmes
1ff6cbc54d make sure renames generated during sync don't get immediately removed 2020-02-17 08:40:17 +10:00
Damien Elmes
d394aed5fd don't filter out invalid filenames when we're sending them as a deletion 2020-02-17 08:40:17 +10:00
Damien Elmes
44a1a5f987 fix the wrong named being returned when renaming in sync 2020-02-17 08:40:17 +10:00
Damien Elmes
c3f22364c9 pt->pb for consistency with rsbackend.py 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
c890ef871e include LaTeX png/svg files when checking for unused media 2020-02-17 08:40:17 +10:00
Damien Elmes
4cca3ecef5 files with leading underscore are ignored 2020-02-17 08:40:17 +10:00
Damien Elmes
9913dcd5dc include normalized filenames in the rename list
Since they'll need to be uploaded on the next sync, better not to
hide them from the list
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
c1939aebd1 when adding hash suffix, need length in hex, not bytes 2020-02-17 08:40:17 +10:00
Damien Elmes
fabfcb0338 gather field references in Rust; media check now mostly complete 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
58da7988c3 catch trailing space/period as well 2020-02-17 08:40:17 +10:00
Damien Elmes
5ccdeb46b8 check [ instead of con in unit test, so test works on Windows as well 2020-02-17 08:40:17 +10:00
Damien Elmes
dad8108feb run the TZ test only on Macs 2020-02-17 08:40:17 +10:00
Damien Elmes
87c73741d0 test shouldn't depend on dentry order 2020-02-17 08:40:17 +10:00
Damien Elmes
314e643140 expire media trash after a week 2020-02-17 08:40:17 +10:00
Damien Elmes
e9f51a694c use our own trash folder instead of using the system trash
the trash crate was invoking external commands on Macs and Linux
which is slow and likely to fall over if a large number of files need
to be deleted at once.
2020-02-17 08:40:17 +10:00
Damien Elmes
660a9bf7ad tidying 2020-02-17 08:40:17 +10:00
Damien Elmes
3350b4fa69 hold the DB open for the duration of the check 2020-02-17 08:40:17 +10:00
Damien Elmes
cee8d4b789 DB check
Working, but should be refactored so media DB not re-opened
each time a file is renamed.
2020-02-17 08:40:17 +10:00
Damien Elmes
8aa2984d04 factor entry code out for later 2020-02-17 08:40:17 +10:00
Damien Elmes
ce241f9756 mgr didn't need to be mutable 2020-02-17 08:40:17 +10:00
Damien Elmes
f7c26724f3 nfc helper 2020-02-17 08:40:17 +10:00
Damien Elmes
933b7a9a34 ignore 0 byte files when picking up changes 2020-02-17 08:40:17 +10:00
Damien Elmes
4fa4a5077c don't add non-normalized files to media DB 2020-02-17 08:40:17 +10:00
Damien Elmes
22793c8cd6 media table doesn't need rowid 2020-02-17 08:40:17 +10:00
Damien Elmes
1ca11e4268 dirty index doesn't need to cover false case 2020-02-17 08:40:17 +10:00
Damien Elmes
bf50f88540 handle read errors during zip build 2020-02-17 08:40:17 +10:00
Damien Elmes
eddf9fdc44 clean up invalid media DB entries on the fly, instead of requiring DB check 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
e5f9ed5a5b move change tracking into separate file 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
4289f7a02a move sync_media() into MediaManager 2020-02-17 08:40:17 +10:00
Damien Elmes
fb8f753d2d update rslib version automatically 2020-02-17 08:40:17 +10:00
Damien Elmes
4c8ceeb809 remove duplicate method 2020-02-17 08:40:17 +10:00
Damien Elmes
32a3b5a020 tidy up sync.rs 2020-02-17 08:40:17 +10:00
Damien Elmes
9067bf98bd handle concurrent modifications and ankiweb terminating early 2020-02-17 08:40:17 +10:00
Damien Elmes
e0511c560b update dirmod as files added during sync 2020-02-17 08:40:17 +10:00
Damien Elmes
631bdc2a1e add debug line 2020-02-17 08:40:17 +10:00
Damien Elmes
1f35ff0bd5 fix force_resync() 2020-02-17 08:40:17 +10:00
Damien Elmes
23f5c7cb9b rename non-normalized filenames when downloading 2020-02-17 08:40:17 +10:00
Damien Elmes
0fb70dab0f comply with manylinux wheel requirements, and vendor sqlite on Windows 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
0f7fc1e960 add proper version 2020-02-17 08:40:16 +10:00
Damien Elmes
6a64c8dfcc use enums for some common errors 2020-02-17 08:40:16 +10:00
Damien Elmes
8d97f862a4 defer media DB load until media action performed
This means a corrupt media DB will not prevent collection load.
2020-02-17 08:40:16 +10:00
Damien Elmes
ec9abf1ce5 pass in endpoint 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
d0ee95c4cd send removed files to the trash
The way the trash crate implements deletion on a Mac is ugly, and
we may need to look into alternatives.
2020-02-17 08:40:16 +10:00
Damien Elmes
5e5906f183 store sync state in a struct, and reuse ctx across methods 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
1974981b94 bump nightly for the unwrap source line fix 2020-02-17 08:40:16 +10:00
Damien Elmes
ec8a91b493 more refactoring 2020-02-17 08:40:16 +10:00
Damien Elmes
10f64d54b8 rearrange some methods to make structure clearer 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
96f0a5cc3c port change tracking 2020-02-17 08:40:16 +10:00
Damien Elmes
7d42da67c6 make sure results are checked 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
41266f46f1 add another implementation of media.addFile() and cleanFilename() et al
Instead of adding an incrementing number in the conflict case,
the file hash is appended.
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
ed8c1ae9c5 clearer error when closing tags transposed 2020-02-08 10:32:34 +10:00
Damien Elmes
c075191697 reuse reveal_cloze_text() for LaTeX cloze expansion 2020-01-28 07:40:44 +10:00
Damien Elmes
9ad80f4d2c move cloze-related code into a separate file 2020-01-27 20:41:23 +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
de3fe320c0 look through negated conditionals instead of just ignoring them
https://anki.tenderapp.com/discussions/ankidesktop/38220-bug-in-2119-regarding-computation-of-req
2020-01-23 17:27:07 +10:00
Damien Elmes
4fb227ca4c added flag_av_tags() for replay button support 2020-01-21 14:44:27 +10:00