diff --git a/README.md b/README.md index 7dc8ffa..507111b 100644 --- a/README.md +++ b/README.md @@ -1,103 +1,79 @@ # 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) -- 🚀 **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 -## 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 -- 🎨 **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 +## 🚀 Deployment -## Quick Start (Docker) +### Option A: Docker Compose (Recommended for Synology NAS) -### Build and Run +This is the easiest way to run KV-Tube. -```bash -# Build the image -docker build -t kv-tube . +1. Create a folder named `kv-tube` on your NAS/Server. +2. Copy `docker-compose.yml` into that folder. +3. Create a `data` folder inside `kv-tube`. +4. Run the container. -# Run the container -docker run -d -p 5001:5001 --name kv-tube kv-tube +**docker-compose.yml** +```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 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 -2. Go to **Project** → **Create** -3. Upload the `docker-compose.yml` file -4. Click **Build** and wait for completion -5. Access via `http://your-nas-ip:5001` +3. **Run:** + ```bash + python3 app.py + ``` + Open `http://127.0.0.1:5001` in your browser. -### Option 2: Manual Docker +## 🛠️ Configuration -```bash -# SSH into your NAS -ssh admin@your-nas-ip +The app is zero-config by default. +- **Database**: SQLite (stored in `./data/kvtube.db`) +- **Port**: 5001 (internal), mapped to 5011 in Docker compose example. -# Navigate to your docker folder -cd /volume1/docker - -# Clone/copy the project -git clone 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 +## 📝 License +Proprietary / Personal Use. diff --git a/app.py b/app.py index 1d11bdc..ad1398e 100644 --- a/app.py +++ b/app.py @@ -598,7 +598,7 @@ def summarize_video(): except Exception as 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): try: cmd = [