mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Debug log stderr when thumbnail generation fails
This commit is contained in:
parent
0bd78f4b62
commit
f811590021
1 changed files with 11 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os/exec"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/fsutil"
|
"github.com/stashapp/stash/pkg/fsutil"
|
||||||
"github.com/stashapp/stash/pkg/image"
|
"github.com/stashapp/stash/pkg/image"
|
||||||
|
|
@ -20,6 +21,13 @@ func (t *GenerateImageThumbnailTask) GetDescription() string {
|
||||||
return fmt.Sprintf("Generating Thumbnail for image %s", t.Image.Path)
|
return fmt.Sprintf("Generating Thumbnail for image %s", t.Image.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *GenerateImageThumbnailTask) logStderr(err error) {
|
||||||
|
var exitErr *exec.ExitError
|
||||||
|
if errors.As(err, &exitErr) {
|
||||||
|
logger.Debugf("[generator] error output: %s", exitErr.Stderr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (t *GenerateImageThumbnailTask) Start(ctx context.Context) {
|
func (t *GenerateImageThumbnailTask) Start(ctx context.Context) {
|
||||||
if !t.required() {
|
if !t.required() {
|
||||||
return
|
return
|
||||||
|
|
@ -46,14 +54,15 @@ func (t *GenerateImageThumbnailTask) Start(ctx context.Context) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// don't log for animated images
|
// don't log for animated images
|
||||||
if !errors.Is(err, image.ErrNotSupportedForThumbnail) {
|
if !errors.Is(err, image.ErrNotSupportedForThumbnail) {
|
||||||
logger.Errorf("[generator] getting thumbnail for image %s: %w", path, err)
|
logger.Errorf("[generator] getting thumbnail for image %s: %s", path, err.Error())
|
||||||
|
t.logStderr(err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = fsutil.WriteFile(thumbPath, data)
|
err = fsutil.WriteFile(thumbPath, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("[generator] writing thumbnail for image %s: %w", path, err)
|
logger.Errorf("[generator] writing thumbnail for image %s: %s", path, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue