From a379e47ca5b364a46f387de606619620e8402145 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 13 May 2013 13:58:10 +0900 Subject: [PATCH] handle cloned note types in mnemo import --- anki/importing/mnemo.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/anki/importing/mnemo.py b/anki/importing/mnemo.py index 2219dec79..8f6bd979a 100644 --- a/anki/importing/mnemo.py +++ b/anki/importing/mnemo.py @@ -43,12 +43,13 @@ select _fact_id, fact_view_id, tags, next_rep, last_rep, easiness, acq_reps+ret_reps, lapses from cards"""): # categorize note note = notes[row[0]] - if row[1] == "1.1": - front.append(note) - elif row[1] == "2.1": - frontback.append(note) - elif row[1] == "3.1": - vocabulary.append(note) + if row[1].endswith(".1"): + if row[1].startswith("1.") or row[1].startswith("1::"): + front.append(note) + elif row[1].startswith("2.") or row[1].startswith("2::"): + frontback.append(note) + elif row[1].startswith("3.") or row[1].startswith("3::"): + vocabulary.append(note) # merge tags into note tags = row[2].replace(", ", "\x1f").replace(" ", "_") tags = tags.replace("\x1f", " ") @@ -71,7 +72,7 @@ acq_reps+ret_reps, lapses from cards"""): rem = int((next - time.time())/86400) c.due = self.col.sched.today+rem # get ord - m = re.match("\d+\.(\d+)", row[1]) + m = re.search(".(\d+)$", row[1]) ord = int(m.group(1))-1 if 'cards' not in note: note['cards'] = {}