mdict-utils Documentation

repository·master·Indexed 16 days ago

https://github.com/liuyug/mdict-utils

A 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.

Tokens
846
Snippets
5
Records
5
Agent score
15%

What's inside mdict-utils

  1. Inspect and query MDict files

    master

    Use the mdict CLI to view metadata, list all keys, or query specific words within an MDX dictionary file.

    Note on Compatibility:

    • Supports reading MDict Version 3.0.
    • Supports reading and writing MDict Version 2.0.
    • All files must use UTF-8 encoding and can include HTML and TXT content.
    # 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.mdx
  2. Unpack MDX and MDD files

    master

    Extract 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-zip
  3. Pack MDX and MDD files

    master

    Create 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