A comprehensive comic book management application that automates downloading, cataloging, and quality management for your comic collection. Built with FastAPI and SQLAlchemy, it integrates with multiple metadata providers and AirDC++ for seamless automated workflows.
- Multi-Provider Metadata: Search and fetch metadata from ComicVine, Metron, and GCD (Grand Comics Database)
- Intelligent Quality Scoring: Automatic quality evaluation (0-100 scale) based on format, file size, release group, and scan type
- Library Scanning: Recursive directory scanning with automatic issue matching and verification
- Download Integration: AirDC++ webhook support for automated post-processing of downloaded files
- Smart Metadata Generation: Auto-generate ComicInfo.xml (ComicRack) and MetronInfo.xml (Metron) formats
- Upgrade Detection: Identifies files eligible for quality upgrades
- Archive Support: Handle CBZ, CB7, CBR, and PDF formats with automatic conversion where possible
- TTH Verification: Tiger Tree Hash calculation for file verification and integrity checking
- Python: 3.8 or higher
- Database: SQLite (default, no setup needed) or PostgreSQL
- System Tools: For archive handling (CBR/RAR support)
- Linux:
sudo apt-get install unrar - macOS:
brew install unrar - Windows: Download from https://www.rarlab.com/rar_add.htm and add to PATH
- Linux:
- Disk Space: Adequate space for comic library and metadata cache
# Navigate to the project directory
cd Bazinga
cd backend# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Linux/macOS:
source venv/bin/activate
# On Windows (Command Prompt):
venv\Scripts\activate
# On Windows (PowerShell):
venv\Scripts\Activate.ps1Linux:
sudo apt-get update
sudo apt-get install unrar python3-devmacOS:
brew install unrarWindows:
- Download UnRAR from https://www.rarlab.com/rar_add.htm
- Extract and add the installation directory to your system PATH
- Verify: Open Command Prompt and type
unrar- should show help
# Upgrade pip
pip install --upgrade pip
# Install project dependencies
pip install -r requirements.txtThis installs:
- FastAPI and Uvicorn for the web framework
- SQLAlchemy for database ORM
- Pydantic for configuration and validation
- Metadata provider wrappers (Simyan, Mokkari, Grayven)
- Archive handling (rarfile, py7zr)
- And other required dependencies
# Copy example configuration
cp .env.example .env
# Edit the configuration file with your details
# See Configuration section below for all available optionsMinimal Configuration (.env):
At minimum, configure these required settings:
# Secret key for authentication - REQUIRED
# Generate a strong random string (e.g., python -c "import secrets; print(secrets.token_urlsafe(32))")
SECRET_KEY=your_secure_random_key_here
# Database
DATABASE_URL=sqlite:///./bazinga.db
# Directories (create these first)
SHARE_DIRECTORY=/path/to/comics/share
TAGGED_DIRECTORY=/path/to/comics/tagged
# At least one metadata provider API key
n# Processing Mode (optional, default is 'full')
# Options: 'full', 'tagged_only', 'share_only'
PROCESSING_MODE=full
COMICVINE_API_KEY=your_api_keyFull Configuration Options:
See CLAUDE.md Configuration Section for all available environment variables.
# Database
DATABASE_URL=sqlite:///./bazinga.db
# Or for PostgreSQL:
# DATABASE_URL=postgresql://user:password@localhost/bazinga
# Authentication
SECRET_KEY=your_secure_random_key_here
ENABLE_AUTH=true
# AirDC++ Integration (optional)
AIRDCPP_URL=http://localhost:5600
AIRDCPP_USERNAME=your_username
AIRDCPP_PASSWORD=your_password
# Metadata Providers (use at least one)
COMICVINE_API_KEY=your_api_key
METRON_USERNAME=your_metron_username
METRON_PASSWORD=your_metron_password
GCD_SQLITE_PATH=/path/to/gcd_database.sqlite
# Comic Directories
SHARE_DIRECTORY=/data/media/comics/share
TAGGED_DIRECTORY=/data/media/comics/tagged
# Quality Settings (optional - uses defaults if not set)
PREFERRED_FORMAT=cbz
QUALITY_UPGRADE_CHECK_THRESHOLD=70
QUALITY_MIN_UPGRADE_THRESHOLD=15
# Post-processing Settings (optional)
GENERATE_COMICINFO=true
GENERATE_METRONINFO=false
VERIFICATION_FILELISTS=/path/to/filelist1.xml
# Timeouts (optional - in seconds)
TTH_CALCULATION_TIMEOUT=300
PAGE_COUNT_EXTRACTION_TIMEOUT=60
POST_PROCESSING_TIMEOUT=300
AIRDCPP_SEARCH_TIMEOUT=30
AIRDCPP_REQUEST_TIMEOUT=30# Create directories for comics (update paths based on your .env)
mkdir -p /path/to/comics/share
mkdir -p /path/to/comics/tagged# Option 1: Using the database management script (recommended)
python manage_db.py init
# Option 2: Using Alembic migrations
alembic upgrade headExpected output:
INFO: Alembic version table created
INFO: Running upgrade script...
INFO: Database initialized successfully
# Test that all imports work
python -c "from app.core.config import settings; print('Configuration loaded successfully')"# Development mode with auto-reload
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Production mode (without reload)
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4Expected output:
INFO: Uvicorn running on http://0.0.0.0:8000
INFO: Application startup complete
- Check API Health: Open in browser:
http://localhost:8000/docs - Test Metadata Search:
http://localhost:8000/api/series/search?query=Batman - Check API Key Authentication: Submit test request with API key
Once running, test that everything is working:
# Search for a comic series
curl "http://localhost:8000/api/series/search?query=Batman"
# Test library scan
curl -X POST http://localhost:8000/api/library/scan \
-H "Content-Type: application/json" \
-d '{"directory": "/path/to/your/comics", "recursive": true}'Issue: ModuleNotFoundError: No module named 'app'
- Make sure you're in the
backend/directory - Verify virtual environment is activated
- Reinstall dependencies:
pip install -r requirements.txt
Issue: UnRAR not found
- Windows: Add UnRAR installation directory to system PATH environment variable
- Linux/macOS: Reinstall unrar (
brew install unrarorapt-get install unrar) - Application will work but CBR files won't be converted to CBZ
Issue: sqlite3.OperationalError: unable to open database file
- Verify
SHARE_DIRECTORYandTAGGED_DIRECTORYexist - Check disk space availability
- Ensure the application has write permissions to these directories
Issue: SECRET_KEY not configured
- Generate a key:
python -c "import secrets; print(secrets.token_urlsafe(32))" - Add to
.env:SECRET_KEY=<generated_key>
Issue: Port 8000 already in use
- Use a different port:
uvicorn main:app --port 8001 - Or kill process using port 8000
For more troubleshooting, see the Troubleshooting section below.
- Sign up at https://comicvine.gamespot.com/
- Get API key at https://comicvine.gamespot.com/api/
- Free tier available
- Create account at https://metron.cloud/
- Use your login credentials
- Free access for all users
Option 1: Database (Recommended)
- Download SQLite database from https://www.comics.org/download/
- Extract and use local file
- No account needed - instant lookups
Option 2: API
- Sign up at https://www.comics.org/
- Request API access
- May require approval
curl "http://localhost:8000/api/series/search?query=Batman"curl -X POST http://localhost:8000/api/library/scan \
-H "Content-Type: application/json" \
-d '{"directory": "/comics", "recursive": true}'curl "http://localhost:8000/api/library/upgrade-candidates"curl -X POST http://localhost:8000/api/process/ \
-H "Content-Type: application/json" \
-d '{"file_path": "/downloads/Batman.cbz"}'See the interactive API docs at http://localhost:8000/docs for all endpoints.
Quality scores are calculated on a 0-100 scale based on:
- Format (configurable): CBZ (100) > CB7 (90) > CBR (80) > PDF (50)
- File Size (configurable): 10-150 MB optimal (100pts), below 5MB or above 500MB penalized
- Release Group (configurable): Whitelist/blacklist settings
- Scan Type (configurable): Digital-HD (+15) > Digital (+10) > C2C (+5) > Web (-10)
- Verification Bonus (+20): TTH verified files
- Release Group Bonus (+20): Premium groups (Empire, DCP, Minutemen)
Files scoring below the upgrade threshold (default: 70) are automatically marked as upgrade candidates.
backend/
├── app/
│ ├── api/ # API endpoints
│ ├── clients/ # External API clients
│ ├── core/ # Configuration and auth
│ ├── jobs/ # Background jobs
│ ├── models/ # Database models
│ ├── providers/ # Metadata providers
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── utils/ # Utilities (TTH, etc.)
├── migrations/ # Database migrations
├── main.py # Application entry point
└── requirements.txt # Dependencies
- Configure API credentials in
.env - Run database migration
- Scan existing comic library
- Search across multiple metadata providers
- Add series to your library
- Background job searches for wanted issues
- AirDC++ downloads file
- Webhook triggers post-processing pipeline:
- TTH hash calculated and verified
- Quality scored
- Metadata generated (ComicInfo.xml/MetronInfo.xml)
- Page count detected
- Cover image extracted
- File moved to tagged directory
- Database updated with file path
- Review upgrade candidates
- Delete outdated/low-quality files
- Maintain optimal file format and size
The application implements several security measures:
- ✅ Credentials stored in environment variables (never hardcoded)
- ✅ SQL injection prevention via SQLAlchemy ORM
- ✅ Input validation and path sanitization
- ✅ JWT and API key authentication
- ✅ Rate limiting on endpoints
- ✅ Secure password hashing for stored credentials
See CLAUDE.md for detailed security assessment.
- CLAUDE.md - Complete technical documentation, architecture, and code quality assessment
- API Docs - Available at
/docsendpoint when application is running (Swagger UI) - Configuration - Full environment variable reference in CLAUDE.md
- Ensure UnRAR is installed and in your system PATH
- Windows: Download from https://www.rarlab.com/rar_add.htm
- Linux:
sudo apt-get install unrar - macOS:
brew install unrar - Note: Without UnRAR, CBR files are stored as-is without metadata
# Reset database (development only)
rm bazinga.db
alembic upgrade head- Increase
TTH_CALCULATION_TIMEOUTin.env(default: 300 seconds) - Check system resources - may indicate slow disk I/O
The application is optimized for performance:
- Async/Await: Non-blocking operations throughout
- Parallel API Calls: Query multiple providers simultaneously
- Database Fallback: GCD SQLite for instant metadata lookups
- Connection Pooling: Reuse HTTP connections
- Batch Operations: Optimized library scanning
- Metron Discord: https://discord.gg/metron
- ComicVine Forums: https://comicvine.gamespot.com/forums/
- GCD Mailing List: https://www.comics.org/contact/
- Issues: Report bugs at the project repository
[License information to be added]
Contributions are welcome! Please see the project repository for guidelines.
Version: 0.1.1 Last Updated: 2025-12-27 Status: Development
For detailed technical information, architecture, and security assessment, see CLAUDE.md.