Docs: Update README with Docker Setup

This commit is contained in:
Khoa.vo 2025-12-17 07:57:39 +07:00
parent fb65d88e6b
commit bf47ec62ea
2 changed files with 59 additions and 83 deletions

140
README.md
View file

@ -1,103 +1,79 @@
# KV-Tube # KV-Tube
A YouTube-like video streaming web application with a pixel-perfect YouTube dark theme UI. A modern, ad-free YouTube web client and video proxy designed for **Synology NAS** and personal home servers.
## Recent Updates (v1.1) ## ✨ Features
- 🚀 **Performance**: Reduced Docker image size by using static `ffmpeg`.
- 📱 **Mobile UI**: Improved 2-column video grid layout and compact sort options on mobile.
- 📦 **NAS Support**: Fixed permission issues by running as root and added multi-arch support (AMD64/ARM64).
## Features - **Ad-Free Watching**: Clean interface without distractions.
- **Smart Search**: Directly search YouTube content.
- **Trending**: Browse trending videos by category (Tech, Music, Gaming, etc.).
- **Auto-Captions**: English subtitles automatically enabled if available.
- **AI Summary**: (Optional) Extractive summarization of video content running locally.
- **PWA Ready**: Installable on mobile devices with a responsive drawer layout.
- **Dark/Light Mode**: User preference persisted in settings.
- **Privacy Focused**: Everything runs on your server.
- 🎬 **YouTube Video Playback** - Stream any YouTube video via HLS proxy ## 🚀 Deployment
- 🎨 **YouTube Dark Theme** - Pixel-perfect recreation of YouTube's UI
- 📱 **Responsive Design** - Works on desktop, tablet, and mobile
- 🔍 **Search** - Search YouTube videos directly
- 📚 **Library** - Save videos and view history
- 🎯 **Categories** - Browse by Music, Gaming, News, Sports, etc.
- 🖥️ **Local Videos** - Play local video files
## Quick Start (Docker) ### Option A: Docker Compose (Recommended for Synology NAS)
### Build and Run This is the easiest way to run KV-Tube.
```bash 1. Create a folder named `kv-tube` on your NAS/Server.
# Build the image 2. Copy `docker-compose.yml` into that folder.
docker build -t kv-tube . 3. Create a `data` folder inside `kv-tube`.
4. Run the container.
# Run the container **docker-compose.yml**
docker run -d -p 5001:5001 --name kv-tube kv-tube ```yaml
version: '3.8'
services:
kv-tube:
image: vndangkhoa/kvtube:latest
container_name: kv-tube
restart: unless-stopped
ports:
- "5011:5001"
volumes:
- ./data:/app/data
environment:
- PYTHONUNBUFFERED=1
- FLASK_ENV=production
``` ```
### Using Docker Compose **Run Command:**
```bash ```bash
docker-compose up -d docker-compose up -d
``` ```
Access the app at `http://YOUR_NAS_IP:5011`
Access the app at: http://localhost:5001 ### Option B: Local Development (Python)
## Synology NAS Deployment 1. **Clone the repository:**
```bash
git clone https://github.com/vndangkhoa/kv-tube.git
cd kv-tube
```
### Option 1: Container Manager (Docker) 2. **Install Dependencies:**
```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
1. Open **Container Manager** on your Synology NAS 3. **Run:**
2. Go to **Project** → **Create** ```bash
3. Upload the `docker-compose.yml` file python3 app.py
4. Click **Build** and wait for completion ```
5. Access via `http://your-nas-ip:5001` Open `http://127.0.0.1:5001` in your browser.
### Option 2: Manual Docker ## 🛠️ Configuration
```bash The app is zero-config by default.
# SSH into your NAS - **Database**: SQLite (stored in `./data/kvtube.db`)
ssh admin@your-nas-ip - **Port**: 5001 (internal), mapped to 5011 in Docker compose example.
# Navigate to your docker folder ## 📝 License
cd /volume1/docker Proprietary / Personal Use.
# Clone/copy the project
git clone <repo-url> kv-tube
cd kv-tube
# Build and run
docker-compose up -d
```
## Project Structure
```
kv-tube/
├── app.py # Flask application
├── requirements.txt # Python dependencies
├── Dockerfile # Docker build config
├── docker-compose.yml # Docker Compose config
├── templates/ # HTML templates
│ ├── layout.html # Base layout (header, sidebar)
│ ├── index.html # Home page
│ ├── watch.html # Video player page
│ └── ...
├── static/
│ ├── css/style.css # YouTube-style CSS
│ └── js/main.js # Frontend JavaScript
└── kctube.db # SQLite database
```
## Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `FLASK_ENV` | production | Flask environment |
| `PYTHONUNBUFFERED` | 1 | Python output buffering |
## Tech Stack
- **Backend**: Flask + Gunicorn
- **Frontend**: Vanilla JS + Artplayer
- **Video**: yt-dlp + HLS.js
- **Database**: SQLite
- **Container**: Docker
## License
MIT

2
app.py
View file

@ -598,7 +598,7 @@ def summarize_video():
except Exception as e: except Exception as e:
return jsonify({'success': False, 'message': f'Could not summarize: {str(e)}'}) return jsonify({'success': False, 'message': f'Could not summarize: {str(e)}'})
@app.route('/api/trending') # Helper function to fetch videos (not a route)
def fetch_videos(query, limit=20): def fetch_videos(query, limit=20):
try: try:
cmd = [ cmd = [