diff --git a/lifecam.go b/lifecam.go index 1e584ce..c6853a8 100644 --- a/lifecam.go +++ b/lifecam.go @@ -59,10 +59,7 @@ func main() { pkg, err := fl.Package() die.If(err) - path, err := pkg.Frames.Name() - die.If(err) - - err = lifecam.PackageZip(pkg, *clean) + path, err := lifecam.PackageZip(pkg, *clean) die.If(err) if *upload { diff --git a/lifecam/zip.go b/lifecam/zip.go index 816ceea..310a673 100644 --- a/lifecam/zip.go +++ b/lifecam/zip.go @@ -17,7 +17,6 @@ func zipName(p string, top bool) string { } func pathHeader(p string, top bool) (*zip.FileHeader, error) { - fi, err := os.Stat(p) if err != nil { return nil, err @@ -127,24 +126,24 @@ func newZipFile(path string, clean bool) (*zipFile, error) { return zf, nil } -func PackageZip(p *Package, clean bool) (err error) { - path := strings.TrimSuffix(p.Video, +func PackageZip(p *Package, clean bool) (path string, err error) { + path = strings.TrimSuffix(p.Video, filepath.Ext(p.Video)) + ".zip" zf, err := newZipFile(path, clean) if err != nil { - return err + return } defer zf.Close() err = zf.AddVideo(p.Video) if err != nil { - return err + return } for _, frame := range p.Frames { err = zf.AddFrame(frame.Path) if err != nil { - return err + return } } @@ -154,5 +153,5 @@ func PackageZip(p *Package, clean bool) (err error) { err = zf.Clean() } - return err + return }