mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Movie group renames (#5039)
* Rename Movie and MoviePartial to Group/GroupPartial * Rename Movie interfaces * Update movie url builders to use group * Rename movieRoutes to groupRoutes * Update dataloader * Update names in sqlite package * Rename in resolvers * Add GroupByURL to scraper config * Scraper backward compatibility hacks
This commit is contained in:
@@ -167,39 +167,39 @@ func GetDependentTagIDs(ctx context.Context, tags TagFinder, markerReader models
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// GetSceneMoviesJSON returns a slice of SceneMovie JSON representation objects
|
||||
// corresponding to the provided scene's scene movie relationships.
|
||||
func GetSceneMoviesJSON(ctx context.Context, movieReader models.MovieGetter, scene *models.Scene) ([]jsonschema.SceneMovie, error) {
|
||||
sceneMovies := scene.Movies.List()
|
||||
// GetSceneGroupsJSON returns a slice of SceneGroup JSON representation objects
|
||||
// corresponding to the provided scene's scene group relationships.
|
||||
func GetSceneGroupsJSON(ctx context.Context, groupReader models.GroupGetter, scene *models.Scene) ([]jsonschema.SceneGroup, error) {
|
||||
sceneGroups := scene.Groups.List()
|
||||
|
||||
var results []jsonschema.SceneMovie
|
||||
for _, sceneMovie := range sceneMovies {
|
||||
movie, err := movieReader.Find(ctx, sceneMovie.MovieID)
|
||||
var results []jsonschema.SceneGroup
|
||||
for _, sceneGroup := range sceneGroups {
|
||||
group, err := groupReader.Find(ctx, sceneGroup.GroupID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting movie: %v", err)
|
||||
return nil, fmt.Errorf("error getting group: %v", err)
|
||||
}
|
||||
|
||||
if movie != nil {
|
||||
sceneMovieJSON := jsonschema.SceneMovie{
|
||||
MovieName: movie.Name,
|
||||
if group != nil {
|
||||
sceneGroupJSON := jsonschema.SceneGroup{
|
||||
GroupName: group.Name,
|
||||
}
|
||||
if sceneMovie.SceneIndex != nil {
|
||||
sceneMovieJSON.SceneIndex = *sceneMovie.SceneIndex
|
||||
if sceneGroup.SceneIndex != nil {
|
||||
sceneGroupJSON.SceneIndex = *sceneGroup.SceneIndex
|
||||
}
|
||||
results = append(results, sceneMovieJSON)
|
||||
results = append(results, sceneGroupJSON)
|
||||
}
|
||||
}
|
||||
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// GetDependentMovieIDs returns a slice of movie IDs that this scene references.
|
||||
func GetDependentMovieIDs(ctx context.Context, scene *models.Scene) ([]int, error) {
|
||||
// GetDependentGroupIDs returns a slice of group IDs that this scene references.
|
||||
func GetDependentGroupIDs(ctx context.Context, scene *models.Scene) ([]int, error) {
|
||||
var ret []int
|
||||
|
||||
m := scene.Movies.List()
|
||||
m := scene.Groups.List()
|
||||
for _, mm := range m {
|
||||
ret = append(ret, mm.MovieID)
|
||||
ret = append(ret, mm.GroupID)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
|
||||
Reference in New Issue
Block a user