flan
e8850f2a5a
Migrate old media DB if present
2020-01-04 05:51:33 +01:00
flan
e8f274ee84
Fix long media sync times on AnkiDroid
...
Based on PR #44 by Johannes Schirm <https://github.com/Marth68 >.
The code is pretty much the same, but with usn used instead of
mtime for determining which media files have changed since last
sync.
Relevant excerpt from #44 :
> The server was always sending metadata for all files in the
> collection as a response to the mediaChanges operation. Because
> AnkiDroid then calculates checksums for all these files (just to
> notice that they actually haven't changed), it took larger
> collections very long to sync after every media change. With this
> fix, only the number of files indicated by usn - lastUsn (and
> mtime) are considered for each sync.
Fixes #26 , closes #44 .
2020-01-04 05:51:33 +01:00
flan
10f47611bf
Store media usn per-file
...
Since anki.media.MediaManager does not store per-file usn (as it's
not really needed for anything in the client), this requires us to
drop it and implement a custom media manager.
2020-01-04 05:51:33 +01:00
flan
ac1920d078
Make SyncMediaHandler not inherit anki.sync.MediaSyncer
...
All endpoints are implemented in the child class now, so there's
no need to use any code from the parent class.
2020-01-04 05:51:33 +01:00
flan
c4730b1596
Add test for #44
2020-01-04 05:51:33 +01:00
flan
c07fe0e65c
Print version on startup
...
The version is determined from either the contents of _version.py
(expected to be present in release tarballs) or the output of
`git describe --always`.
2020-01-04 05:39:24 +01:00
flan
aaf7e8b5e8
Update manager examples in config
2020-01-04 05:01:39 +01:00
flan
316e553681
Make comment for SyncCollectionHandler.removed() less confusing
2020-01-03 03:03:21 +01:00
flan
7f551f47f7
Remove unused argument to logger.error()
2020-01-03 03:02:42 +01:00
flan
7ef3d4f3fa
Fix full sync on Windows
...
From <https://docs.python.org/3.7/library/os.html#os.rename >:
> On Windows, if dst already exists, OSError will be raised even if
> it is a file.
...
> If you want cross-platform overwriting of the destination, use
> replace().
Thanks to kerry liu (https://github.com/hqzxjczx ) for reporting this.
Fixes #32 .
2019-04-16 19:57:24 +02:00
flan
b9a1203491
Don't create DBs during schema check if they don't exist
2019-03-16 15:24:46 +01:00
flan
02fecc4e0a
Clarify wording (development headers)
...
Should make #29 less likely to happen
2019-03-14 01:13:52 +01:00
flan
7fe7b97475
Update anki-bundled to 2.1.11
2019-03-14 01:09:02 +01:00
flan
d8a0853479
Make migrate_user_tables.py executable
2019-03-14 00:48:47 +01:00
flan
9986266b07
Update table of contents
2019-03-14 00:48:13 +01:00
flan
5ad14b01b4
Notify the user about DB migrations
2019-03-14 00:45:29 +01:00
flan
bfeaeae2e5
Credit dsnopek
2019-03-08 21:54:54 +01:00
tsudoko and GitHub
e3e362707a
Add table of contents to README
2019-03-08 20:46:42 +00:00
flan
7b408bdf5b
Don't log very long strings unless debugging
2019-03-08 17:00:59 +01:00
flan
4fe378adce
Add username field to CollectionWrapper
2019-03-08 14:24:58 +01:00
flan
5051144124
Include request parameters in log messages
2019-03-08 14:24:58 +01:00
flan
f5b6cf464d
Include time in log messages
2019-03-08 14:24:58 +01:00
flan
fe635b317f
Use logging module for HTTP request logging too
2019-03-08 14:24:58 +01:00
flan
47cf75d8d6
Log all ankisyncd events under ankisyncd.*
2019-03-08 14:24:58 +01:00
flan
4214fc3da0
Apply custom server settings per-profile
2019-03-08 14:22:47 +01:00
flan
35f89af98e
Update pyaudio instructions
2019-03-07 21:51:11 +01:00
flan
3266cc4282
Update anki-bundled to 2.1.10
2019-03-07 21:41:38 +01:00
flan
91b022eda6
Add AnkiDroid setup instructions
...
Thanks @luoliyan
Source: https://github.com/tsudoko/anki-sync-server/pull/22#issuecomment-461012296
2019-03-07 05:50:42 +01:00
flan
970664e6a9
Revert "Simplify version suffix patch"
...
https://github.com/dae/anki/commit/95ccbfdd3679dd46f22847c539c7fddb8fa904ea broke it
This reverts commit 61b4582364 .
2019-02-19 00:52:43 +01:00
flan
c85f50460a
Fix up default config
...
whoops
2019-02-05 00:49:27 +01:00
flan
b1157bac25
Add link to Docker instructions
...
Fixes #16
2019-02-05 00:35:03 +01:00
flan
bb1dba1b99
Update addon folder
...
It depends on the platform anyway, and the directory in the README
was outdated anyway (https://github.com/dae/anki/commit/57c8e433274c95c5bd059cd7fe4d6483a949d869 ).
2018-12-24 17:19:15 +01:00
flan
85aac784db
Add enabled check back
...
Accidentally removed it in 360b2d08ed .
2018-12-24 16:47:26 +01:00
flan
537c4daa94
Make potential future instances of #8 easier to debug
...
With hostNum prepended to the address, the client won't even be
able to connect and will return an error message with the invalid
address.
Example:
requests.exceptions.InvalidSchema: No connection adapters were found for '6http://localhost:27701/sync/meta '
2018-12-24 16:38:10 +01:00
flan
61b4582364
Simplify version suffix patch
2018-12-24 16:31:36 +01:00
flan
360b2d08ed
Make hostNum empty when changing sync server
...
Should fix an error encountered when the user used AnkiWeb in the
past and receives a JSON decode error because an unrecognized
endpoint (/[somenumber]sync instead of /sync) doesn't return what
the client expects.
Closes #10 , fixes #8 .
2018-12-24 16:28:34 +01:00
flan
32a81dc028
Make the addon modify anki.sync.SYNC_BASE
2018-12-24 15:50:16 +01:00
flan
00ec46eab3
Clarify what the supported version range applies to
2018-12-17 16:58:09 +01:00
flan
8b832497b4
Update anki-bundled to 2.1.7
2018-12-17 16:51:45 +01:00
flan
e892c0a22c
Add test case for ankidesktop 2.1.6-beta2
2018-12-13 00:33:06 +01:00
flan
6a073635ac
Update unit tests
2018-12-13 00:33:02 +01:00
flan
56beb0950e
Update anki-bundled to 2.1.3
2018-08-31 04:39:50 +02:00
flan
c68fd12d67
Make config paths easier to override
2018-08-28 18:07:27 +02:00
flan
92d6579c83
Replace remaining prints with logging.info calls
2018-08-28 17:59:29 +02:00
flan
527991beea
Don't check if config file exists before loading it
2018-08-28 17:58:11 +02:00
flan
242c423c13
Use format() instead of concatenation
2018-08-28 17:35:08 +02:00
flan
2538db5c07
Remove redundant checks, check if user exists before changing password
2018-08-28 17:34:31 +02:00
flan
dbdb3ffb3b
Make UserManager errors less redundant
2018-08-28 17:26:26 +02:00
flan
59fcf9e8c1
Fix ankisyncctl error messages
2018-08-28 17:26:08 +02:00
flan
129647cb70
Move logging.basicConfig call up to include messages from imported modules
2018-08-28 17:16:19 +02:00
flan
5bcb01bd9e
Use predefined config locations
2018-08-28 17:15:40 +02:00
flan
ec63149d5c
Add GUI addon
2018-08-25 04:26:40 +02:00
flan
b96f74224b
Move pyaudio stuff to the bottom
2018-08-23 16:28:27 +02:00
flan
a7c230c4bb
Reformat addon instructions a bit
2018-08-23 16:19:14 +02:00
flan
45133a0a64
Add information about pyaudio
2018-08-23 16:10:16 +02:00
flan
08a2b0e779
Fix directory name in README
2018-08-22 14:45:56 +02:00
flan
b20c69d613
Clarify supported Python version
2018-08-22 14:45:38 +02:00
flan
47294d1585
Add more information about incompatible versions
2018-08-22 14:37:46 +02:00
flan
abb2d35bdf
Mention the need to have Anki installed
2018-08-22 14:30:47 +02:00
flan
5a95b62a74
Use python -m ankisyncd in README
2018-08-22 14:26:58 +02:00
flan
9fb00c80b9
Remove debug print
2018-08-22 14:22:54 +02:00
flan
ff8148b6fb
Add major fork changes to README
2018-08-20 18:51:20 +02:00
flan
ef39c8c385
Drop unsupported clients if they try to sync a v2 collection
2018-08-20 18:41:36 +02:00
flan
be7d57a1a5
Add Anki 2.1 instructions
2018-08-20 18:40:03 +02:00
flan
6b9aaa0a6c
Check client version in SyncCollectionHandler.meta
...
When the server sends an error response (4xx/5xx), the desktop
client displays "user friendly" error messages instead of
the actual response body.
2018-08-20 18:27:43 +02:00
flan
0b9f30adea
Implement applyGraves
2018-08-20 18:02:09 +02:00
flan
3e26fab3a3
Add methods removed in dae/anki@d6874de8
...
Reference: https://github.com/dae/anki/commit/d6874de8c8a1467323ac12337ec956afd1475a67
2018-08-20 17:03:47 +02:00
flan
a83e68412d
Remove media patch, put usnLim in server code
...
Since dae/anki@d6874de8 , usnLim always returns -1 regardless of the
`server` attribute.
Reference: https://github.com/dae/anki/commit/d6874de8c8a1467323ac12337ec956afd1475a67
2018-08-20 15:44:13 +02:00
flan
c4fad436c1
Update anki-bundled to 2.1.1
2018-08-20 15:39:59 +02:00
flan
8b9961febc
Prefer anki-bundled if it exists
2018-08-20 14:44:29 +02:00
flan
c3024ba396
Make the server runnable with python3 -m ankisyncd
2018-08-20 14:42:40 +02:00
flan
82d7126425
Use cwd in ankisyncctl.py for now
2018-08-20 04:05:18 +02:00
flan
7ace256e0a
Check for protocol version before proceeding
2017-11-09 15:56:25 +01:00
flan
de7b6ec22f
Remove redundant try/catch block around os.makedirs()
2017-11-08 13:49:28 +01:00
flan
aae65cc5d8
Remove redundant else blocks
2017-11-08 13:43:27 +01:00
flan
c0ea23c307
Monkey patch anki at runtime
...
The server should work fine with /usr/share/anki now, as long as
external Anki version >= 2.1.
2017-11-06 23:01:08 +01:00
flan
2a27d78591
Use config specified in argv[1]
2017-11-06 21:06:45 +01:00
flan
59f28faa1e
Use mapping protocol access instead of legacy configparser API
2017-11-06 21:06:18 +01:00
flan
354354ca72
Make built-in server actually use the "host" config field
2017-11-06 17:36:00 +01:00
flan
ca106e6136
Clean up imports
2017-11-06 17:27:13 +01:00
flan
7d1a222501
Remove redundant except block
...
ValueError is handled in _decode_data() already
2017-11-06 17:06:49 +01:00
flan
e97a11edb4
Make spacing more consistent
2017-11-06 16:56:13 +01:00
flan
9ffd380e64
Make it possible to use hooks before and after every sync operation
...
Excluding media sync.
2017-11-05 23:34:49 +01:00
flan
65bef264be
Use int instead of str for the response code
2017-11-05 22:17:37 +01:00
flan
978b1d7371
Make _check_zip_data() and _adopt_media_changes_from_zip() take a ZipFile
2017-11-04 18:42:21 +01:00
flan
0e5bbf4f9e
Use more with statements
2017-11-04 18:41:56 +01:00
flan
1677ed38b9
Update comment
2017-11-04 17:39:37 +01:00
flan
af8548182b
Shorten MockServerConnection.post()
2017-11-04 17:38:29 +01:00
flan
c9c02d3253
Resolve relative paths and symlinks before opening auth/session DB
2017-11-04 04:22:06 +01:00
flan
024e76423d
Explicitly convert str and bytes where needed
2017-11-04 04:11:48 +01:00
flan
5aff76fee7
Update mock server
2017-11-04 03:35:55 +01:00
flan
3d6a2a639a
Remove explicit inherits from object
2017-11-04 02:53:52 +01:00
flan
95eadafb9b
Update anki to 7b1747d6504c9091a34793cebaa559b9fb6968df
...
This is the last commit that still runs on Python 3.5.
2017-11-04 02:53:52 +01:00
flan
32b82d5803
Fix up some changes made by 2to3
2017-11-04 02:53:49 +01:00
flan
0cc21101d7
2to3 everything
2017-11-04 02:06:42 +01:00
flan
c08fb74d91
Enable logging
2017-11-04 01:53:44 +01:00
flan
d4f7c87fb4
Remove debug prints
2017-11-04 01:44:49 +01:00
flan
ec83527fa4
Remove unused function
2017-11-04 01:41:45 +01:00
flan
f5050582ba
Remove unnecessary class from helpers.server_utils
2017-11-04 00:47:34 +01:00
flan
a48ad44a65
Remove unnecessary class from helpers.file_utils
...
A class which keeps track of temporary files and removes them
automatically when they're not needed anymore might be a good idea,
but this implementation didn't remove files in some cases. Adding
unrelated methods that could as well be just standalone functions
is bad design, too.
In this case, it's better to just get rid of it altogether instead
of fixing it, since Python 3 has a TemporaryDirectory class, which
can be used for the same purpose and is definitely more
battle-tested.
2017-11-04 00:24:34 +01:00