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>
This commit is contained in:
95
CLAUDE.md
95
CLAUDE.md
@@ -111,14 +111,35 @@ python main.py
|
||||
# Run the Flask web application
|
||||
flask --app main run
|
||||
```
|
||||
The web server exposes:
|
||||
- `/` - Main page (renders `index.html`)
|
||||
- `/api/feed` - API endpoint for fetching feeds and saving to database
|
||||
- `/api/channels` - List all tracked channels
|
||||
- `/api/history/<channel_id>` - Get video history for a specific channel
|
||||
|
||||
## Frontend Interface
|
||||
|
||||
The application includes a full-featured web interface built with Jinja2 templates:
|
||||
|
||||
**Pages:**
|
||||
- `/` - Dashboard showing all videos sorted by date (newest first)
|
||||
- `/channels` - Channel management page with refresh functionality
|
||||
- `/add-channel` - Form to subscribe to new YouTube channels
|
||||
- `/watch/<video_id>` - Video player page for watching downloaded videos
|
||||
|
||||
**Features:**
|
||||
- Video grid with thumbnails and metadata
|
||||
- Real-time download status indicators (pending, downloading, completed, failed)
|
||||
- Inline video downloads from dashboard
|
||||
- HTML5 video player for streaming downloaded videos
|
||||
- Channel subscription and management
|
||||
- Refresh individual channels to fetch new videos
|
||||
- Responsive design for mobile and desktop
|
||||
|
||||
**API Endpoints:**
|
||||
- `/api/feed` - Fetch YouTube channel feed and save to database (GET)
|
||||
- `/api/channels` - List all tracked channels (GET)
|
||||
- `/api/history/<channel_id>` - Get video history for a specific channel (GET)
|
||||
- `/api/download/<video_id>` - Trigger video download (POST)
|
||||
- `/api/download/status/<video_id>` - Check download status (GET)
|
||||
- `/api/download/batch` - Batch download multiple videos (POST)
|
||||
- `/api/videos/refresh/<channel_id>` - Refresh videos for a channel (POST)
|
||||
- `/api/video/stream/<video_id>` - Stream or download video file (GET)
|
||||
|
||||
**API Usage Examples:**
|
||||
```bash
|
||||
@@ -192,19 +213,59 @@ The codebase follows a clean layered architecture with separation of concerns:
|
||||
|
||||
### Web Server Layer
|
||||
**`main.py`** - Flask application and routes
|
||||
- `app`: Flask application instance (main.py:10)
|
||||
- Database initialization on startup (main.py:16)
|
||||
- `index()`: Homepage route handler (main.py:21)
|
||||
- `get_feed()`: REST API endpoint (main.py:27) that fetches and saves to DB
|
||||
- `get_channels()`: Lists all tracked channels (main.py:60)
|
||||
- `get_history()`: Returns video history for a channel (main.py:87)
|
||||
- `trigger_download()`: Queue video download task (main.py:134)
|
||||
- `get_download_status()`: Check download status (main.py:163)
|
||||
- `trigger_batch_download()`: Queue multiple downloads (main.py:193)
|
||||
- `main()`: CLI entry point for testing (main.py:251)
|
||||
|
||||
### Templates
|
||||
**`templates/index.html`** - Frontend HTML (currently static placeholder)
|
||||
**Frontend Routes:**
|
||||
- `index()`: Dashboard page with all videos sorted by date (main.py:24)
|
||||
- `channels_page()`: Channel management page (main.py:40)
|
||||
- `add_channel_page()`: Add channel form and subscription handler (main.py:52)
|
||||
- `watch_video()`: Video player page (main.py:94)
|
||||
|
||||
**API Routes:**
|
||||
- `get_feed()`: Fetch YouTube feed and save to database (main.py:110)
|
||||
- `get_channels()`: List all tracked channels (main.py:145)
|
||||
- `get_history()`: Video history for a channel (main.py:172)
|
||||
- `trigger_download()`: Queue video download task (main.py:216)
|
||||
- `get_download_status()`: Check download status (main.py:258)
|
||||
- `trigger_batch_download()`: Queue multiple downloads (main.py:290)
|
||||
- `refresh_channel_videos()`: Refresh videos for a channel (main.py:347)
|
||||
- `stream_video()`: Stream or download video file (main.py:391)
|
||||
|
||||
### Frontend Templates
|
||||
**`templates/base.html`** - Base template with navigation and common layout
|
||||
- Navigation bar with logo and menu
|
||||
- Flash message display system
|
||||
- Common styles and responsive design
|
||||
|
||||
**`templates/dashboard.html`** - Main video listing page
|
||||
- Video grid sorted by published date (newest first)
|
||||
- Thumbnail display with download status badges
|
||||
- Inline download buttons for pending videos
|
||||
- Empty state for new installations
|
||||
|
||||
**`templates/channels.html`** - Channel management interface
|
||||
- List of subscribed channels with metadata
|
||||
- Refresh button to fetch new videos per channel
|
||||
- Link to add new channels
|
||||
- Video count and last updated timestamps
|
||||
|
||||
**`templates/add_channel.html`** - Channel subscription form
|
||||
- Form to input YouTube RSS feed URL
|
||||
- Help section with instructions on finding RSS URLs
|
||||
- Examples and format guidance
|
||||
|
||||
**`templates/watch.html`** - Video player page
|
||||
- HTML5 video player for downloaded videos
|
||||
- Download status placeholders (downloading, failed, pending)
|
||||
- Video metadata (title, channel, publish date)
|
||||
- Download button for pending videos
|
||||
- Auto-refresh when video is downloading
|
||||
|
||||
**`static/style.css`** - Application styles
|
||||
- Dark theme inspired by YouTube
|
||||
- Responsive grid layout
|
||||
- Video card components
|
||||
- Form styling
|
||||
- Badge and button components
|
||||
|
||||
## Feed Parsing Implementation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user