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

@@ -188,7 +188,6 @@ func performerJSONToPerformer(performerJSON jsonschema.Performer) models.Perform
newPerformer := models.Performer{
Name: performerJSON.Name,
Disambiguation: performerJSON.Disambiguation,
URL: performerJSON.URL,
Ethnicity: performerJSON.Ethnicity,
Country: performerJSON.Country,
EyeColor: performerJSON.EyeColor,
@@ -198,8 +197,6 @@ func performerJSONToPerformer(performerJSON jsonschema.Performer) models.Perform
Tattoos: performerJSON.Tattoos,
Piercings: performerJSON.Piercings,
Aliases: models.NewRelatedStrings(performerJSON.Aliases),
Twitter: performerJSON.Twitter,
Instagram: performerJSON.Instagram,
Details: performerJSON.Details,
HairColor: performerJSON.HairColor,
Favorite: performerJSON.Favorite,
@@ -211,6 +208,25 @@ func performerJSONToPerformer(performerJSON jsonschema.Performer) models.Perform
StashIDs: models.NewRelatedStashIDs(performerJSON.StashIDs),
}
if len(performerJSON.URLs) > 0 {
newPerformer.URLs = models.NewRelatedStrings(performerJSON.URLs)
} else {
urls := []string{}
if performerJSON.URL != "" {
urls = append(urls, performerJSON.URL)
}
if performerJSON.Twitter != "" {
urls = append(urls, performerJSON.Twitter)
}
if performerJSON.Instagram != "" {
urls = append(urls, performerJSON.Instagram)
}
if len(urls) > 0 {
newPerformer.URLs = models.NewRelatedStrings([]string{performerJSON.URL})
}
}
if performerJSON.Gender != "" {
v := models.GenderEnum(performerJSON.Gender)
newPerformer.Gender = &v