소스 검색

相同的一个字幕 srt ass 转换到 VAD 的信息有差别,导致字幕校正也受影响,需要定位问题

Signed-off-by: allan716 <[email protected]>
allan716 4 년 전
부모
커밋
2b4e4025cd
2개의 변경된 파일36개의 추가작업 그리고 2개의 파일을 삭제
  1. 0 2
      internal/pkg/sub_helper/sub_helper.go
  2. 36 0
      internal/pkg/sub_timeline_fixer/fixer_test.go

+ 0 - 2
internal/pkg/sub_helper/sub_helper.go

@@ -442,8 +442,6 @@ func GetVADInfoFeatureFromSubNeedOffsetTimeWillInsert(infoSrc *subparser.FileInf
 			srcSubUnitList = append(srcSubUnitList, *srcOneSubUnit)
 			// 然后重置
 			srcOneSubUnit = NewSubUnit()
-			// TODO 这里决定了插入数据的密度,有待测试
-			// i = i - SubUnitMaxCount
 		}
 	}
 	if srcOneSubUnit.GetDialogueCount() > 0 {

+ 36 - 0
internal/pkg/sub_timeline_fixer/fixer_test.go

@@ -428,6 +428,24 @@ func TestGetOffsetTimeV2_BaseSub(t *testing.T) {
 		{name: "R&M S05E10-2", args: args{baseSubFile: filepath.Join(testRootDirYes, "R&M S05E10 - 简英.ass"),
 			srcSubFile:             filepath.Join(testRootDirYes, "R&M S05E10 - 简英.ass"),
 			staticLineFileSavePath: "bar.html"}, want: 0, wantErr: false},
+
+		{name: "R&M S05E01-2", args: args{
+			baseSubFile:            "C:\\Tmp\\Rick and Morty - S05E01\\英_2.srt",
+			srcSubFile:             "C:\\Tmp\\Rick and Morty - S05E01\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p.chinese(简英,zimuku).ass",
+			staticLineFileSavePath: "bar.html"}, want: -6.12981818181818, wantErr: false},
+		{name: "R&M S05E01-2", args: args{
+			baseSubFile:            "C:\\Tmp\\Rick and Morty - S05E01\\英_2.ass",
+			srcSubFile:             "C:\\Tmp\\Rick and Morty - S05E01\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p.chinese(简英,zimuku).ass",
+			staticLineFileSavePath: "bar.html"}, want: -6.12981818181818, wantErr: false},
+		{name: "R&M S05E01-2", args: args{
+			baseSubFile:            "C:\\Tmp\\Rick and Morty - S05E01\\英_2.ass",
+			srcSubFile:             "C:\\Tmp\\Rick and Morty - S05E01\\英_2.srt",
+			staticLineFileSavePath: "bar.html"}, want: -6.12981818181818, wantErr: false},
+
+		{name: "R&M S05E01-2", args: args{
+			baseSubFile:            "C:\\Tmp\\Rick and Morty - S05E10\\英_2.srt",
+			srcSubFile:             "C:\\Tmp\\Rick and Morty - S05E10\\英_2.ass",
+			staticLineFileSavePath: "bar.html"}, want: -6.12981818181818, wantErr: false},
 		/*
 			基地
 		*/
@@ -673,6 +691,24 @@ func TestGetOffsetTimeV2_BaseAudio(t *testing.T) {
 				subFilePath: "C:\\Tmp\\Rick and Morty - S05E10\\Rick and Morty - S05E10 - Rickmurai Jack WEBRip-1080p.chinese(简英,zimuku).ass"},
 			want: true, want1: -6.4,
 		},
+		{name: "Rick and Morty - S05E01 -- 0",
+			args: args{audioInfo: vad.AudioInfo{
+				FileFullPath: "C:\\Tmp\\Rick and Morty - S05E01\\未知语言_1.pcm"},
+				subFilePath: "C:\\Tmp\\Rick and Morty - S05E01\\英_2.ass"},
+			want: true, want1: -6.4,
+		},
+		{name: "Rick and Morty - S05E01 -- 0",
+			args: args{audioInfo: vad.AudioInfo{
+				FileFullPath: "C:\\Tmp\\Rick and Morty - S05E01\\未知语言_1.pcm"},
+				subFilePath: "C:\\Tmp\\Rick and Morty - S05E01\\英_2.srt"},
+			want: true, want1: -6.4,
+		},
+		{name: "Rick and Morty - S05E01 -- 1",
+			args: args{audioInfo: vad.AudioInfo{
+				FileFullPath: "C:\\Tmp\\Rick and Morty - S05E01\\未知语言_1.pcm"},
+				subFilePath: "C:\\Tmp\\Rick and Morty - S05E01\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p.chinese(简英,zimuku).ass"},
+			want: true, want1: -6.4,
+		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {