Install mdict-utils via pip
masterInstall the mdict-utils package using pip to access the mdict command-line tool for packing and unpacking MDict dictionary files.
pip install mdict-utilsrepository·master·Indexed 16 days ago
https://github.com/liuyug/mdict-utilsA command-line tool for packing and unpacking MDict dictionary files (MDX and MDD). It supports reading MDict Version 3.0 and reading/writing Version 2.0, allowing users to manipulate dictionary data, convert between text and SQLite formats, and manage UTF-8 encoded HTML and TXT content.
Install the mdict-utils package using pip to access the mdict command-line tool for packing and unpacking MDict dictionary files.
pip install mdict-utilsUse the mdict CLI to view metadata, list all keys, or query specific words within an MDX dictionary file.
Note on Compatibility:
# View meta information
mdict -m dict.mdx
# List all keys in the dictionary
mdict -k dict.mdx
# Query a specific word
mdict -q <word> dict.mdxExtract contents from MDX (dictionary) or MDD (media) files using the -x flag. You can specify an output directory with -d and choose different splitting or database export methods.
# Unpack MDX to a specific directory
mdict -x dict.mdx -d ./mdx
# Unpack MDX/MDD and split into 5 files
mdict -x dict.mdx -d ./mdx --split-n 5
# Unpack MDX/MDD and split into a...z files
mdict -x dict.mdx -d ./mdx --split-az
# Unpack MDD to a specific directory
mdict -x dict.mdd -d ./mdd
# Unpack MDX/MDD to a sqlite3 DB
mdict -x dict.mdx --exdb
mdict -x dict.mdd --exdb
# Unpack MDX/MDD to a sqlite3 DB with zip compression
mdict -x dict.mdx --exdb-zipUse mdict-utils to convert plain text files to sqlite3 databases or vice versa.
# Convert TXT to sqlite3 DB
mdict --txt-db dict.txt
# Convert sqlite3 DB to TXT
mdict --db-txt dict.dbCreate new MDX or MDD dictionary files from text files or directories. You must provide a title and description (usually HTML files).
# Pack MDX from a single TXT file
mdict --title title.html --description description.html -a dict.txt dict.mdx
# Pack MDX from multiple TXT files
mdict --title title.html --description description.html -a dict.part1.txt -a dict.part2.txt dict.mdx
# Pack MDX from a directory of TXT files
mdict --title title.html --description description.html -a txt_dir dict.mdx
# Pack MDD from a directory
mdict --title title.html --description description.html -a mdd_dir dict.mdd