blob: dee97d62881f510df2bbf9b192c9ea596f1eb46d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import argparse
import attain_vocab_to_anki_py.io
import attain_vocab_to_anki_py.jisho_client
__version__ = '0.1.0'
def main():
parser = argparse.ArgumentParser(description='Convert course vocab into Anki deck')
parser.add_argument('file', metavar='file', type=str,
help='vocabulary file path')
args = parser.parse_args()
file_path = args.file
# read entries from file
print(f"[STATUS] Reading file {file_path}")
entries = io.read_from_file(file_path)
# fetch kanji meanings from Jisho
print(f"[STATUS] Fetching kanji data from Jisho")
entries_with_meanings = jisho_client.inject_kanji_meanings(entries)
# write entries to file
out_file_name = f"{file_path}.out"
print(f"[STATUS] Writing result to file {out_file_name}")
io.write_to_file(out_file_name, entries_with_meanings)
|