fix(recorders): 通知合并时清理无关联视频的孤立 .ass 文件
DAA 发现的 .ass 标记为 Deletable(不标记 uploaded),executor 删除视频后 .ass 从 recordedFiles 加入 merged,但通知误显为本地保留。 修复:合并后检查 .ass 的关联视频是否在列表中,无视频的 .ass 被移除。 与 executor 的 cleanupOrphanedAssFiles 逻辑一致。 Co-Authored-By: Kscc <noreply@owtffssent.com>
This commit is contained in:
1 parent
f6002f088b
commit
54678eb83f
1 file changed
+29
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user