This commit is contained in:
Soren I. Bjornstad 2013-10-16 15:14:05 -05:00
commit 3e2dfe1c13
3 changed files with 20 additions and 12 deletions

View file

@ -28,6 +28,6 @@ if arch[1] == "ELF":
sys.path.insert(0, os.path.join(ext, "py2.%d-%s" % ( sys.path.insert(0, os.path.join(ext, "py2.%d-%s" % (
sys.version_info[1], arch[0][0:2]))) sys.version_info[1], arch[0][0:2])))
version="2.0.13" # build scripts grep this line, so preserve formatting version="2.0.14" # build scripts grep this line, so preserve formatting
from anki.storage import Collection from anki.storage import Collection
__all__ = ["Collection"] __all__ = ["Collection"]

View file

@ -2,15 +2,21 @@
# Copyright: Damien Elmes <anki@ichi2.net> # Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import os, shutil, re, urllib, unicodedata, \ import os
sys, zipfile import re
import send2trash import urllib
import unicodedata
import sys
import zipfile
from cStringIO import StringIO from cStringIO import StringIO
import send2trash
from anki.utils import checksum, isWin, isMac, json from anki.utils import checksum, isWin, isMac, json
from anki.db import DB from anki.db import DB
from anki.consts import * from anki.consts import *
from anki.latex import mungeQA from anki.latex import mungeQA
class MediaManager(object): class MediaManager(object):
soundRegexps = ["(?i)(\[sound:(?P<fname>[^]]+)\])"] soundRegexps = ["(?i)(\[sound:(?P<fname>[^]]+)\])"]
@ -356,7 +362,7 @@ class MediaManager(object):
# the later forgetAdded() call easier # the later forgetAdded() call easier
fnames.append([fname]) fnames.append([fname])
z.write(fname, str(cnt)) z.write(fname, str(cnt))
files[str(cnt)] = fname files[str(cnt)] = unicodedata.normalize("NFC", fname)
sz += os.path.getsize(fname) sz += os.path.getsize(fname)
if sz > SYNC_ZIP_SIZE or cnt > SYNC_ZIP_COUNT: if sz > SYNC_ZIP_SIZE or cnt > SYNC_ZIP_COUNT:
break break

View file

@ -149,23 +149,23 @@ and try again.""")
return _("""\ return _("""\
The connection to AnkiWeb timed out. Please check your network \ The connection to AnkiWeb timed out. Please check your network \
connection and try again.""") connection and try again.""")
elif "500" in err: elif "code: 500" in err:
return _("""\ return _("""\
AnkiWeb encountered an error. Please try again in a few minutes, and if \ AnkiWeb encountered an error. Please try again in a few minutes, and if \
the problem persists, please file a bug report.""") the problem persists, please file a bug report.""")
elif "501" in err: elif "code: 501" in err:
return _("""\ return _("""\
Please upgrade to the latest version of Anki.""") Please upgrade to the latest version of Anki.""")
# 502 is technically due to the server restarting, but we reuse the # 502 is technically due to the server restarting, but we reuse the
# error message # error message
elif "502" in err: elif "code: 502" in err:
return _("AnkiWeb is under maintenance. Please try again in a few minutes.") return _("AnkiWeb is under maintenance. Please try again in a few minutes.")
elif "503" in err: elif "code: 503" in err:
return _("""\ return _("""\
AnkiWeb is too busy at the moment. Please try again in a few minutes.""") AnkiWeb is too busy at the moment. Please try again in a few minutes.""")
elif "504" in err: elif "code: 504" in err:
return _("504 gateway timeout error received. Please try temporarily disabling your antivirus.") return _("504 gateway timeout error received. Please try temporarily disabling your antivirus.")
elif "409" in err: elif "code: 409" in err:
return _("Only one client can access AnkiWeb at a time. If a previous sync failed, please try again in a few minutes.") return _("Only one client can access AnkiWeb at a time. If a previous sync failed, please try again in a few minutes.")
elif "10061" in err or "10013" in err: elif "10061" in err or "10013" in err:
return _( return _(
@ -174,8 +174,10 @@ AnkiWeb is too busy at the moment. Please try again in a few minutes.""")
return _( return _(
"Server not found. Either your connection is down, or antivirus/firewall " "Server not found. Either your connection is down, or antivirus/firewall "
"software is blocking Anki from connecting to the internet.") "software is blocking Anki from connecting to the internet.")
elif "407" in err: elif "code: 407" in err:
return _("Proxy authentication required.") return _("Proxy authentication required.")
elif "code: 413" in err:
return _("Your collection or a media file is too large to sync.")
return err return err
def _getUserPass(self): def _getUserPass(self):