fix(ui): show anime name with season in downloader page

When save_path ends with a season-only folder (Season 1, S01, 第1季),
display "Anime Name / Season 1" instead of just "Season 1"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Estrella Pan
2026-01-25 09:47:50 +01:00
parent c9724179fb
commit 9ae643e40e
2 changed files with 11 additions and 3 deletions

View File

@@ -36,6 +36,7 @@
- 规则编辑器新增剧集偏移字段和「自动检测」按钮
- 新增 i18n 翻译(中文/英文)
- 优化规则编辑弹窗布局:统一表单字段对齐、统一按钮高度、修复移动端底部弹窗 z-index 层级问题
- 修复下载器页面仅显示季度文件夹名的问题,现在会显示「番剧名 / Season 1」格式
---

View File

@@ -16,9 +16,16 @@ export const useDownloaderStore = defineStore('downloader', () => {
}
const result: TorrentGroup[] = [];
// Regex to detect season-only folder names like "Season 1", "S01", "第1季", etc.
const seasonOnlyRegex = /^(Season\s*\d+|S\d+|第\d+季)$/i;
for (const [savePath, items] of map) {
const parts = savePath.replace(/\/$/, '').split('/');
const name = parts[parts.length - 1] || savePath;
const parts = savePath.replace(/\/$/, '').split('/').filter(Boolean);
let name = parts[parts.length - 1] || savePath;
// If the last part is just a season folder, include the parent folder too
if (parts.length >= 2 && seasonOnlyRegex.test(name)) {
name = `${parts[parts.length - 2]} / ${name}`;
}
const totalSize = items.reduce((sum, t) => sum + t.size, 0);
const overallProgress =
totalSize > 0
@@ -65,7 +72,7 @@ export const useDownloaderStore = defineStore('downloader', () => {
opts
);
const { execute: deleteSelected } = useApi(
(deleteFiles: boolean = false) =>
(deleteFiles = false) =>
apiDownloader.deleteTorrents(selectedHashes.value, deleteFiles),
opts
);