py/gadict_srs_anki.py
changeset 697 f1c74335f4ba
parent 686 a9e3b6050544
child 698 5fc9bc68fb9c
equal deleted inserted replaced
696:537b8ce489af 697:f1c74335f4ba
     2 """Anki card writer"""
     2 """Anki card writer"""
     3 
     3 
     4 import os
     4 import os
     5 import io
     5 import io
     6 import sys
     6 import sys
     7 import codecs
       
     8 import tempfile
     7 import tempfile
     9 import shutil
     8 import shutil
    10 import signal
     9 import signal
    11 import regex
    10 import regex
    12 
    11 
   206         self.name = name
   205         self.name = name
   207 
   206 
   208         self.collection = collection = anki.Collection(os.path.join(self.tmpdir, 'collection.anki2'))
   207         self.collection = collection = anki.Collection(os.path.join(self.tmpdir, 'collection.anki2'))
   209 
   208 
   210         deck_id = collection.decks.id(self.name)
   209         deck_id = collection.decks.id(self.name)
   211         deck = collection.decks.get(deck_id)
       
   212 
   210 
   213         # It is essential to keep model['id'] unchanged between upgrades!!
   211         # It is essential to keep model['id'] unchanged between upgrades!!
   214         MODEL_ID = int(hashlib.sha1(self.name).hexdigest(), 16) % (2**63)
   212         MODEL_ID = int(hashlib.sha1(self.name).hexdigest(), 16) % (2**63)
   215 
   213 
   216         ################################################################
   214         ################################################################