diff --git a/README-zh.md b/README-zh.md index 249818b..39ae956 100644 --- a/README-zh.md +++ b/README-zh.md @@ -9,9 +9,11 @@ ## 功能特点 - **视频下载**:通过简单的 URL 输入下载 YouTube 和 Bilibili 视频。 +- **视频上传**:直接上传本地视频文件到您的库,并自动生成缩略图。 - **Bilibili 支持**:支持下载单个视频、多P视频以及整个合集/系列。 - **并行下载**:支持队列下载,可同时追踪多个下载任务的进度。 - **本地库**:自动保存视频缩略图和元数据,提供丰富的浏览体验。 +- **视频播放器**:自定义播放器,支持播放/暂停、循环和快进/快退控制。 - **搜索功能**:支持在本地库中搜索视频,或在线搜索 YouTube 视频。 - **收藏夹**:创建自定义收藏夹以整理您的视频。 - **现代化 UI**:响应式深色主题界面,包含“返回主页”功能和玻璃拟态效果。 @@ -103,6 +105,7 @@ npm run build # 为生产环境构建前端 ### 视频 - `POST /api/download` - 下载视频 (YouTube 或 Bilibili) +- `POST /api/upload` - 上传本地视频文件 - `GET /api/videos` - 获取所有已下载的视频 - `GET /api/videos/:id` - 获取特定视频 - `DELETE /api/videos/:id` - 删除视频 diff --git a/README.md b/README.md index ea283aa..12ae20f 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,11 @@ A YouTube/Bilibili video downloader and player application that allows you to do ## Features - **Video Downloading**: Download YouTube and Bilibili videos with a simple URL input. +- **Video Upload**: Upload local video files directly to your library with automatic thumbnail generation. - **Bilibili Support**: Support for downloading single videos, multi-part videos, and entire collections/series. - **Parallel Downloads**: Queue multiple downloads and track their progress simultaneously. - **Local Library**: Automatically save video thumbnails and metadata for a rich browsing experience. +- **Video Player**: Custom player with Play/Pause, Loop, and Seek controls. - **Search**: Search for videos locally in your library or online via YouTube. - **Collections**: Organize videos into custom collections for easy access. - **Modern UI**: Responsive, dark-themed interface with a "Back to Home" feature and glassmorphism effects. @@ -104,6 +106,7 @@ npm run build # Build the frontend for production ### Videos - `POST /api/download` - Download a video (YouTube or Bilibili) +- `POST /api/upload` - Upload a local video file - `GET /api/videos` - Get all downloaded videos - `GET /api/videos/:id` - Get a specific video - `DELETE /api/videos/:id` - Delete a video diff --git a/backend/src/controllers/videoController.ts b/backend/src/controllers/videoController.ts index 143f516..0744e7b 100644 --- a/backend/src/controllers/videoController.ts +++ b/backend/src/controllers/videoController.ts @@ -1,3 +1,4 @@ +import { exec } from "child_process"; import { Request, Response } from "express"; import fs from "fs-extra"; import multer from "multer"; @@ -7,12 +8,12 @@ import downloadManager from "../services/downloadManager"; import * as downloadService from "../services/downloadService"; import * as storageService from "../services/storageService"; import { - extractBilibiliVideoId, - extractUrlFromText, - isBilibiliUrl, - isValidUrl, - resolveShortUrl, - trimBilibiliUrl + extractBilibiliVideoId, + extractUrlFromText, + isBilibiliUrl, + isValidUrl, + resolveShortUrl, + trimBilibiliUrl } from "../utils/helpers"; // Configure Multer for file uploads @@ -401,7 +402,6 @@ export const getVideoComments = async (req: Request, res: Response): Promise => { diff --git a/frontend/src/types.ts b/frontend/src/types.ts index c72bb8c..e4c3ed6 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -3,7 +3,7 @@ export interface Video { title: string; author: string; date: string; - source: 'youtube' | 'bilibili'; + source: 'youtube' | 'bilibili' | 'local'; sourceUrl: string; videoFilename?: string; thumbnailFilename?: string;