Posters: fall back to the provider's image when the instance has no copy
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -25,7 +25,7 @@ func (c *Client) Poster(images []Image, inLibrary bool) (key string, fetch func(
|
||||
continue
|
||||
}
|
||||
if inLibrary && img.URL != "" {
|
||||
local := img.URL
|
||||
local, remote := img.URL, img.RemoteURL
|
||||
base, _ := c.settings()
|
||||
return base + "|" + local, func(ctx context.Context) ([]byte, error) {
|
||||
// MediaCover has poster-250.jpg next to poster.jpg; fall back to the original.
|
||||
@@ -34,7 +34,15 @@ func (c *Client) Poster(images []Image, inLibrary bool) (key string, fetch func(
|
||||
return data, nil
|
||||
}
|
||||
}
|
||||
return c.GetBytes(ctx, local)
|
||||
data, err := c.GetBytes(ctx, local)
|
||||
if err != nil && remote != "" {
|
||||
// The instance has not cached (or has lost) its copy: use the
|
||||
// metadata provider's, as for titles that are not in the library.
|
||||
if remoteData, remoteErr := FetchURL(ctx, remote); remoteErr == nil {
|
||||
return remoteData, nil
|
||||
}
|
||||
}
|
||||
return data, err
|
||||
}, true
|
||||
}
|
||||
if img.RemoteURL != "" {
|
||||
|
||||
Reference in New Issue
Block a user