mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
default to compression level 6
This commit is contained in:
parent
594204a134
commit
4a88885e83
1 changed files with 3 additions and 4 deletions
|
@ -402,7 +402,7 @@ class HttpSyncer(object):
|
||||||
# costly. We could send it as a raw post, but more HTTP clients seem to
|
# costly. We could send it as a raw post, but more HTTP clients seem to
|
||||||
# support file uploading, so this is the more compatible choice.
|
# support file uploading, so this is the more compatible choice.
|
||||||
|
|
||||||
def postData(self, http, method, fobj, vars, comp=1):
|
def postData(self, http, method, fobj, vars, comp=6):
|
||||||
bdry = "--"+MIME_BOUNDARY
|
bdry = "--"+MIME_BOUNDARY
|
||||||
# write out post vars, including session key and compression flag
|
# write out post vars, including session key and compression flag
|
||||||
buf = StringIO()
|
buf = StringIO()
|
||||||
|
@ -425,7 +425,7 @@ Content-Type: application/octet-stream\r\n\r\n""")
|
||||||
else:
|
else:
|
||||||
tgt = buf
|
tgt = buf
|
||||||
while 1:
|
while 1:
|
||||||
data = fobj.read(CHUNK_SIZE)
|
data = fobj.read(65536)
|
||||||
if not data:
|
if not data:
|
||||||
if comp:
|
if comp:
|
||||||
tgt.close()
|
tgt.close()
|
||||||
|
@ -527,7 +527,7 @@ class FullSyncer(HttpSyncer):
|
||||||
runHook("sync", "upload")
|
runHook("sync", "upload")
|
||||||
self.col.beforeUpload()
|
self.col.beforeUpload()
|
||||||
assert self.postData(self.con, "upload", open(self.col.path, "rb"),
|
assert self.postData(self.con, "upload", open(self.col.path, "rb"),
|
||||||
self._vars(), comp=6) == "OK"
|
self._vars()) == "OK"
|
||||||
|
|
||||||
# Media syncing
|
# Media syncing
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -621,4 +621,3 @@ class RemoteMediaServer(MediaSyncer, HttpSyncer):
|
||||||
return simplejson.loads(
|
return simplejson.loads(
|
||||||
self.postData(self.con, "mediatest", StringIO(
|
self.postData(self.con, "mediatest", StringIO(
|
||||||
simplejson.dumps(dict(n=n))), self._vars()))
|
simplejson.dumps(dict(n=n))), self._vars()))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue