diff --git a/pkg/models/model_scraped_item.go b/pkg/models/model_scraped_item.go index b3a7a2418..5a9f2acb0 100644 --- a/pkg/models/model_scraped_item.go +++ b/pkg/models/model_scraped_item.go @@ -125,7 +125,7 @@ type ScrapedPerformer struct { Aliases *string `json:"aliases"` Tags []*ScrapedTag `json:"tags"` // This should be a base64 encoded data URL - Image *string `json:"image"` + Image *string `json:"image"` // deprecated: use Images Images []string `json:"images"` Details *string `json:"details"` DeathDate *string `json:"death_date"` diff --git a/pkg/scraper/image.go b/pkg/scraper/image.go index 5757bc9b3..78652f11d 100644 --- a/pkg/scraper/image.go +++ b/pkg/scraper/image.go @@ -12,11 +12,19 @@ import ( ) 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 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) if err != nil { return err