diff --git a/anki/__init__.py b/anki/__init__.py index a7a47136a..dab395b4d 100644 --- a/anki/__init__.py +++ b/anki/__init__.py @@ -28,6 +28,6 @@ if arch[1] == "ELF": sys.path.insert(0, os.path.join(ext, "py2.%d-%s" % ( 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 __all__ = ["Collection"] diff --git a/anki/media.py b/anki/media.py index 6a76594af..1b1bea5aa 100644 --- a/anki/media.py +++ b/anki/media.py @@ -2,15 +2,21 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -import os, shutil, re, urllib, unicodedata, \ - sys, zipfile -import send2trash +import os +import re +import urllib +import unicodedata +import sys +import zipfile from cStringIO import StringIO + +import send2trash from anki.utils import checksum, isWin, isMac, json from anki.db import DB from anki.consts import * from anki.latex import mungeQA + class MediaManager(object): soundRegexps = ["(?i)(\[sound:(?P[^]]+)\])"] @@ -356,7 +362,7 @@ class MediaManager(object): # the later forgetAdded() call easier fnames.append([fname]) z.write(fname, str(cnt)) - files[str(cnt)] = fname + files[str(cnt)] = unicodedata.normalize("NFC", fname) sz += os.path.getsize(fname) if sz > SYNC_ZIP_SIZE or cnt > SYNC_ZIP_COUNT: break diff --git a/aqt/sync.py b/aqt/sync.py index 9660ea436..0a764b8fa 100644 --- a/aqt/sync.py +++ b/aqt/sync.py @@ -149,23 +149,23 @@ and try again.""") return _("""\ The connection to AnkiWeb timed out. Please check your network \ connection and try again.""") - elif "500" in err: + elif "code: 500" in err: return _("""\ AnkiWeb encountered an error. Please try again in a few minutes, and if \ the problem persists, please file a bug report.""") - elif "501" in err: + elif "code: 501" in err: return _("""\ Please upgrade to the latest version of Anki.""") # 502 is technically due to the server restarting, but we reuse the # error message - elif "502" in err: + elif "code: 502" in err: return _("AnkiWeb is under maintenance. Please try again in a few minutes.") - elif "503" in err: + elif "code: 503" in err: return _("""\ 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.") - 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.") elif "10061" in err or "10013" in err: return _( @@ -174,8 +174,10 @@ AnkiWeb is too busy at the moment. Please try again in a few minutes.""") return _( "Server not found. Either your connection is down, or antivirus/firewall " "software is blocking Anki from connecting to the internet.") - elif "407" in err: + elif "code: 407" in err: return _("Proxy authentication required.") + elif "code: 413" in err: + return _("Your collection or a media file is too large to sync.") return err def _getUserPass(self):