@neooosky/z-tool
v1.0.13
Published
A tool to translate MDX/MD files using OpenAI API
Readme
Prerequisites
The tool requires several external dependencies for full functionality. Here's how to install them on different platforms:
macOS
Using Homebrew:
# Install Homebrew if you haven't
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew update
brew install ffmpeg # Required for audio/video operations
brew install pandoc # Required for document conversion
brew install poppler # Required for PDF operations
brew install --cask calibre # Required for MOBI to txt conversionsUbuntu/Debian
sudo apt-get update
sudo apt-get install -y \
ffmpeg \ # Required for audio/video operations
pandoc \ # Required for document conversion
poppler-utils \ # Required for PDF operations
calibre # Required for MOBI to txt conversionsPython Dependencies
我们推荐使用 Miniconda 来管理 Python 环境:
- 首先安装 Miniconda:
# 下载Miniconda安装脚本
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOS-x86_64.sh
# 运行安装脚本
bash Miniconda3-latest-MacOS-x86_64.sh- 创建并激活虚拟环境:
# 创建名为spleeter-env的虚拟环境
conda create -n spleeter-env python=3.8
# 激活虚拟环境
conda activate spleeter-env- 安装 Python 依赖:
人声分离:
conda install -c conda-forge ffmpeg libsndfile
conda create -n spleeter-env python=3.8
conda activate spleeter-env
pip install spleeterNPM Dependencies
npm install xlsx # Required for Excel file operations
npm install sharp # Required for image format conversion (auto-installed)Commands
convert
Convert files between different formats.
z-tool convert [options]
Options:
-f, --file <file> Specific file to convert
-o, --origin <format> Origin file format
-t, --target <format> Target file format (default: "mp3")
-q, --quality <quality> Image quality for compression (1-100, default: 80)
-r, --recursive Process files recursively in subdirectoriesSupported conversions:
- Media: mp4/avi/mov → mp3/wav
- Images (jpg, jpeg, png, webp, gif):
- Convert between any supported image formats
- Omit
-oto convert ALL image formats to target - Supports quality control and recursive processing
- Documents:
- doc/docx → txt
- pdf → txt
- mobi → txt
- xls/xlsx → csv
- md ⇄ docx (bidirectional)
Examples:
# Media
z-tool convert -f video.mp4 # Convert video.mp4 to video.mp3
z-tool convert -o mp4 -t wav # Convert all mp4 to wav
# Images
z-tool convert -t webp # Convert ALL images to WebP
z-tool convert -t webp -r # Recursively convert ALL images to WebP
z-tool convert -t webp -q 90 # Convert with 90% quality
z-tool convert -o png -t webp # Convert only PNG to WebP
z-tool convert -f image.png -t jpg # Convert single image
# Documents
z-tool convert -o docx -t txt # Convert all docx files to txt
z-tool convert -f document.pdf -t txt # Convert PDF to text
z-tool convert -f ebook.mobi -t txt # Convert MOBI ebook to text
z-tool convert -f data.xlsx -t csv # Convert Excel to CSV
z-tool convert -f doc.md -t docx # Convert Markdown to Word
z-tool convert -f doc.docx -t md # Convert Word to Markdownconcat
Concatenate multiple audio or video files.
z-tool concat <files...> [options]
Options:
-o, --output <filename> Output filenameSupported file types:
- Audio: mp3, wav
- Video: mp4, avi, mov
Examples:
z-tool concat part1.mp3 part2.mp3 -o full.mp3
z-tool concat "intro.mp4" "main.mp4" "outro.mp4" -o final.mp4
z-tool concat *.mp3 -o combined.mp3compress
Compress files.
z-tool compress [options]
Options:
-f, --file <file> File to compresstranslator
Translate text between languages.
z-tool translator [options]
Options:
[options details...]tts (Text-to-Speech)
Convert text to speech.
z-tool tts [options]
Options:
[options details...]Troubleshooting
Common Issues
Command not found
- Ensure the package is installed globally
- Check if npm global binaries are in your PATH
Conversion fails
- Verify all required dependencies are installed
- Check if input files exist and are not corrupted
- Ensure you have write permissions in the output directory
FFmpeg errors
- Make sure FFmpeg is properly installed
- For video/audio operations, check if the input files are valid media files
Checking Dependencies
You can verify if dependencies are properly installed:
# Check FFmpeg
ffmpeg -version
# Check Pandoc
pandoc --version
# Check Poppler tools
pdftotext -vLicense
[License details]
Contributing
[Contributing guidelines]
