Log errors for failure to generate thumbnails

This commit is contained in:
James Mills 2020-03-22 18:37:29 +10:00
parent a7e88fbcac
commit 7492a150eb
No known key found for this signature in database
GPG key ID: AC4C014F1440EBD6

View file

@ -9,6 +9,7 @@ import (
"strings"
"time"
"github.com/apex/log"
"github.com/dhowden/tag"
"github.com/wybiral/tube/utils"
@ -78,7 +79,9 @@ func ParseVideo(p *Path, name string) (*Video, error) {
v.Thumb = pic.Data
v.ThumbType = pic.MIMEType
} else if utils.CmdExists("mt") {
if err := utils.RunCmd(3, "mt", "-s", "-n", "1", pth); err != nil {
if err := utils.RunCmd(10, "mt", "-s", "-n", "1", pth); err != nil {
err := fmt.Errorf("error generating thumbnail: %w", err)
log.Error(err.Error())
return nil, err
}
data, err := ioutil.ReadFile(fmt.Sprintf("%s.jpg", strings.TrimSuffix(pth, filepath.Ext(pth))))