浏览代码

更新测试代码

Signed-off-by: allan716 <[email protected]>
allan716 3 年之前
父节点
当前提交
f1df710c34
共有 2 个文件被更改,包括 38 次插入1 次删除
  1. 1 1
      TestCode/test_statistics_subs_score.go
  2. 37 0
      pkg/logic/sub_timeline_fixer/SubTimelineFixerHelperEx_test.go

+ 1 - 1
TestCode/test_statistics_subs_score.go

@@ -343,7 +343,7 @@ func dealOne(ctx context.Context, inData interface{}) error {
 		sub_timeline_fixer.CompareConfig{
 			MinScore:                      40000,
 			OffsetRange:                   2,
-			DialoguesDifferencePercentage: 0.1,
+			DialoguesDifferencePercentage: 0.25,
 		})
 	if err != nil {
 		return nil

+ 37 - 0
pkg/logic/sub_timeline_fixer/SubTimelineFixerHelperEx_test.go

@@ -53,3 +53,40 @@ func TestSubTimelineFixerHelperEx_Process(t *testing.T) {
 		})
 	}
 }
+
+func TestSubTimelineFixerHelperEx_IsMatchBySubFile(t *testing.T) {
+
+	videoFPath := "C:\\temp\\video\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p.mkv"
+	NowTargetSubFPath := "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 5\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p.chinese(简,subhd).ass"
+
+	logger := log_helper.GetLogger4Tester()
+	s := NewSubTimelineFixerHelperEx(logger, *settings.NewTimelineFixerSettings())
+	bok, ffmpegInfo, audioVADInfos, infoBase, err := s.IsVideoCanExportSubtitleAndAudio(videoFPath)
+	if err != nil {
+		logger.Errorln("IsVideoCanExportSubtitleAndAudio", err)
+		return
+	}
+	if bok == false {
+		logger.Errorln("IsVideoCanExportSubtitleAndAudio", "bok == false")
+		return
+	}
+
+	bok, matchResult, err := s.IsMatchBySubFile(
+		ffmpegInfo,
+		audioVADInfos,
+		infoBase,
+		NowTargetSubFPath,
+		CompareConfig{
+			MinScore:                      40000,
+			OffsetRange:                   2,
+			DialoguesDifferencePercentage: 0.25,
+		})
+	if err != nil {
+		logger.Errorln("IsMatchBySubFile", err)
+		return
+	}
+
+	if bok == false && matchResult == nil {
+		return
+	}
+}