浏览代码

调整格式

Signed-off-by: allan716 <[email protected]>
allan716 3 年之前
父节点
当前提交
42efdd0246
共有 1 个文件被更改,包括 28 次插入30 次删除
  1. 28 30
      cmd/subtimelinefixer/main.go

+ 28 - 30
cmd/subtimelinefixer/main.go

@@ -1,35 +1,34 @@
 package main
 
 import (
+	"log"
+	"os"
+	"strings"
+	"time"
+
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_timeline_fixer"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/global_value"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/settings"
 	"github.com/sirupsen/logrus"
-	"log"
-	"os"
-	"strings"
-	"time"
 
 	"github.com/urfave/cli/v2"
 )
 
+/*
+	字幕时间轴修复命令行
+	使用方法:
+	go run main.go -vp ${videoPath} -sp ${subtitlePath}
+	${videPath} -> 视频文件路径,需要指定对应的视频文件
+	${subtitlePath} -> 字幕文件路径,需要指定对应的字幕文件
 
-/**
-字幕时间轴修复命令行
-使用方法:
-go run main.go -vp ${videoPath} -sp ${subtitlePath}
-${videPath} -> 视频文件路径,需要指定对应的视频文件
-${subtitlePath} -> 字幕文件路径,需要指定对应的字幕文件
-
-逻辑:
-1. 执行 SubTimelineFixerHelperEx 检查 - 确认已经安装了ffmpeg 和 ffprobe
-2. 执行 SubTimelineFixerHelperEx 的 process操作
-
-编译:
-通过`go build -o fixer`编译出可直接执行的文件。
- */
+	逻辑:
+	1. 执行 SubTimelineFixerHelperEx 检查 - 确认已经安装了ffmpeg 和 ffprobe
+	2. 执行 SubTimelineFixerHelperEx 的 process操作
 
+	编译:
+	通过`go build -o fixer`编译出可直接执行的文件。
+*/
 var loggerBase *logrus.Logger
 
 func newLog() *logrus.Logger {
@@ -51,29 +50,29 @@ func main() {
 		Usage: "Fix the subtitle timeline according to the video",
 		Flags: []cli.Flag{
 			&cli.StringFlag{
-				Name:  "videoPath",
-				Aliases: []string{"vp"},
-				Usage: "Specify `video file path`",
+				Name:        "videoPath",
+				Aliases:     []string{"vp"},
+				Usage:       "Specify `video file path`",
 				Destination: &videoPath,
-				Required: true,
+				Required:    true,
 			},
 
 			&cli.StringFlag{
-				Name:  "subtitlesPath",
-				Aliases: []string{"sp"},
-				Usage: "Specify `subtitles file path`",
+				Name:        "subtitlesPath",
+				Aliases:     []string{"sp"},
+				Usage:       "Specify `subtitles file path`",
 				Destination: &subtitlesPath,
-				Required: true,
+				Required:    true,
 			},
 		},
 		Action: func(c *cli.Context) error {
 			videoPath = strings.TrimSpace(videoPath)
 			subtitlesPath = strings.TrimSpace(subtitlesPath)
-			if videoPath != ""  && subtitlesPath != "" {
+			if videoPath != "" && subtitlesPath != "" {
 				var fixerSetting = settings.NewTimelineFixerSettings()
-				var subTimelineFixerHelper = sub_timeline_fixer.NewSubTimelineFixerHelperEx(loggerBase, *fixerSetting);
+				var subTimelineFixerHelper = sub_timeline_fixer.NewSubTimelineFixerHelperEx(loggerBase, *fixerSetting)
 				if subTimelineFixerHelper.Check() {
-					subTimelineFixerHelper.Process(videoPath, subtitlesPath);
+					subTimelineFixerHelper.Process(videoPath, subtitlesPath)
 				} else {
 					println("check subtitles timeline fixer helper failed.")
 				}
@@ -89,4 +88,3 @@ func main() {
 		log.Fatal(err)
 	}
 }
-