mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
In performer scrapers, forward non-http single performer images (#4947)
* Forward non-http single performer images * Don't set if Images already set --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -125,7 +125,7 @@ type ScrapedPerformer struct {
|
|||||||
Aliases *string `json:"aliases"`
|
Aliases *string `json:"aliases"`
|
||||||
Tags []*ScrapedTag `json:"tags"`
|
Tags []*ScrapedTag `json:"tags"`
|
||||||
// This should be a base64 encoded data URL
|
// This should be a base64 encoded data URL
|
||||||
Image *string `json:"image"`
|
Image *string `json:"image"` // deprecated: use Images
|
||||||
Images []string `json:"images"`
|
Images []string `json:"images"`
|
||||||
Details *string `json:"details"`
|
Details *string `json:"details"`
|
||||||
DeathDate *string `json:"death_date"`
|
DeathDate *string `json:"death_date"`
|
||||||
|
|||||||
@@ -12,11 +12,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func setPerformerImage(ctx context.Context, client *http.Client, p *models.ScrapedPerformer, globalConfig GlobalConfig) error {
|
func setPerformerImage(ctx context.Context, client *http.Client, p *models.ScrapedPerformer, globalConfig GlobalConfig) error {
|
||||||
if p.Image == nil || !strings.HasPrefix(*p.Image, "http") {
|
// backwards compatibility: we fetch the image if it's a URL and set it to the first image
|
||||||
|
// Image is deprecated, so only do this if Images is unset
|
||||||
|
if p.Image == nil || len(p.Images) > 0 {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't try to get the image if it doesn't appear to be a URL
|
||||||
|
if !strings.HasPrefix(*p.Image, "http") {
|
||||||
|
p.Images = []string{*p.Image}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
img, err := getImage(ctx, *p.Image, client, globalConfig)
|
img, err := getImage(ctx, *p.Image, client, globalConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user