Skip to content

Comments

Feature Request: Bulk Add by StashID and Name#6310

Merged
WithoutPants merged 12 commits intostashapp:developfrom
Gykes:batch-support-stashids
Nov 28, 2025
Merged

Feature Request: Bulk Add by StashID and Name#6310
WithoutPants merged 12 commits intostashapp:developfrom
Gykes:batch-support-stashids

Conversation

@Gykes
Copy link
Collaborator

@Gykes Gykes commented Nov 24, 2025

This PR allows users to uses StashID and/or name when bulk adding studios or performers.

I was able to get this to work on performers with no errors
Studios had errors that was related to the empty string aliases bug and I don't think it is due to this PR.

This PR was used to fix this issue with normal tagging and I believe it needs to be moved over to the batch create options too.

Testing:
1 performer by StashdID added (V4 and V7)
2 performers comma split by Stash ID added (V4 and V7)
3 performers comma split, 2 by stash ID and 1 by name (V4 and V7)

Comment on lines 444 to 457
} else if len(input.StashIDs) > 0 {
// The user is batch adding performers by stash ID
for i := range input.StashIDs {
stashID := input.StashIDs[i]
if len(stashID) > 0 {
tasks = append(tasks, StashBoxBatchTagTask{
stashID: &stashID,
refresh: true, // use refresh mode to query by ID
box: box,
excludedFields: input.ExcludeFields,
taskType: Performer,
})
}
}
Copy link
Collaborator

@WithoutPants WithoutPants Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it won't handle if you have both stash ids and names in the one operation, due to the if/else structure. It will handle the stash ids only and not the names.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to push my latest commit that fixes this.

@WithoutPants WithoutPants added this to the Version 0.30.0 milestone Nov 24, 2025
@Gykes Gykes added the needs testing Pull requests that require testing label Nov 25, 2025
Copy link
Collaborator

@feederbox826 feederbox826 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, still running into "studio alias must not be an empty string" bug

@Gykes
Copy link
Collaborator Author

Gykes commented Nov 25, 2025

Yea, will need to rebase when WP makes his changes to see that bug fixed

@DogmaDragon
Copy link
Collaborator

That fix was merged.

Comment on lines 24 to 45
@@ -44,24 +45,32 @@ func (t *StashBoxBatchTagTask) Start(ctx context.Context) {
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this task needs to be split up and refactored. I couldn't work out why you'd set refresh to true in manager_tasks.go until I looked through the code here. In the existing code refresh is used to determine whether to use the existing performer's applicable stash id or its name to search for the stash-box performer.

Your use of that parameter further muddies it's purpose because now it seems to be being used to indicate if it should search via a passed stash id. It's just a bit of a mess to follow.

Having a single task with two separate execution paths and inputs seems needlessly complicated as well.

My suggestion would be to split this into two private tasks:

type stashBoxBatchPerformerTagTask struct {
    // stash-box instance to search
	box            *models.StashBox
    // if set, searches by performer name
	name           *string
    // if set, searches by stash-id
	stashID        *string
    // if set, updates performer with matched stash-box performer. If unset, creates new performer
	performer      *models.Performer
}

type stashBoxBatchStudioTagTask struct {
    // stash-box instance to search
	box            *models.StashBox
    // if set, searches by performer name
	name           *string
    // if set, searches by stash-id
	stashID        *string
    // if set, updates performer with matched stash-box performer. If unset, creates new performer
	studio *models.Studio
}

I think this gives a clearer indication of the expected behaviour of each task, and simplifies the execution path a bit.

Copy link
Collaborator

@WithoutPants WithoutPants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring requested. See related comment.

@@ -1289,6 +1289,7 @@
"number_of_performers_will_be_processed": "{performer_count} performers will be processed",
"performer_already_tagged": "Performer already tagged",
"performer_names_separated_by_comma": "Performer names separated by comma",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entry is now unused and should be removed.

@@ -1498,6 +1499,7 @@
"status_tagging_studios": "Status: Tagging studios",
"studio_already_tagged": "Studio already tagged",
"studio_names_separated_by_comma": "Studio names separated by comma",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entry is now unused and should be removed.

@WithoutPants WithoutPants changed the title Feature Reuqest: Bulk Add by StashID and Name Feature Request: Bulk Add by StashID and Name Nov 26, 2025
@discourse-stashapp

This comment was marked as outdated.

@Gykes Gykes requested a review from WithoutPants November 26, 2025 22:05
@Gykes
Copy link
Collaborator Author

Gykes commented Nov 27, 2025

Lots of refactoring in this one. My eyes started to glaze over near the end but I was still able to test functionality. If documentation is still not to your liking then please feel free to update it yourself since that will probably be quicker lol

@Gykes Gykes requested a review from WithoutPants November 27, 2025 05:29
Copy link
Collaborator

@WithoutPants WithoutPants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things. I'll try to get some testing on it today.

@Gykes Gykes requested a review from WithoutPants November 27, 2025 21:42
@WithoutPants WithoutPants merged commit e052a43 into stashapp:develop Nov 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs testing Pull requests that require testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants