This document describes the architecture and design of HandForge.
HandForge is a cross-platform audio and video converter built with:
- PyQt6 - GUI framework
- FFmpeg - Audio/video processing backend
- Python 3.9+ - Programming language
┌─────────────────────────────────────┐
│ UI Layer (PyQt6) │
│ (MainWindow, Dialogs, Widgets) │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Core Layer │
│ (Orchestrator, Models, Settings) │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Utility Layer │
│ (FFmpeg, File Operations) │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ External (FFmpeg) │
└─────────────────────────────────────┘
The main application window that provides:
- File queue management
- Workers table for progress tracking
- Menu system
- Settings dialogs
- Event handling
Manages the conversion process:
- Worker thread pool
- Job queue
- Parallel execution control
- Signal-based communication
Individual conversion worker:
- Runs in QThread
- Executes FFmpeg process
- Parses progress output
- Emits progress signals
Data structures:
Job- Represents a conversion job
Configuration management:
- JSON-based storage
- Settings, presets, patterns
- Auto-retry rules
- File cache
FFmpeg integration:
- Command building
- Process execution
- Path utilities
- Cover art handling
User Action
│
▼
MainWindow
│
▼
Creates Jobs
│
▼
Orchestrator.enqueue()
│
▼
Worker Threads
│
▼
FFmpeg Process
│
▼
Progress Signals
│
▼
UI Update
HandForge uses Qt's threading model:
- Main Thread: UI updates and event handling
- Worker Threads: FFmpeg process execution
- Signal/Slot: Thread-safe communication
Settings are stored in JSON files:
- Location:
~/.handforge/ - Files:
settings.json- Application settingspresets.json- Conversion presetspatterns.json- Filename patternsautoretry.json- Auto-retry rulesseen_files.json- Processed files cache
- FFmpeg errors are captured in stderr
- Worker signals indicate success/failure
- Auto-retry system handles transient errors
- Logs are stored for debugging
Future extensibility:
- Plugin system for custom codecs
- Custom metadata handlers
- Output format plugins
- Custom UI themes
- Parallel processing for multiple files
- Thread pool management
- Memory-efficient file processing
- Progress tracking without blocking
- PyQt6: GUI framework
- FFmpeg: Audio processing (external)
- Python stdlib: File operations, JSON, subprocess
- Separation of Concerns: UI, business logic, and utilities are separated
- Signal-Based Communication: Qt signals for thread-safe communication
- Modularity: Each component has a clear responsibility
- Extensibility: Easy to add new features
- User Experience: Responsive UI with real-time feedback
For development, see Contributing.