mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Autotag scraper (#1817)
* Refactor scraper structures * Move matching code into new package * Add autotag scraper * Always check first letter of auto-tag names * Account for nulls Co-authored-by: Kermie <kermie@isinthe.house>
This commit is contained in:
@@ -19,7 +19,7 @@ func (e scraperAction) IsValid() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type scraper interface {
|
||||
type scraperActionImpl interface {
|
||||
scrapePerformersByName(name string) ([]*models.ScrapedPerformer, error)
|
||||
scrapePerformerByFragment(scrapedPerformer models.ScrapedPerformerInput) (*models.ScrapedPerformer, error)
|
||||
scrapePerformerByURL(url string) (*models.ScrapedPerformer, error)
|
||||
@@ -36,16 +36,16 @@ type scraper interface {
|
||||
scrapeMovieByURL(url string) (*models.ScrapedMovie, error)
|
||||
}
|
||||
|
||||
func getScraper(scraper scraperTypeConfig, txnManager models.TransactionManager, config config, globalConfig GlobalConfig) scraper {
|
||||
func (c config) getScraper(scraper scraperTypeConfig, txnManager models.TransactionManager, globalConfig GlobalConfig) scraperActionImpl {
|
||||
switch scraper.Action {
|
||||
case scraperActionScript:
|
||||
return newScriptScraper(scraper, config, globalConfig)
|
||||
return newScriptScraper(scraper, c, globalConfig)
|
||||
case scraperActionStash:
|
||||
return newStashScraper(scraper, txnManager, config, globalConfig)
|
||||
return newStashScraper(scraper, txnManager, c, globalConfig)
|
||||
case scraperActionXPath:
|
||||
return newXpathScraper(scraper, txnManager, config, globalConfig)
|
||||
return newXpathScraper(scraper, txnManager, c, globalConfig)
|
||||
case scraperActionJson:
|
||||
return newJsonScraper(scraper, txnManager, config, globalConfig)
|
||||
return newJsonScraper(scraper, txnManager, c, globalConfig)
|
||||
}
|
||||
|
||||
panic("unknown scraper action: " + scraper.Action)
|
||||
|
||||
Reference in New Issue
Block a user