# Documentation

This directory contains comprehensive documentation for the Watch Finished Turbo project.

## Files

- **[architecture.md](architecture.md)** - Complete system architecture documentation with Mermaid.js diagrams
  - System overview and components
  - Data flows and event architecture
  - Service interactions and API endpoints
  - Database schema and deployment architecture
  - Error handling and performance considerations
- **[cli.md](cli.md)** - Command-line interface documentation
  - Complete CLI command reference
  - Task management commands
  - Queue configuration and monitoring
  - Configuration management
  - Examples and usage patterns

## System Overview

Watch Finished Turbo is a video processing system that:

1. **Automatically detects** new video files in configured directories using file system watching
2. **Creates processing tasks** immediately when video files are detected
3. **Processes videos automatically** using HandBrake with configurable presets via a background task queue
4. **Provides manual control** through a web interface for requeuing failed tasks or changing priorities
5. **Tracks progress and status** in real-time via WebSocket events
6. **Stores all data** in a local SQLite database

## Key Features

- **Automatic File Detection**: File system monitoring with Chokidar detects new video files instantly
- **Task-Based Processing**: Background task queue processes files automatically with priority handling
- **Advanced Queue Management**: Configurable batch processing, concurrency limits, and automatic retry logic
- **Real-time Progress Tracking**: Live updates during video encoding via WebSocket
- **Manual Override Control**: Web interface allows manual requeuing and priority management
- **Dataset Management**: Configurable processing presets per directory
- **Modern Web UI**: React/Next.js interface with real-time updates and dark mode support
- **Event-Driven Architecture**: WebSocket-based real-time communication
- **Comprehensive CLI**: Full command-line interface for all system operations

## Quick Start

1. Configure your dataset directories and HandBrake presets
2. Start the file watcher to begin automatic monitoring
3. Video files added to watched directories are automatically detected and queued for processing
4. The system processes files in the background using the task queue
5. Monitor progress in real-time through the web UI
6. Use manual requeue for failed tasks or to change processing priorities
7. Access processed files once encoding is complete

## Implementation Status

✅ **Automatic Processing**: File detection triggers immediate task creation and background processing
✅ **Task Queue System**: Priority-based queue with concurrent processing limits
✅ **Advanced Queue Settings**: Configurable batch size, concurrency, retry logic, and processing intervals
✅ **Real-time Monitoring**: WebSocket events for live progress updates
✅ **Manual Override**: Web interface allows requeuing failed tasks with custom priorities
✅ **Enhanced Task Model**: Tasks contain all necessary processing metadata with retry tracking
✅ **Comprehensive CLI**: Full command-line interface for task management and queue configuration
✅ **Deployment**: Docker Compose for containerized deployment
