Browse Source

还是对接上最小的调整时间轴的大小,不然偏移为0也会调整

Signed-off-by: allan716 <[email protected]>
allan716 3 years ago
parent
commit
0af3d11894

+ 3 - 3
internal/logic/sub_timeline_fixer/SubTimelineFixerHelperEx.go

@@ -14,6 +14,7 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/types/subparser"
 	"github.com/emirpasic/gods/maps/treemap"
 	"github.com/emirpasic/gods/utils"
+	"math"
 	"os"
 )
 
@@ -129,15 +130,14 @@ func (s SubTimelineFixerHelperEx) Process(videoFileFullPath, srcSubFPath string)
 	}
 
 	// 开始调整字幕时间轴
-	if bProcess == false {
-		log_helper.GetLogger().Infoln("Skip TimeLine Fix --", srcSubFPath)
+	if bProcess == false || math.Abs(pipeResultMax.GetOffsetTime()) < s.fixerConfig.V2_MinOffset {
+		log_helper.GetLogger().Infoln("Skip TimeLine Fix -- OffsetTime:", pipeResultMax.GetOffsetTime(), srcSubFPath)
 		return nil
 	}
 	err = s.changeTimeLineAndSave(infoSrc, pipeResultMax, srcSubFPath)
 	if err != nil {
 		return err
 	}
-
 	log_helper.GetLogger().Infoln("Fix Offset:", pipeResultMax.GetOffsetTime(), srcSubFPath)
 	log_helper.GetLogger().Infoln("BackUp Org SubFile:", pipeResultMax.GetOffsetTime(), srcSubFPath+sub_timeline_fixer.BackUpExt)
 

+ 1 - 1
internal/types/sub_timeline_fiexer/sub_timeline_fixer_config.go

@@ -56,7 +56,7 @@ func (s *SubTimelineFixerConfig) CheckDefault() {
 		s.V2_MaxStartTimeDiffSD = 0.1
 	}
 	if s.V2_MinOffset <= 0 {
-		s.V2_MinOffset = 0.3
+		s.V2_MinOffset = 0.2
 	}
 
 	if s.V2_MaxOffsetTime <= 0 {