added mov command to test out mov metadata parsing
This commit is contained in:
parent
b4ee62151d
commit
ab9d45e3ea
37
cmd/mov/main.go
Normal file
37
cmd/mov/main.go
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user