Return error when no matching cover is found
When checking stored references to cover images (whether embedded or external), it's possible that configured patterns do no match, and a valid error should be returned in those cases.
This commit is contained in:
committed by
Deluan Quintão
parent
08cd28af2d
commit
d9c991e325
+4
-1
@@ -135,6 +135,7 @@ func (c *cover) getCover(ctx context.Context, path string, size int) (reader io.
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var data []byte
|
var data []byte
|
||||||
|
err = errors.New("no matching cover found")
|
||||||
for _, p := range strings.Split(conf.Server.CoverArtPriority, ",") {
|
for _, p := range strings.Split(conf.Server.CoverArtPriority, ",") {
|
||||||
pat := strings.ToLower(strings.TrimSpace(p))
|
pat := strings.ToLower(strings.TrimSpace(p))
|
||||||
if pat == "embedded" {
|
if pat == "embedded" {
|
||||||
@@ -147,7 +148,9 @@ func (c *cover) getCover(ctx context.Context, path string, size int) (reader io.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil && size > 0 {
|
if err != nil {
|
||||||
|
return
|
||||||
|
} else if size > 0 {
|
||||||
data, err = resizeImage(bytes.NewReader(data), size)
|
data, err = resizeImage(bytes.NewReader(data), size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user