diff --git a/common/i18n/locale/en.yaml b/common/i18n/locale/en.yaml index 40f6e89..e944e8c 100644 --- a/common/i18n/locale/en.yaml +++ b/common/i18n/locale/en.yaml @@ -351,7 +351,7 @@ bot: info_filename_prefix: "Filename: " info_prompt_select_storage: "\nPlease select storage" progress: - batch_status_header: "📦 Processing\n\nFiles: {{.Total}}\nStatus: ✅ {{.Completed}} | 📥 {{.Downloaded}} | ⏳ {{.Waiting}}\nTotal speed: ⬇️ {{.DownloadSpeed}} | ⬆️ {{.UploadSpeed}}" + batch_status_header: "📦 Processing\n\nFiles: {{.Total}} | Total size: {{.TotalSize}}\nStatus: ✅ {{.Completed}} | 📥 {{.Downloaded}} | ⏳ {{.Waiting}}\nTotal speed: ⬇️ {{.DownloadSpeed}} | ⬆️ {{.UploadSpeed}}" batch_item_downloading: "
⬇️ {{.Index}}/{{.Total}} Downloading\n{{.Name}}\n{{.Bar}} {{.Progress}}%\nSpeed: {{.Speed}}\nSize: {{.Current}} / {{.Size}}
" batch_item_downloading_unknown: "
⬇️ {{.Index}}/{{.Total}} Downloading\n{{.Name}}\nSpeed: {{.Speed}}\nSize: {{.Current}} / unknown
" batch_item_transferring: "
↕️ {{.Index}}/{{.Total}} Transferring\n{{.Name}}\n{{.Bar}} {{.Progress}}%\nSpeed: {{.Speed}}\nSize: {{.Current}} / {{.Size}}
" diff --git a/common/i18n/locale/zh-Hans.yaml b/common/i18n/locale/zh-Hans.yaml index 1b2cc71..dc05fd9 100644 --- a/common/i18n/locale/zh-Hans.yaml +++ b/common/i18n/locale/zh-Hans.yaml @@ -352,7 +352,7 @@ bot: info_filename_prefix: "文件名: " info_prompt_select_storage: "\n请选择存储位置" progress: - batch_status_header: "📦 正在处理\n\n文件:{{.Total}}\n状态:✅ {{.Completed}} | 📥 {{.Downloaded}} | ⏳ {{.Waiting}}\n总速度:⬇️ {{.DownloadSpeed}} | ⬆️ {{.UploadSpeed}}" + batch_status_header: "📦 正在处理\n\n文件:{{.Total}} | 总大小:{{.TotalSize}}\n状态:✅ {{.Completed}} | 📥 {{.Downloaded}} | ⏳ {{.Waiting}}\n总速度:⬇️ {{.DownloadSpeed}} | ⬆️ {{.UploadSpeed}}" batch_item_downloading: "
⬇️ {{.Index}}/{{.Total}} 下载中\n{{.Name}}\n{{.Bar}} {{.Progress}}%\n速度:{{.Speed}}\n大小:{{.Current}} / {{.Size}}
" batch_item_downloading_unknown: "
⬇️ {{.Index}}/{{.Total}} 下载中\n{{.Name}}\n速度:{{.Speed}}\n大小:{{.Current}} / 未知
" batch_item_transferring: "
↕️ {{.Index}}/{{.Total}} 传输中\n{{.Name}}\n{{.Bar}} {{.Progress}}%\n速度:{{.Speed}}\n大小:{{.Current}} / {{.Size}}
" diff --git a/core/tasks/batchtfile/progress.go b/core/tasks/batchtfile/progress.go index 52fac1d..a7c6ef7 100644 --- a/core/tasks/batchtfile/progress.go +++ b/core/tasks/batchtfile/progress.go @@ -152,6 +152,7 @@ func buildBatchProgressMessage(info TaskInfo, skipped []string, activeLimit int) uploadSpeedText := formatSpeed(uploadSpeed) header := localizedProgressMarkup(i18nk.BotMsgProgressBatchStatusHeader, map[string]any{ "Total": total, + "TotalSize": dlutil.FormatSize(info.ActualTotalSize()), "Completed": completed, "Downloaded": downloaded, "Waiting": waiting, diff --git a/core/tasks/batchtfile/progress_regression_test.go b/core/tasks/batchtfile/progress_regression_test.go index 750c58c..dc6dcb5 100644 --- a/core/tasks/batchtfile/progress_regression_test.go +++ b/core/tasks/batchtfile/progress_regression_test.go @@ -95,6 +95,30 @@ func TestBatchProgressShowsTransferSpeedAndSize(t *testing.T) { } } +func TestBatchProgressHeaderShowsTotalSize(t *testing.T) { + useProgressRegressionLocale(t) + task := newProgressRegressionTask(nil, + progressRegressionFile{"first", 1024}, + progressRegressionFile{"second", 1024}, + ) + message := buildBatchProgressMessage(task, nil, 2) + if message.Err != nil { + t.Fatalf("buildBatchProgressMessage() failed: %v", message.Err) + } + assertProgressRegressionContains(t, message.Text, + "文件:2 | 总大小:2.00 KB", + ) + + i18n.Init("en") + english := buildBatchProgressMessage(task, nil, 2) + if english.Err != nil { + t.Fatalf("English batch template failed: %v", english.Err) + } + assertProgressRegressionContains(t, english.Text, + "Files: 2 | Total size: 2.00 KB", + ) +} + func TestBatchProgressLimitsRowsWithoutHidingActiveUpload(t *testing.T) { useProgressRegressionLocale(t) task := newProgressRegressionTask(nil,