From 77c9d5f5f3161ebdad98800e6d8fecda4f1cad13 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 12 Jul 2014 18:03:20 +0900 Subject: [PATCH 1/7] tweak dev url --- anki/sync.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/anki/sync.py b/anki/sync.py index d3d261f85..8f2755ed0 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -608,7 +608,7 @@ class RemoteServer(HttpSyncer): def syncURL(self): if os.getenv("DEV"): - return "http://localhost:5000/sync/" + return "https://l1.ankiweb.net/sync/" return SYNC_BASE + "sync/" def hostKey(self, user, pw): @@ -673,6 +673,8 @@ class FullSyncer(HttpSyncer): self.col = col def syncURL(self): + if os.getenv("DEV"): + return "https://l1.ankiweb.net/sync/" return SYNC_BASE + "sync/" def download(self): @@ -848,7 +850,7 @@ class RemoteMediaServer(HttpSyncer): def syncURL(self): if os.getenv("DEV"): - return "http://localhost:5001/" + return "https://l1.ankiweb.net/msync/" return SYNC_BASE + "msync/" def begin(self): From ee55d3e96c8a181998886a13f0a77670a0064517 Mon Sep 17 00:00:00 2001 From: Julien Baley Date: Sun, 13 Jul 2014 18:42:18 +0100 Subject: [PATCH 2/7] Do not ignore the state of a window when opening it --- aqt/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aqt/__init__.py b/aqt/__init__.py index f6c0bf2fb..61aa24158 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -53,7 +53,7 @@ class DialogManager(object): def open(self, name, *args): (creator, instance) = self._dialogs[name] if instance: - instance.setWindowState(Qt.WindowActive) + instance.setWindowState(instance.windowState() | Qt.WindowActive) instance.activateWindow() instance.raise_() return instance @@ -253,4 +253,4 @@ environment points to a valid, writable folder.""") # load the main window import aqt.main mw = aqt.main.AnkiQt(app, pm, args) - app.exec_() \ No newline at end of file + app.exec_() From ba8ed39e13b310a2916683389d94a8f8c672179c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 15 Jul 2014 11:36:52 +0900 Subject: [PATCH 3/7] fix media sync thinking >25 changes is a concurrent update --- anki/sync.py | 1 + 1 file changed, 1 insertion(+) diff --git a/anki/sync.py b/anki/sync.py index 8f2755ed0..cab986cae 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -803,6 +803,7 @@ class MediaSyncer(object): if serverLastUsn - processedCnt == lastUsn: self.col.log("lastUsn in sync, updating local") + lastUsn = serverLastUsn self.col.media.setLastUsn(serverLastUsn) # commits else: self.col.log("concurrent update, skipping usn update") From 3224a155a778058b68a1a200a921cc1b51a0d787 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 15 Jul 2014 11:49:03 +0900 Subject: [PATCH 4/7] normalize filenames as we sync user still needs to run "check media" if their fields are encoded incorrectly, but by fixing on the fly we'll ensure mediaSanity doesn't fail --- anki/media.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/anki/media.py b/anki/media.py index 7d37e8354..72f12e55f 100644 --- a/anki/media.py +++ b/anki/media.py @@ -384,6 +384,15 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0); if not os.path.getsize(f): os.unlink(f) continue + # check encoding + if not isMac: + normf = unicodedata.normalize("NFC", f) + if f != normf: + # wrong filename encoding which will cause sync errors + if os.path.exists(normf): + os.unlink(f) + else: + os.rename(f, normf) # newly added? if f not in self.cache: added.append(f) From ed34d5bc945c8dae1834da31fc16eff86018a950 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 18 Jul 2014 20:08:33 +0900 Subject: [PATCH 5/7] bump version --- anki/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/__init__.py b/anki/__init__.py index d7f33c917..5d567f869 100644 --- a/anki/__init__.py +++ b/anki/__init__.py @@ -30,6 +30,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.26" # build scripts grep this line, so preserve formatting +version="2.0.27" # build scripts grep this line, so preserve formatting from anki.storage import Collection __all__ = ["Collection"] From f54f5870fa94e05e96bf72210a70934ebd2b734c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 20 Jul 2014 03:37:31 +0900 Subject: [PATCH 6/7] deauthing should reset lastUsn to 0 thanks to houssam for the heads up! --- anki/media.py | 1 + 1 file changed, 1 insertion(+) diff --git a/anki/media.py b/anki/media.py index 72f12e55f..7493964b1 100644 --- a/anki/media.py +++ b/anki/media.py @@ -441,6 +441,7 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0); def forceResync(self): self.db.execute("delete from media") + self.db.execute("update meta set lastUsn=0,dirMod=0") self.db.execute("vacuum analyze") self.db.commit() From da777160bce038ddfded55af7ed613bbfa0cf121 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Jul 2014 14:30:32 +0900 Subject: [PATCH 7/7] bump version --- anki/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/__init__.py b/anki/__init__.py index 5d567f869..213d10587 100644 --- a/anki/__init__.py +++ b/anki/__init__.py @@ -30,6 +30,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.27" # build scripts grep this line, so preserve formatting +version="2.0.28" # build scripts grep this line, so preserve formatting from anki.storage import Collection __all__ = ["Collection"]