From 8c2db37d4512dc2f4eeead89ef485fbb448a7ca3 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Sun, 11 Jan 2026 20:10:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B1=81=E5=85=8D=E5=B0=8F=E9=9B=85=E4=BC=98?= =?UTF-8?q?=E9=80=89=E5=92=8C=E6=B5=8B=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/xiaoya/play/route.ts | 8 ++++---- src/app/play/page.tsx | 10 +++++++--- src/components/EpisodeSelector.tsx | 26 ++++++++++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/app/api/xiaoya/play/route.ts b/src/app/api/xiaoya/play/route.ts index b621d26..bc59c03 100644 --- a/src/app/api/xiaoya/play/route.ts +++ b/src/app/api/xiaoya/play/route.ts @@ -128,17 +128,17 @@ export async function GET(request: NextRequest) { const qualityOrder: Record = { 'FHD': 1, 'HD': 2, - 'SD': 3, - 'LD': 4, + 'LD': 3, + 'SD': 4, }; const qualities = taskList - .filter((task: any) => task.status === 'finished') + .filter((task: any) => task.status === 'finished') .map((task: any) => ({ name: task.template_id, url: task.url, })) - .sort((a, b) => (qualityOrder[a.name] || 999) - (qualityOrder[b.name] || 999)); + .sort((a: any, b: any) => (qualityOrder[a.name] || 999) - (qualityOrder[b.name] || 999)); if (qualities.length === 0) { throw new Error('未找到已完成的播放链接'); diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 5753c95..eb84220 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -2577,7 +2577,7 @@ function PlayPageClient() { setLoadingStage('preferring'); setLoadingMessage('⚡ 正在优选最佳播放源...'); - // 过滤掉 openlist 和所有 emby 源,它们不参与测速 + // 过滤掉 openlist、所有 emby 源和 xiaoya 源,它们不参与测速 const sourcesToTest = sourcesInfo.filter(s => { // 检查是否为 openlist if (s.source === 'openlist') return false; @@ -2585,19 +2585,23 @@ function PlayPageClient() { // 检查是否为 emby 源(包括 emby 和 emby_xxx 格式) if (s.source === 'emby' || s.source.startsWith('emby_')) return false; + // 检查是否为 xiaoya 源 + if (s.source === 'xiaoya') return false; + return true; }); const excludedSources = sourcesInfo.filter(s => s.source === 'openlist' || s.source === 'emby' || - s.source.startsWith('emby_') + s.source.startsWith('emby_') || + s.source === 'xiaoya' ); if (sourcesToTest.length > 0) { detailData = await preferBestSource(sourcesToTest); } else if (excludedSources.length > 0) { - // 如果只有 openlist/emby 源,直接使用第一个 + // 如果只有 openlist/emby/xiaoya 源,直接使用第一个 detailData = excludedSources[0]; } else { detailData = sourcesInfo[0]; diff --git a/src/components/EpisodeSelector.tsx b/src/components/EpisodeSelector.tsx index d75d964..6d7f317 100644 --- a/src/components/EpisodeSelector.tsx +++ b/src/components/EpisodeSelector.tsx @@ -271,16 +271,18 @@ const EpisodeSelector: React.FC = ({ if ( !optimizationEnabled || // 若关闭测速则直接退出 activeTab !== 'sources' || - availableSources.length === 0 || - currentSource === 'openlist' || // 私人影库不进行测速 - currentSource === 'emby' // Emby 不进行测速 + availableSources.length === 0 ) return; - // 筛选出尚未测速的播放源 + // 筛选出尚未测速的播放源,并排除不需要测速的源(openlist/emby/xiaoya) const pendingSources = availableSources.filter((source) => { const sourceKey = `${source.source}-${source.id}`; - return !attemptedSourcesRef.current.has(sourceKey); + // 跳过已测速的源 + if (attemptedSourcesRef.current.has(sourceKey)) return false; + // 跳过不需要测速的源 + if (source.source === 'openlist' || source.source === 'emby' || source.source.startsWith('emby_') || source.source === 'xiaoya') return false; + return true; }); if (pendingSources.length === 0) return; @@ -308,11 +310,15 @@ const EpisodeSelector: React.FC = ({ // 当后台加载从 true 变为 false 时(即加载完成) if (prevBackgroundLoadingRef.current && !backgroundSourcesLoading) { // 如果当前选项卡在换源位置,触发测速 - if (activeTab === 'sources' && optimizationEnabled && currentSource !== 'openlist' && currentSource !== 'emby') { - // 筛选出尚未测速的播放源 + if (activeTab === 'sources' && optimizationEnabled) { + // 筛选出尚未测速的播放源,并排除不需要测速的源(openlist/emby/xiaoya) const pendingSources = availableSources.filter((source) => { const sourceKey = `${source.source}-${source.id}`; - return !attemptedSourcesRef.current.has(sourceKey); + // 跳过已测速的源 + if (attemptedSourcesRef.current.has(sourceKey)) return false; + // 跳过不需要测速的源 + if (source.source === 'openlist' || source.source === 'emby' || source.source.startsWith('emby_') || source.source === 'xiaoya') return false; + return true; }); if (pendingSources.length > 0) { @@ -907,8 +913,8 @@ const EpisodeSelector: React.FC = ({ {/* 重新测试按钮 */} {(() => { - // 私人影库和 Emby 不显示重新测试按钮 - if (source.source === 'openlist' || source.source === 'emby' || source.source.startsWith('emby_')) { + // 私人影库、Emby 和小雅不显示重新测试按钮 + if (source.source === 'openlist' || source.source === 'emby' || source.source.startsWith('emby_') || source.source === 'xiaoya') { return null; }