added mov command to test out mov metadata parsing

This commit is contained in:
Stephen McQuay 2016-12-10 16:41:16 -08:00
parent b4ee62151d
commit ab9d45e3ea
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D
1 changed files with 37 additions and 0 deletions

37
cmd/mov/main.go Normal file
View File

@ -0,0 +1,37 @@
package main
import (
"fmt"
"os"
"mcquay.me/mov"
)
const usage = "usage: mov <.mov file>"
func main() {
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "%v\n", usage)
os.Exit(1)
}
for _, path := range os.Args[1:] {
f, err := os.Open(path)
if err != nil {
f.Close()
fmt.Fprintf(os.Stderr, "%v\n", err)
continue
}
s, _ := f.Stat()
c, cerr := mov.Created(f)
f.Seek(0, 0)
m, merr := mov.Created(f)
f.Close()
if cerr != nil || merr != nil {
fmt.Fprintf(os.Stderr, "failed to find time: %v, %v\n", cerr, merr)
continue
}
fmt.Printf("%s: from stat: %+v\n", path, s.ModTime())
fmt.Printf("%s: created on: %+v\n", path, c)
fmt.Printf("%s: modified on: %+v\n\n", path, m)
}
}