feat: 优化播放列表生成逻辑,过滤非视频文件
torbox-admin / deploy (push) Successful in 2m4s

This commit is contained in:
2026-10-06 02:49:37 -07:00
parent b376863123
commit dd032e34e7
+4 -1
View File
@@ -3,7 +3,7 @@ import type { NextRequest } from "next/server";
import { guard, jsonError } from "@/server/auth";
import { createLogger } from "@/server/logger";
import { getLibrary } from "@/server/torbox";
import { buildStreamUrl } from "@/utils/media";
import { buildStreamUrl, getBaseName, getMediaKind } from "@/utils/media";
const log = createLogger("playlist");
@@ -22,6 +22,9 @@ export async function GET(req: NextRequest) {
for (const item of items) {
if (item.status !== "ready") continue;
for (const file of item.files) {
// 只收录视频,字幕、压缩包、文本等传给播放器没有意义
const name = getBaseName(file.short_name ?? file.name);
if (getMediaKind(name, file.mimetype) !== "video") continue;
const title = `${item.name} / ${file.short_name ?? file.name}`.replace(
/[\r\n,]/g,
" "