()
| 41 | } |
| 42 | |
| 43 | func main() { |
| 44 | |
| 45 | var videoPath string |
| 46 | var subtitlesPath string |
| 47 | |
| 48 | loggerBase = newLog() |
| 49 | |
| 50 | app := &cli.App{ |
| 51 | Name: "Subtitle Timeline Fixer", |
| 52 | Usage: "Fix the subtitle timeline according to the video", |
| 53 | Flags: []cli.Flag{ |
| 54 | &cli.StringFlag{ |
| 55 | Name: "videoPath", |
| 56 | Aliases: []string{"vp"}, |
| 57 | Usage: "Specify `video file path`", |
| 58 | Destination: &videoPath, |
| 59 | Required: true, |
| 60 | }, |
| 61 | |
| 62 | &cli.StringFlag{ |
| 63 | Name: "subtitlesPath", |
| 64 | Aliases: []string{"sp"}, |
| 65 | Usage: "Specify `subtitles file path`", |
| 66 | Destination: &subtitlesPath, |
| 67 | Required: true, |
| 68 | }, |
| 69 | }, |
| 70 | Action: func(c *cli.Context) error { |
| 71 | videoPath = strings.TrimSpace(videoPath) |
| 72 | subtitlesPath = strings.TrimSpace(subtitlesPath) |
| 73 | if videoPath != "" && subtitlesPath != "" { |
| 74 | var fixerSetting = settings.NewTimelineFixerSettings() |
| 75 | var subTimelineFixerHelper = sub_timeline_fixer.NewSubTimelineFixerHelperEx(loggerBase, *fixerSetting) |
| 76 | if subTimelineFixerHelper.Check() { |
| 77 | subTimelineFixerHelper.Process(videoPath, subtitlesPath) |
| 78 | } else { |
| 79 | println("check subtitles timeline fixer helper failed.") |
| 80 | } |
| 81 | } else { |
| 82 | println("need provide video path (-vp) and subtitle path (-sp)") |
| 83 | } |
| 84 | return nil |
| 85 | }, |
| 86 | } |
| 87 | |
| 88 | err := app.Run(os.Args) |
| 89 | if err != nil { |
| 90 | log.Fatal(err) |
| 91 | } |
| 92 | } |
nothing calls this directly
no test coverage detected