return the zipfile path

This commit is contained in:
Kyle Isom 2022-02-22 23:53:55 -08:00
parent 591a5e7171
commit 508d22a3a4
2 changed files with 7 additions and 11 deletions

View File

@ -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 {

View File

@ -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
}