From da639c00a52c94350e1e270aab6e24574d490124 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 15 Sep 2012 09:39:10 +0900 Subject: [PATCH] report # of notes that are already in the collection --- anki/importing/anki2.py | 5 +++++ anki/importing/noteimp.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/anki/importing/anki2.py b/anki/importing/anki2.py index f84a10c19..b2d04c321 100644 --- a/anki/importing/anki2.py +++ b/anki/importing/anki2.py @@ -69,6 +69,7 @@ class Anki2Importer(Importer): add = [] dirty = [] usn = self.dst.usn() + dupes = 0 for note in self.src.db.execute( "select * from notes"): # turn the db result into a mutable list @@ -90,6 +91,7 @@ class Anki2Importer(Importer): # note we have the added note self._notes[guid] = (note[0], note[3], note[2]) else: + dupes += 1 pass ## update existing note - not yet tested; for post 2.0 # newer = note[3] > mod @@ -99,6 +101,9 @@ class Anki2Importer(Importer): # note[4] = usn # add.append(note) # dirty.append(note[0]) + if dupes: + self.log.append(_("Already in collection: %s.") % (ngettext( + "%d note", "%d notes", dupes) % dupes)) # add to col self.dst.db.executemany( "insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)", diff --git a/anki/importing/noteimp.py b/anki/importing/noteimp.py index 6c8254f7b..497e54e07 100644 --- a/anki/importing/noteimp.py +++ b/anki/importing/noteimp.py @@ -151,7 +151,6 @@ class NoteImporter(Importer): # apply scheduling updates self.updateCards() # make sure to update sflds, etc - part1 = ngettext("%d note added", "%d notes added", len(new)) % len(new) part2 = ngettext("%d note updated", "%d notes updated", self.updateCount) % self.updateCount self.log.append("%s, %s." % (part1, part2))