brickfrog commited on
Commit
f75c84c
·
verified ·
1 Parent(s): d04007f

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. ankigen/exporters.py +9 -2
ankigen/exporters.py CHANGED
@@ -5,6 +5,7 @@ import pandas as pd
5
  import genanki
6
  import random
7
  import html
 
8
  from typing import List, Dict, Any, Optional
9
  import csv
10
  from datetime import datetime
@@ -81,8 +82,14 @@ ANKI_CLOZE_MODEL_NAME = "AnkiGen Cloze"
81
 
82
  # It's good practice to generate unique IDs. These are examples.
83
  # Real applications might use a persistent way to store/retrieve these if models are updated.
84
- DEFAULT_BASIC_MODEL_ID = random.randrange(1 << 30, 1 << 31)
85
- DEFAULT_CLOZE_MODEL_ID = random.randrange(1 << 30, 1 << 31)
 
 
 
 
 
 
86
 
87
  # --- Shared CSS with dark mode support ---
88
  CARD_CSS = """
 
5
  import genanki
6
  import random
7
  import html
8
+ import hashlib
9
  from typing import List, Dict, Any, Optional
10
  import csv
11
  from datetime import datetime
 
82
 
83
  # It's good practice to generate unique IDs. These are examples.
84
  # Real applications might use a persistent way to store/retrieve these if models are updated.
85
+ DEFAULT_BASIC_MODEL_ID = (1 << 30) + (
86
+ int(hashlib.md5(ANKI_BASIC_MODEL_NAME.encode()).hexdigest()[:8], 16)
87
+ % (1 << 30)
88
+ )
89
+ DEFAULT_CLOZE_MODEL_ID = (1 << 30) + (
90
+ int(hashlib.md5(ANKI_CLOZE_MODEL_NAME.encode()).hexdigest()[:8], 16)
91
+ % (1 << 30)
92
+ )
93
 
94
  # --- Shared CSS with dark mode support ---
95
  CARD_CSS = """