Stash-Box Performer Tagger (#1277)

* Add bulk stash-box performer task
* Add stash-box performer scraper to scrape with menu
This commit is contained in:
InfiniteTF
2021-05-03 06:21:20 +02:00
committed by GitHub
parent a3609079bb
commit 896c3874af
46 changed files with 2311 additions and 292 deletions

View File

@@ -258,18 +258,11 @@ func (qb *performerQueryBuilder) Query(performerFilter *models.PerformerFilterTy
query.body += `left join performers_image on performers_image.performer_id = performers.id
`
query.addWhere("performers_image.performer_id IS NULL")
case "stash_id":
query.addWhere("performer_stash_ids.performer_id IS NULL")
default:
query.addWhere("(performers." + *isMissingFilter + " IS NULL OR TRIM(performers." + *isMissingFilter + ") = '')")
}
}
if stashIDFilter := performerFilter.StashID; stashIDFilter != nil {
query.addWhere("performer_stash_ids.stash_id = ?")
query.addArg(stashIDFilter)
}
query.handleStringCriterionInput(performerFilter.Ethnicity, tableName+".ethnicity")
query.handleStringCriterionInput(performerFilter.Country, tableName+".country")
query.handleStringCriterionInput(performerFilter.EyeColor, tableName+".eye_color")
@@ -283,6 +276,7 @@ func (qb *performerQueryBuilder) Query(performerFilter *models.PerformerFilterTy
query.handleStringCriterionInput(performerFilter.HairColor, tableName+".hair_color")
query.handleStringCriterionInput(performerFilter.URL, tableName+".url")
query.handleIntCriterionInput(performerFilter.Weight, tableName+".weight")
query.handleStringCriterionInput(performerFilter.StashID, "performer_stash_ids.stash_id")
// TODO - need better handling of aliases
query.handleStringCriterionInput(performerFilter.Aliases, tableName+".aliases")
@@ -470,3 +464,23 @@ func (qb *performerQueryBuilder) GetStashIDs(performerID int) ([]*models.StashID
func (qb *performerQueryBuilder) UpdateStashIDs(performerID int, stashIDs []models.StashID) error {
return qb.stashIDRepository().replace(performerID, stashIDs)
}
func (qb *performerQueryBuilder) FindByStashIDStatus(hasStashID bool, stashboxEndpoint string) ([]*models.Performer, error) {
query := selectAll("performers") + `
LEFT JOIN performer_stash_ids on performer_stash_ids.performer_id = performers.id
`
if hasStashID {
query += `
WHERE performer_stash_ids.stash_id IS NOT NULL
AND performer_stash_ids.endpoint = ?
`
} else {
query += `
WHERE performer_stash_ids.stash_id IS NULL
`
}
args := []interface{}{stashboxEndpoint}
return qb.queryPerformers(query, args)
}