mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Multiple scene URLs (#3852)
* Add URLs scene relationship * Update unit tests * Update scene edit and details pages * Update scrapers to use urls * Post-process scenes during query scrape * Update UI for URLs * Change urls label
This commit is contained in:
@@ -52,6 +52,11 @@ func isCDPPathWS(c GlobalConfig) bool {
|
||||
return strings.HasPrefix(c.GetScraperCDPPath(), "ws://")
|
||||
}
|
||||
|
||||
type SceneFinder interface {
|
||||
scene.IDFinder
|
||||
models.URLLoader
|
||||
}
|
||||
|
||||
type PerformerFinder interface {
|
||||
match.PerformerAutoTagQueryer
|
||||
match.PerformerFinder
|
||||
@@ -73,7 +78,7 @@ type GalleryFinder interface {
|
||||
}
|
||||
|
||||
type Repository struct {
|
||||
SceneFinder scene.IDFinder
|
||||
SceneFinder SceneFinder
|
||||
GalleryFinder GalleryFinder
|
||||
TagFinder TagFinder
|
||||
PerformerFinder PerformerFinder
|
||||
@@ -240,7 +245,19 @@ func (c Cache) ScrapeName(ctx context.Context, id, query string, ty ScrapeConten
|
||||
return nil, fmt.Errorf("%w: cannot use scraper %s to scrape by name", ErrNotSupported, id)
|
||||
}
|
||||
|
||||
return ns.viaName(ctx, c.client, query, ty)
|
||||
content, err := ns.viaName(ctx, c.client, query, ty)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while name scraping with scraper %s: %w", id, err)
|
||||
}
|
||||
|
||||
for i, cc := range content {
|
||||
content[i], err = c.postScrape(ctx, cc)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while post-scraping with scraper %s: %w", id, err)
|
||||
}
|
||||
}
|
||||
|
||||
return content, nil
|
||||
}
|
||||
|
||||
// ScrapeFragment uses the given fragment input to scrape
|
||||
@@ -361,7 +378,7 @@ func (c Cache) getScene(ctx context.Context, sceneID int) (*models.Scene, error)
|
||||
return fmt.Errorf("scene with id %d not found", sceneID)
|
||||
}
|
||||
|
||||
return nil
|
||||
return ret.LoadURLs(ctx, c.repository.SceneFinder)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user