subsync

cli tool to synchronize srt subtitles automatically
git clone git://git.2f30.org/subsync.git
Log | Files | Refs | LICENSE

commit 0ca021ed12bf0323775a798e234cc7d34f8494fe
parent 429cac991d10fb0d9242232bda8282f220ea1d73
Author: oblique <psyberbits@gmail.com>
Date:   Sun, 14 Apr 2013 05:11:55 +0300

Release v0.1

Diffstat:
subsync.go | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/subsync.go b/subsync.go @@ -14,6 +14,11 @@ import ( "github.com/jessevdk/go-flags" ) + +const ( + version = "0.1" +) + type subtitle struct { text string start uint @@ -220,8 +225,9 @@ func main() { var opts struct { FirstTm string `short:"f" long:"first-sub" description:"Time of first subtitle"` LastTm string `short:"l" long:"last-sub" description:"Time of last subtitle"` - InputFl string `short:"i" long:"input" description:"Input file" required:"true"` + InputFl string `short:"i" long:"input" description:"Input file"` OutputFl string `short:"o" long:"output" description:"Output file"` + PrintVersion bool `short:"v" long:"version" description:"Print version"` } _, err := flags.Parse(&opts) @@ -235,6 +241,16 @@ func main() { os.Exit(1) } + if opts.PrintVersion { + fmt.Printf("subsync v%s\n", version) + os.Exit(0) + } + + if opts.InputFl == "" { + fmt.Fprintf(os.Stderr, "You must specify an input file with -i option.\n") + os.Exit(1) + } + if opts.FirstTm != "" { first_ms, err = time_to_msecs(opts.FirstTm) if err != nil {