From 54678eb83ffec90599d79238575c4cd2caffddbb Mon Sep 17 00:00:00 2001 From: Joftal <42807405+Joftal@users.noreply.github.com> Date: Mon, 17 Aug 2026 16:01:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(recorders):=20=E9=80=9A=E7=9F=A5=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=97=B6=E6=B8=85=E7=90=86=E6=97=A0=E5=85=B3=E8=81=94?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9A=84=E5=AD=A4=E7=AB=8B=20.ass=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DAA 发现的 .ass 标记为 Deletable(不标记 uploaded),executor 删除视频后 .ass 从 recordedFiles 加入 merged,但通知误显为本地保留。 修复:合并后检查 .ass 的关联视频是否在列表中,无视频的 .ass 被移除。 与 executor 的 cleanupOrphanedAssFiles 逻辑一致。 Co-Authored-By: Kscc --- src/recorders/recorder.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/recorders/recorder.go b/src/recorders/recorder.go index a056be7..257a8ed 100644 --- a/src/recorders/recorder.go +++ b/src/recorders/recorder.go @@ -1090,6 +1090,8 @@ func (r *recorder) sendAccumulatedSummary() { merged = append(merged, f) } } + // 清理无关联视频的 .ass 文件(DAA/executor 可能已删除视频但 .ass 从 recordedFiles 加入) + merged = filterOrphanedAssFromDetails(merged) } r.getLogger().Infof("推送 Pipeline 录制摘要:%d 个文件", len(merged)) hostName := "" @@ -1233,6 +1235,33 @@ func collectSourceNames(sourceNames map[string]bool, fileSets ...[]pipeline.File } } +// filterOrphanedAssFromDetails 从文件详情列表中移除无关联视频的 .ass 文件 +// 当 DAA/executor 删除了视频但 .ass 从 recordedFiles 加入 merged 时, +// 需要清理这些孤立的 .ass,避免通知误显为本地保留 +func filterOrphanedAssFromDetails(details []notify.RecordingFileDetail) []notify.RecordingFileDetail { + videoExts := map[string]bool{".flv": true, ".mp4": true, ".mkv": true, ".ts": true} + videoBases := map[string]bool{} + for _, d := range details { + ext := strings.ToLower(filepath.Ext(d.Name)) + if videoExts[ext] { + base := strings.TrimSuffix(d.Name, ext) + videoBases[base] = true + } + } + var result []notify.RecordingFileDetail + for _, d := range details { + ext := strings.ToLower(filepath.Ext(d.Name)) + if ext == ".ass" { + base := strings.TrimSuffix(d.Name, ".ass") + if !videoBases[base] { + continue // 无关联视频,跳过 + } + } + result = append(result, d) + } + return result +} + func (r *recorder) logStreamURLRetry(err error) { if configs.IsDebug() || !strings.EqualFold(r.Live.GetPlatformCNName(), "SOOP") { r.warnStreamURLRetry(err, "failed to get stream url, will retry after 5s...", 0)