Studio aliases (#1660)

* Add migration to create studio aliases table
* Refactor studioQueryBuilder.Query to use filterBuilder
* Expand GraphQL API with aliases support for studio
* Add aliases support for studios to the UI
* List aliases in details panel
* Allow editing aliases in edit panel
* Add 'aliases' filter when searching
* Find studios by alias in filter / select
* Add auto-tagging based on studio aliases
* Support studio aliases for filename parsing
* Support importing and exporting of studio aliases
* Search for studio alias as well during scraping
This commit is contained in:
gitgiggety
2021-09-09 10:13:42 +02:00
committed by GitHub
parent c91ffe1e58
commit 04e5ac9c2f
34 changed files with 909 additions and 164 deletions

View File

@@ -4,6 +4,7 @@ import (
"strconv"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/studio"
"github.com/stashapp/stash/pkg/tag"
)
@@ -33,18 +34,26 @@ func MatchScrapedPerformer(qb models.PerformerReader, p *models.ScrapedPerformer
// MatchScrapedStudio matches the provided studio with the studios
// in the database and sets the ID field if one is found.
func MatchScrapedStudio(qb models.StudioReader, s *models.ScrapedStudio) error {
studio, err := qb.FindByName(s.Name, true)
st, err := studio.ByName(qb, s.Name)
if err != nil {
return err
}
if studio == nil {
if st == nil {
// try matching by alias
st, err = studio.ByAlias(qb, s.Name)
if err != nil {
return err
}
}
if st == nil {
// ignore - cannot match
return nil
}
id := strconv.Itoa(studio.ID)
id := strconv.Itoa(st.ID)
s.StoredID = &id
return nil
}