Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update merged performer upon batch update #5664

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions graphql/stash-box/query.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ fragment PerformerFragment on Performer {
aliases
gender
merged_ids
deleted
merged_into_id
urls {
...URLFragment
}
Expand Down
12 changes: 12 additions & 0 deletions internal/manager/task_stash_box_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ func (t *StashBoxBatchTagTask) findStashBoxPerformer(ctx context.Context) (*mode
}
if remoteID != "" {
performer, err = client.FindStashBoxPerformerByID(ctx, remoteID)

if performer != nil && performer.RemoteMergedIntoId != nil {
mergedPerformer, err := client.FindStashBoxPerformerByID(ctx, *performer.RemoteMergedIntoId)
if err != nil {
logger.Errorf("Error loading merged performer %s from stashbox", *performer.RemoteMergedIntoId)
} else if mergedPerformer.StoredID != nil && *mergedPerformer.StoredID != *performer.StoredID {
logger.Warnf("Performer %s merged into %s, but both exist locally, not merging", *performer.StoredID, *mergedPerformer.StoredID)
} else {
mergedPerformer.StoredID = performer.StoredID
performer = mergedPerformer
}
}
}
} else {
var name string
Expand Down
16 changes: 9 additions & 7 deletions pkg/models/model_scraped_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ type ScrapedPerformer struct {
Aliases *string `json:"aliases"`
Tags []*ScrapedTag `json:"tags"`
// This should be a base64 encoded data URL
Image *string `json:"image"` // deprecated: use Images
Images []string `json:"images"`
Details *string `json:"details"`
DeathDate *string `json:"death_date"`
HairColor *string `json:"hair_color"`
Weight *string `json:"weight"`
RemoteSiteID *string `json:"remote_site_id"`
Image *string `json:"image"` // deprecated: use Images
Images []string `json:"images"`
Details *string `json:"details"`
DeathDate *string `json:"death_date"`
HairColor *string `json:"hair_color"`
Weight *string `json:"weight"`
RemoteSiteID *string `json:"remote_site_id"`
RemoteDeleted bool `json:"remote_deleted"`
RemoteMergedIntoId *string `json:"remote_merged_into_id"`
}

func (ScrapedPerformer) IsScrapedContent() {}
Expand Down
28 changes: 28 additions & 0 deletions pkg/scraper/stashbox/graphql/generated_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions pkg/scraper/stashbox/stash_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,16 +625,18 @@ func performerFragmentToScrapedPerformer(p graphql.PerformerFragment) *models.Sc
}

sp := &models.ScrapedPerformer{
Name: &p.Name,
Disambiguation: p.Disambiguation,
Country: p.Country,
Measurements: formatMeasurements(*p.Measurements),
CareerLength: formatCareerLength(p.CareerStartYear, p.CareerEndYear),
Tattoos: formatBodyModifications(p.Tattoos),
Piercings: formatBodyModifications(p.Piercings),
Twitter: findURL(p.Urls, "TWITTER"),
RemoteSiteID: &p.ID,
Images: images,
Name: &p.Name,
Disambiguation: p.Disambiguation,
Country: p.Country,
Measurements: formatMeasurements(*p.Measurements),
CareerLength: formatCareerLength(p.CareerStartYear, p.CareerEndYear),
Tattoos: formatBodyModifications(p.Tattoos),
Piercings: formatBodyModifications(p.Piercings),
Twitter: findURL(p.Urls, "TWITTER"),
RemoteSiteID: &p.ID,
RemoteDeleted: p.Deleted,
RemoteMergedIntoId: p.MergedIntoID,
Images: images,
// TODO - tags not currently supported
// graphql schema change to accommodate this. Leave off for now.
}
Expand Down
Loading