Browse Source

调整字幕时间轴校正,执行顺序逻辑

Signed-off-by: allan716 <[email protected]>
allan716 4 years ago
parent
commit
677dcd0567
2 changed files with 25 additions and 25 deletions
  1. 1 1
      .github/workflows/manual_test.yml
  2. 24 24
      cmd/chinesesubfinder/main.go

+ 1 - 1
.github/workflows/manual_test.yml

@@ -33,4 +33,4 @@ jobs:
           platforms: linux/amd64
           push: true
           tags: |
-            allanpk716/chinesesubfinder:dev1014b01
+            allanpk716/chinesesubfinder:dev1014b02

+ 24 - 24
cmd/chinesesubfinder/main.go

@@ -141,12 +141,7 @@ func main() {
 }
 
 func DownLoadStart(httpProxy string) {
-	defer func() {
-		log.Infoln("Download One End...")
-		notify_center.Notify.Send()
-		pkg.CloseChrome()
-		rod_helper.Clear()
-	}()
+
 	notify_center.Notify.Clear()
 
 	// 下载实例
@@ -162,6 +157,29 @@ func DownLoadStart(httpProxy string) {
 			SaveOneSeasonSub:              config.SaveOneSeasonSub,
 		})
 
+	defer func() {
+		log.Infoln("Download One End...")
+		notify_center.Notify.Send()
+		pkg.CloseChrome()
+		rod_helper.Clear()
+		// 开始字幕的统一校正
+		log.Infoln("Auto Fix Sub Timeline Start...")
+		fixer := sub_timeline_fixer.NewSubTimelineFixerHelper(config.EmbyConfig, config.SubTimelineFixerConfig)
+		err := fixer.FixRecentlyItemsSubTimeline(config.MovieFolder, config.SeriesFolder)
+		if err != nil {
+			log.Errorln("FixRecentlyItemsSubTimeline", err)
+			return
+		}
+		log.Infoln("Auto Fix Sub Timeline End")
+		// 再次刷新
+		// 刷新 Emby 的字幕,下载完毕字幕了,就统一刷新一下
+		err = downloader.RefreshEmbySubList()
+		if err != nil {
+			log.Errorln("RefreshEmbySubList", err)
+			return
+		}
+	}()
+
 	log.Infoln("Download One Started...")
 
 	// 优先级最高。读取特殊文件,启用一些特殊的功能,比如 forced_scan_and_down_sub
@@ -198,24 +216,6 @@ func DownLoadStart(httpProxy string) {
 		log.Errorln("RefreshEmbySubList", err)
 		return
 	}
-
-	// 开始字幕的统一校正
-	log.Infoln("Auto Fix Sub Timeline Start...")
-	fixer := sub_timeline_fixer.NewSubTimelineFixerHelper(config.EmbyConfig, config.SubTimelineFixerConfig)
-	err = fixer.FixRecentlyItemsSubTimeline(config.MovieFolder, config.SeriesFolder)
-	if err != nil {
-		log.Errorln("FixRecentlyItemsSubTimeline", err)
-		return
-	}
-	log.Infoln("Auto Fix Sub Timeline End")
-
-	// 再次刷新
-	// 刷新 Emby 的字幕,下载完毕字幕了,就统一刷新一下
-	err = downloader.RefreshEmbySubList()
-	if err != nil {
-		log.Errorln("RefreshEmbySubList", err)
-		return
-	}
 }
 
 var (