Commit Graph

4 Commits

Author SHA1 Message Date
Ryan Chen
cf692d2299 Migrate to Docker Compose with PostgreSQL
- Created docker-compose.yml with 4 services:
  - postgres: PostgreSQL 16 database with persistent volume
  - redis: Redis 7 message broker
  - app: Flask web application (port 5000)
  - celery: Celery worker for async downloads
- Created Dockerfile with Python 3.14, FFmpeg, and uv
- Added psycopg2-binary dependency for PostgreSQL driver
- Updated database.py to use DATABASE_URL environment variable
  - Supports PostgreSQL in production
  - Falls back to SQLite for local development
- Updated celery_app.py to use environment variables:
  - CELERY_BROKER_URL and CELERY_RESULT_BACKEND
- Created .env.example with all configuration variables
- Created .dockerignore to optimize Docker builds
- Updated .gitignore to exclude .env and Docker files
- Updated CLAUDE.md with comprehensive Docker documentation:
  - Quick start with docker-compose commands
  - Environment variable configuration
  - Local development setup instructions
  - Service architecture overview

All services have health checks and automatic restart configured.
Start entire stack with: docker-compose up

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:09:40 -05:00
Ryan Chen
2305dfddb1 Add async video downloads with yt-dlp and Celery
- Added yt-dlp, celery, and redis dependencies to pyproject.toml
- Extended VideoEntry model with download tracking fields:
  - download_status (enum: pending, downloading, completed, failed)
  - download_path, download_started_at, download_completed_at
  - download_error, file_size
- Created celery_app.py with Redis broker configuration
- Created download_service.py with async download tasks:
  - download_video() task downloads as MP4 format
  - Configured yt-dlp for best MP4 quality with fallback
  - Automatic retries on failure (max 3 attempts)
  - Progress tracking and database updates
- Added Flask API endpoints in main.py:
  - POST /api/download/<video_id> to trigger download
  - GET /api/download/status/<video_id> to check status
  - POST /api/download/batch for bulk downloads
- Generated and applied Alembic migration for new fields
- Created downloads/ directory for video storage
- Updated .gitignore to exclude downloads/ directory
- Updated CLAUDE.md with comprehensive documentation:
  - Redis and Celery setup instructions
  - Download workflow and architecture
  - yt-dlp configuration details
  - New API endpoint examples

Videos are downloaded as MP4 files using Celery workers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:04:30 -05:00
Ryan Chen
4892bec986 Add SQLAlchemy ORM with Alembic migrations
- Added SQLAlchemy 2.0 and Alembic 1.13 dependencies
- Created models.py with Channel and VideoEntry ORM models
- Created database.py for database configuration and session management
- Initialized Alembic migration system with initial migration
- Updated feed_parser.py with save_to_db() method for persistence
- Updated main.py with database initialization and new API routes:
  - /api/feed now saves to database by default
  - /api/channels lists all tracked channels
  - /api/history/<channel_id> returns video history
- Updated .gitignore to exclude database files
- Updated CLAUDE.md with comprehensive ORM and migration documentation

Database uses SQLite (yottob.db) with upsert logic to avoid duplicates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 13:58:10 -05:00
Ryan Chen
f460fb4daf Reorganize codebase: separate server architecture from business logic
- Created feed_parser.py module with YouTubeFeedParser and FeedEntry classes
- Refactored main.py to focus on Flask routing with two endpoints:
  - GET / for homepage
  - GET /api/feed for REST API with query parameters
- Updated CLAUDE.md with new architecture documentation
- Implemented clean separation between core logic and web server layers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 13:52:20 -05:00