Commit Graph

12 Commits

Author SHA1 Message Date
Ryan Chen
337d46cbb5 Add feed deletion and single video addition features
- Implemented DELETE /api/channels/<id> to remove channels and cleanup downloaded files
- Added delete button to channels page with confirmation dialog
- Added functionality to add single videos via URL
- Updated navigation menu
2025-11-26 15:56:29 -05:00
Ryan Chen
b059aab28f aligning navbar 2025-11-26 15:40:16 -05:00
Ryan Chen
acb2ec0654 Implement UI improvements and download management features
- Switch to light mode with black and white color scheme
- Simplify channel subscription to use channel ID only instead of RSS URL
- Add Downloads page to track all video download jobs
- Fix Flask-Login session management bug in user loader
- Always filter YouTube Shorts from feeds (case-insensitive)
- Fix download service video URL attribute error
- Fix watch page enum comparison for download status display

UI Changes:
- Update CSS to pure black/white/grayscale theme
- Remove colored text and buttons
- Use underlines for hover states instead of color changes
- Improve visual hierarchy with grayscale shades

Channel Subscription:
- Accept channel ID directly instead of full RSS URL
- Add validation for channel ID format (UC/UU prefix)
- Update help text and examples for easier onboarding

Downloads Page:
- New route at /downloads showing all video download jobs
- Display status, progress, and metadata for each download
- Sortable by status (downloading, pending, failed, completed)
- Actions to download, retry, or watch videos
- Responsive grid layout with thumbnails

Bug Fixes:
- Fix user loader to properly use database session context manager
- Fix download service accessing wrong attribute (link → video_url)
- Fix watch page template enum value comparisons
- Fix session detachment issues when accessing channel data

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 15:36:26 -05:00
Ryan Chen
067926e80d readme 2025-11-26 14:49:03 -05:00
Ryan Chen
637cf3b315 Update CLAUDE.md with comprehensive authentication documentation
- Added User Authentication section with security features
- Updated Frontend Interface section to note authentication requirement
- Updated Database Schema with users table and new channel/video fields
- Updated Database Layer architecture with User model details
- Updated Dependencies to include Flask-Login and bcrypt
- Documented user data isolation and multi-tenant architecture
- Added first-time setup instructions for registration

Documentation now reflects:
- Complete authentication system
- User-scoped data model
- Enhanced video metadata fields
- Security best practices

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:30:43 -05:00
Ryan Chen
1a4413ae1a Implement complete user authentication system
- Configured Flask-Login with user_loader
- Added register, login, logout routes with proper validation
- Created login.html and register.html templates with auth forms
- Updated base.html navigation to show username and conditional menu
- Added auth page styling to style.css
- Protected all routes with @login_required decorator
- Updated all routes to filter by current_user.id
- Added user ownership validation for:
  - Channels (can only view/refresh own channels)
  - Videos (can only watch/download own videos)
  - Streams (can only stream videos from own channels)
- Updated save_to_db() calls to pass current_user.id
- Improved user_loader to properly handle session management

Features:
- User registration with password confirmation
- Secure password hashing with bcrypt
- Login with "remember me" functionality
- Flash messages for all auth actions
- Redirect to requested page after login
- User-specific data isolation (multi-tenant)

Security:
- All sensitive routes require authentication
- Users can only access their own data
- Passwords hashed with bcrypt salt
- Session-based authentication via Flask-Login

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:29:31 -05:00
Ryan Chen
403d65e4ea Add user authentication system with schema refactor
BREAKING CHANGE: This commit introduces significant schema changes that require
a fresh database. See migration instructions below.

Changes:
- Added Flask-Login and bcrypt dependencies to pyproject.toml
- Created User model with password hashing methods
- Updated Channel model:
  - Added user_id foreign key relationship
  - Added rss_url field
  - Renamed last_fetched to last_fetched_at
  - Added composite unique index on (user_id, channel_id)
- Updated VideoEntry model:
  - Added video_id, video_url, thumbnail_url, description, published_at fields
  - Renamed link to video_url
  - Added indexes for performance
- Updated feed_parser.py:
  - Enhanced FeedEntry to extract thumbnail, description, published date
  - Added _extract_video_id() method for parsing YouTube URLs
  - Updated save_to_db() to require user_id parameter
  - Parse and store all metadata from RSS feeds
- Generated Alembic migration: a3c56d47f42a

Migration Instructions:
1. Stop all services: docker-compose down -v
2. Apply migrations: docker-compose up -d && docker-compose exec app alembic upgrade head
3. Or for local dev: rm yottob.db && alembic upgrade head

Next Steps (TODO):
- Configure Flask-Login in main.py
- Create login/register/logout routes
- Add @login_required decorators to protected routes
- Update all routes to filter by current_user
- Create auth templates (login.html, register.html)
- Update base.html with auth navigation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:24:47 -05:00
Ryan Chen
9bcd439024 Add complete frontend interface with Jinja2 templates
- Created base.html template with navigation and flash messages
- Created dashboard.html for video listing sorted by date
- Created channels.html for channel management
- Created add_channel.html with subscription form
- Created watch.html with HTML5 video player
- Created static/style.css with YouTube-inspired dark theme
- Updated main.py with frontend routes:
  - / (index): Dashboard with all videos
  - /channels: Channel management page
  - /add-channel: Add new channel form (GET/POST)
  - /watch/<video_id>: Video player page
- Added new API endpoints:
  - /api/videos/refresh/<channel_id>: Refresh channel videos
  - /api/video/stream/<video_id>: Stream/download video files
- Enhanced /api/download/<video_id> with status checks
- Updated CLAUDE.md with comprehensive frontend documentation

Features:
- Video grid with thumbnails and download status badges
- Inline download buttons for pending videos
- Channel subscription and refresh functionality
- HTML5 video player for downloaded videos
- Auto-refresh during video downloads
- Responsive design for mobile/desktop
- Flash message system for user feedback
- Dark theme with hover effects and animations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:18:33 -05:00
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