need to compare mediaList with nfd on macs

otherwise the server says we have file x and local code
doesn't notice it already exists
This commit is contained in:
Damien Elmes 2013-12-04 11:43:57 +09:00
parent 636d70ab16
commit ba589ac8cc

View file

@ -2,7 +2,6 @@
# 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
import re import re
import urllib import urllib
import unicodedata import unicodedata
@ -505,8 +504,12 @@ create table log (fname text primary key, type int);
need = [] need = []
remove = [] remove = []
for f in files: for f in files:
if self.db.scalar("select 1 from log where fname=?", f): if isMac:
remove.append((f,)) name = unicodedata.normalize("NFD", f)
else:
name = f
if self.db.scalar("select 1 from log where fname=?", name):
remove.append((name,))
else: else:
need.append(f) need.append(f)
self.db.executemany("delete from log where fname=?", remove) self.db.executemany("delete from log where fname=?", remove)