Performer urls (#4958)

* Populate URLs from legacy fields
* Return nil properly in xpath/json scrapers
* Improve migration logging
This commit is contained in:
WithoutPants
2024-06-18 13:41:05 +10:00
committed by GitHub
parent fda4776d30
commit f26766033e
47 changed files with 992 additions and 379 deletions

View File

@@ -16,6 +16,7 @@ type ImageAliasStashIDGetter interface {
GetImage(ctx context.Context, performerID int) ([]byte, error)
models.AliasLoader
models.StashIDLoader
models.URLLoader
}
// ToJSON converts a Performer object into its JSON equivalent.
@@ -23,7 +24,6 @@ func ToJSON(ctx context.Context, reader ImageAliasStashIDGetter, performer *mode
newPerformerJSON := jsonschema.Performer{
Name: performer.Name,
Disambiguation: performer.Disambiguation,
URL: performer.URL,
Ethnicity: performer.Ethnicity,
Country: performer.Country,
EyeColor: performer.EyeColor,
@@ -32,8 +32,6 @@ func ToJSON(ctx context.Context, reader ImageAliasStashIDGetter, performer *mode
CareerLength: performer.CareerLength,
Tattoos: performer.Tattoos,
Piercings: performer.Piercings,
Twitter: performer.Twitter,
Instagram: performer.Instagram,
Favorite: performer.Favorite,
Details: performer.Details,
HairColor: performer.HairColor,
@@ -78,6 +76,11 @@ func ToJSON(ctx context.Context, reader ImageAliasStashIDGetter, performer *mode
newPerformerJSON.Aliases = performer.Aliases.List()
if err := performer.LoadURLs(ctx, reader); err != nil {
return nil, fmt.Errorf("loading performer urls: %w", err)
}
newPerformerJSON.URLs = performer.URLs.List()
if err := performer.LoadStashIDs(ctx, reader); err != nil {
return nil, fmt.Errorf("loading performer stash ids: %w", err)
}