mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Tagger match performer by alias (#4182)
This commit is contained in:
@@ -5,11 +5,13 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
"github.com/stashapp/stash/pkg/performer"
|
||||
"github.com/stashapp/stash/pkg/studio"
|
||||
"github.com/stashapp/stash/pkg/tag"
|
||||
)
|
||||
|
||||
type PerformerFinder interface {
|
||||
models.PerformerQueryer
|
||||
FindByNames(ctx context.Context, names []string, nocase bool) ([]*models.Performer, error)
|
||||
FindByStashID(ctx context.Context, stashID models.StashID) ([]*models.Performer, error)
|
||||
}
|
||||
@@ -47,9 +49,17 @@ func ScrapedPerformer(ctx context.Context, qb PerformerFinder, p *models.Scraped
|
||||
return err
|
||||
}
|
||||
|
||||
if len(performers) != 1 {
|
||||
// ignore - cannot match
|
||||
return nil
|
||||
if performers == nil || len(performers) != 1 {
|
||||
// try matching a single performer by exact alias
|
||||
performers, err = performer.ByAlias(ctx, qb, *p.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if performers == nil || len(performers) != 1 {
|
||||
// ignore - cannot match
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
id := strconv.Itoa(performers[0].ID)
|
||||
|
||||
Reference in New Issue
Block a user