Esempio n. 1
0
func (s *Storage) DeleteChilds(name string) (ok bool) {
	names, err := s.Index.List(name, 0)
	if err != nil {
		aelog.Warnln("Can't get file list:", err)
		return
	}
	for _, name := range names {
		if s.Delete(name) && !ok {
			ok = true
		}
	}
	return
}
Esempio n. 2
0
func (i *Image) optimize(dst string) {
	if i.Type != "png" {
		return
	}
	command := "pngquant"
	if _, err := exec.LookPath(command); err != nil {
		aelog.Warnln("Optimize image: Command", command, "not found:", err)
		return
	}

	cmd := exec.Command(command, dst, "--force", "--output", dst)
	if res, err := cmd.CombinedOutput(); err != nil {
		aelog.Warnf("Optimize image: %s return error: %v (%s)", command, err, string(res))
	}
	aelog.Debugln("Optimize image:", dst, "success!")
}