removed Notes,source_context from the Anki cards
This commit is contained in:
parent
750365aa79
commit
46e6a84c52
2 changed files with 6 additions and 17 deletions
|
|
@ -23,9 +23,9 @@ def compile_anki_package(records, output_path, deck_name):
|
|||
Resolves voice models dynamically by gender selection parameters and applies
|
||||
global speed coefficient rates from the active configurations.
|
||||
"""
|
||||
# Bumping IDs to completely clear any remaining local cache
|
||||
model_id = 1684329050
|
||||
deck_id = 1684329050
|
||||
# Incremented IDs to force a fresh schema mapping without legacy 'Notes' fields
|
||||
model_id = 1684329060
|
||||
deck_id = 1684329060
|
||||
|
||||
# Global Configuration Pace Resolver Mapping
|
||||
settings = database.load_all_settings() or {}
|
||||
|
|
@ -44,7 +44,6 @@ def compile_anki_package(records, output_path, deck_name):
|
|||
fields=[
|
||||
{'name': 'EnglishText'},
|
||||
{'name': 'SpanishText'},
|
||||
{'name': 'Notes'},
|
||||
{'name': 'AnkiNotes'},
|
||||
{'name': 'EnglishAudio'},
|
||||
{'name': 'SpanishAudio'}
|
||||
|
|
@ -57,7 +56,6 @@ def compile_anki_package(records, output_path, deck_name):
|
|||
'<div style="display:none;">{{EnglishAudio}}</div>',
|
||||
'afmt': '{{FrontSide}}<hr id="answer">'
|
||||
'<div style="font-family: Arial; font-size: 28px; text-align: center; color: #2980B9; font-weight: bold;">{{SpanishText}}</div><br>'
|
||||
'<div style="font-family: Arial; font-size: 14px; text-align: center; color: #34495E;">{{Notes}}</div>'
|
||||
'{{#AnkiNotes}}<div style="font-family: Arial; font-size: 13px; text-align: center; color: #8E44AD; border-top: 1px dashed #E5E7E9; padding-top: 6px; margin-top: 6px;"><b>Anki Meta:</b> {{{AnkiNotes}}}</div>{{/AnkiNotes}}<br>'
|
||||
'<div style="text-align: center;">{{SpanishAudio}}</div>',
|
||||
},
|
||||
|
|
@ -68,7 +66,6 @@ def compile_anki_package(records, output_path, deck_name):
|
|||
'<div style="display:none;">{{SpanishAudio}}</div>',
|
||||
'afmt': '{{FrontSide}}<hr id="answer">'
|
||||
'<div style="font-family: Arial; font-size: 22px; text-align: center; color: #2C3E50; font-weight: 500;">{{EnglishText}}</div><br>'
|
||||
'<div style="font-family: Arial; font-size: 14px; text-align: center; color: #34495E;">{{Notes}}</div>'
|
||||
'{{#AnkiNotes}}<div style="font-family: Arial; font-size: 13px; text-align: center; color: #8E44AD; border-top: 1px dashed #E5E7E9; padding-top: 6px; margin-top: 6px;"><b>Anki Meta:</b> {{{AnkiNotes}}}</div>{{/AnkiNotes}}<br>'
|
||||
'<div style="text-align: center;">{{EnglishAudio}}</div>',
|
||||
}
|
||||
|
|
@ -97,16 +94,7 @@ def compile_anki_package(records, output_path, deck_name):
|
|||
raw_tags = record.get("tags") or ""
|
||||
note_tags = [t.strip().replace(" ", "_") for t in raw_tags.split(",") if t.strip()]
|
||||
|
||||
# Dynamic HTML Notes Mapping Builder
|
||||
notes_html_parts = []
|
||||
if record.get('notes') and record['notes'].strip():
|
||||
notes_html_parts.append(f"<div style='margin-bottom: 4px;'>{record['notes'].strip()}</div>")
|
||||
if record.get('source_context') and record['source_context'].strip():
|
||||
notes_html_parts.append(f"<div style='font-size: 12px; color: #95A5A6; font-style: italic;'>Context: {record['source_context'].strip()}</div>")
|
||||
|
||||
notes_html = "".join(notes_html_parts)
|
||||
|
||||
# Safely isolate the raw text data string down to Anki
|
||||
# Safely isolate the raw text/HTML data string down to Anki notes field
|
||||
anki_notes_html = record['anki_notes'].strip() if record.get('anki_notes') else ""
|
||||
|
||||
# Standard Unique Media Filenames
|
||||
|
|
@ -130,9 +118,10 @@ def compile_anki_package(records, output_path, deck_name):
|
|||
else:
|
||||
es_audio_field = ""
|
||||
|
||||
# Clean sequential matching fields array matching schema mapping above
|
||||
note = genanki.Note(
|
||||
model=anki_model,
|
||||
fields=[en_text, es_text, notes_html, anki_notes_html, en_audio_field, es_audio_field],
|
||||
fields=[en_text, es_text, anki_notes_html, en_audio_field, es_audio_field],
|
||||
tags=note_tags
|
||||
)
|
||||
deck.add_note(note)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue