fix path bug with infinite word generation.
This commit is contained in:
parent
99a109b130
commit
6619ed5b32
|
|
@ -363,10 +363,10 @@ def analyze(text: str, vocab: Dict[str, Dict]):
|
||||||
}
|
}
|
||||||
|
|
||||||
def write_word_note(word: str, destination_dir: Path):
|
def write_word_note(word: str, destination_dir: Path):
|
||||||
if Path(destination_dir.joinpath('/' + word + '.md')).exists() == False:
|
if Path(destination_dir.joinpath(word + '.md')).exists() == False:
|
||||||
definitions = anki_fields_term(word)
|
definitions = anki_fields_term(word)
|
||||||
if definitions.get("fields"):
|
if definitions.get("fields"):
|
||||||
with open(destination_dir.as_posix() + '/' + word + '.md', 'w') as vocab_note:
|
with open(destination_dir.joinpath(word + '.md'), 'w') as vocab_note:
|
||||||
for entry in definitions.get("fields"):
|
for entry in definitions.get("fields"):
|
||||||
#vocab_note.write("\n")
|
#vocab_note.write("\n")
|
||||||
#print(entry['expression'], file=vocab_note)
|
#print(entry['expression'], file=vocab_note)
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ def main():
|
||||||
## Lookup vocab
|
## Lookup vocab
|
||||||
for word in vocab:
|
for word in vocab:
|
||||||
write_word_note(word, destination_path)
|
write_word_note(word, destination_path)
|
||||||
|
return
|
||||||
|
|
||||||
# with open("/run/media/deck/YF8SD/Video/Yu-Gi-Oh! Duel Monsters - 001.vtt", "w", encoding="utf-8") as f:
|
# with open("/run/media/deck/YF8SD/Video/Yu-Gi-Oh! Duel Monsters - 001.vtt", "w", encoding="utf-8") as f:
|
||||||
# f.writelines(lines)
|
# f.writelines(lines)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user