From 8a639576b6b2e9ab3869586c14e89a820df7e456 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Fri, 9 Jan 2026 15:36:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=88=9B=E5=BB=BAm3u?= =?UTF-8?q?8=E6=96=87=E4=BB=B6=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增createM3u8函数用于生成m3u8文件路径,当任务进行中时返回原视频mp4路径 --- index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index bdfe985..7993188 100644 --- a/index.js +++ b/index.js @@ -114,6 +114,13 @@ function getMimeFromUrl(u) { return 'image/jpeg'; } +/** + * 创建m3u8文件, 并返回 m3u8 路径, 如任务正在进行中则返回原视频 mp4 路径 + */ +async function createM3u8Task(contentPath, apiData) { + +} + /** * 生成缩略图并缓存 * @param {*} reply @@ -372,8 +379,6 @@ async function downloadAndServe(reply, apiData, contentPath, key) { }); } - - if (task.done && fs.existsSync(contentPath)) { console.log('Download completed:', key); if (isValidThumbSpec(apiData.data.thumb)) { @@ -382,12 +387,10 @@ async function downloadAndServe(reply, apiData, contentPath, key) { return serveCompletedCache(reply, apiData, contentPath);//reply, apiData, contentPath } - console.log('Downloading:', key); if (isValidThumbSpec(apiData.data.thumb)) { return generateThumbAndCache(reply, apiData, contentPath).catch(() => { }); } - // Serve growing file return serveGrowingFile(reply, task, apiData); }