mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Resolve performer/studio stashIDs for scraped scenes (#2006)
* Resolve performer/studio stashIDs for scraped scenes * Check endpoint when matching stashids
This commit is contained in:
@@ -610,6 +610,16 @@ func (qb *performerQueryBuilder) UpdateStashIDs(performerID int, stashIDs []mode
|
||||
return qb.stashIDRepository().replace(performerID, stashIDs)
|
||||
}
|
||||
|
||||
func (qb *performerQueryBuilder) FindByStashID(stashID models.StashID) ([]*models.Performer, error) {
|
||||
query := selectAll("performers") + `
|
||||
LEFT JOIN performer_stash_ids on performer_stash_ids.performer_id = performers.id
|
||||
WHERE performer_stash_ids.stash_id = ?
|
||||
AND performer_stash_ids.endpoint = ?
|
||||
`
|
||||
args := []interface{}{stashID.StashID, stashID.Endpoint}
|
||||
return qb.queryPerformers(query, args)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -117,6 +117,16 @@ func (qb *studioQueryBuilder) FindByName(name string, nocase bool) (*models.Stud
|
||||
return qb.queryStudio(query, args)
|
||||
}
|
||||
|
||||
func (qb *studioQueryBuilder) FindByStashID(stashID models.StashID) ([]*models.Studio, error) {
|
||||
query := selectAll("studios") + `
|
||||
LEFT JOIN studio_stash_ids on studio_stash_ids.studio_id = studios.id
|
||||
WHERE studio_stash_ids.stash_id = ?
|
||||
AND studio_stash_ids.endpoint = ?
|
||||
`
|
||||
args := []interface{}{stashID.StashID, stashID.Endpoint}
|
||||
return qb.queryStudios(query, args)
|
||||
}
|
||||
|
||||
func (qb *studioQueryBuilder) Count() (int, error) {
|
||||
return qb.runCountQuery(qb.buildCountQuery("SELECT studios.id FROM studios"), nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user