Skip to content

Comments

Feature: Tag StashID support#6255

Merged
WithoutPants merged 5 commits intostashapp:developfrom
Gykes:Tag-Stash-Ids-clean
Nov 13, 2025
Merged

Feature: Tag StashID support#6255
WithoutPants merged 5 commits intostashapp:developfrom
Gykes:Tag-Stash-Ids-clean

Conversation

@Gykes
Copy link
Collaborator

@Gykes Gykes commented Nov 10, 2025

This adds the ability to add and store the associated StashIds with tags.

Currently StashIDs are added automatically when you add a tag via tagger or via plugin and GraphQL.

The only way to add StashId's to currently existing tags is to:

  • Run Identify and let it rematch
  • Use a plugin to add them
  • Retag it all.....

My testing:
Scrape a scene via tagger against StashDB. Add tags in the Tagger. Profit

If there is a better way to handle this other than building a dedicated tag tagger similar to studio tagger then let me know.

Fixes: #2643
UI:
Screenshot 2025-11-09 at 23 27 51

@Gykes Gykes changed the title Feature: Tag Stashdb support Feature: Tag StashID support Nov 10, 2025
@feederbox826
Copy link
Collaborator

Will test it later, havent had a chance to look at the code yet. Would it be possible to update them via GQL? I have a plugin that does auto-search and match either via my tag DB or by searching StashDB. Wouldn't recommend it for prod but would be great as a plugin

@Gykes
Copy link
Collaborator Author

Gykes commented Nov 10, 2025

Will test it later, havent had a chance to look at the code yet. Would it be possible to update them via GQL? I have a plugin that does auto-search and match either via my tag DB or by searching StashDB. Wouldn't recommend it for prod but would be great as a plugin

So, currently you can already do this with this:

New Tag:

mutation {
    tagCreate(input: {
      name: "Example Tag"
      stash_ids: [
        {
          endpoint: "https://stashdb.org/graphql"
          stash_id: "abc123-def456"
        }
      ]
    }) {
      id
      name
      stash_ids {
        endpoint
        stash_id
      }
    }
  }

Update Existing:

 mutation {
    tagUpdate(input: {
      id: "123"
      stash_ids: [
        {
          endpoint: "https://stashdb.org/graphql"
          stash_id: "abc123-def456"
        }
      ]
    }) {
      id
      name
      stash_ids {
        endpoint
        stash_id
      }
    }
  }

@DogmaDragon
Copy link
Collaborator

Not user friendly as is.

Also, since the StashID can only be applied via scene tagger (via UI), there is effectively not way have multiple StashIDs linked to the same tag. Be it from the same stash-box instance or multiple ones.

I think at least manual input field is needed. Though a proper search interface be it tagger or something else would be ideal.

@Gykes
Copy link
Collaborator Author

Gykes commented Nov 10, 2025

Not user friendly as is.

Also, since the StashID can only be applied via scene tagger (via UI), there is effectively not way have multiple StashIDs linked to the same tag. Be it from the same stash-box instance or multiple ones.

I think at least manual input field is needed. Though a proper search interface be it tagger or something else would be ideal.

I agree with you overall. Currently I kept it the same implementation as the rest of the StashID infrastructure. This could be step 1 of a larger project of eventually adding in a tagger for Tags. I could modify it to allow users to add in StashID's in the tag edit modal as a stopgap till that eventuality. I think it would need to be a conversation with WP for the larger scope of the project.

Edit: Since you can apply it via GraphQL you could also apply them via plugin

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.

Static code review only. Not yet tested.

Needs the following missing bits:

  • cover tag stash id table in anonymise.go
  • add StashIDs to jsonschema.Tag and import/export functionality
  • add unit test coverage for the new fields, see the performer tests for reference

@WithoutPants
Copy link
Collaborator

I think at least manual input field is needed.

Agree with Gykes here - let's push manually linking into a separate PR targeting 0.30 release. I'd like to get something in for manually linking stash-ids to all supporting objects (performers, studios, scenes, etc).

@WithoutPants WithoutPants added the feature Pull requests that add a new feature label Nov 12, 2025
@WithoutPants WithoutPants added this to the Version 0.30.0 milestone Nov 12, 2025
@Gykes
Copy link
Collaborator Author

Gykes commented Nov 12, 2025

Static code review only. Not yet tested.

Needs the following missing bits:

* cover tag stash id table in `anonymise.go`

* add `StashIDs` to `jsonschema.Tag` and import/export functionality

* add unit test coverage for the new fields, see the performer tests for reference

Fixed, took me a minute to figure out the unit testing but I think it's good?

@Gykes
Copy link
Collaborator Author

Gykes commented Nov 12, 2025

I think at least manual input field is needed.

Agree with Gykes here - let's push manually linking into a separate PR targeting 0.30 release. I'd like to get something in for manually linking stash-ids to all supporting objects (performers, studios, scenes, etc).

Once you are content with the major implementation I can go ahead and do the UI ability to manually add StashIDs.

remove wrapper

update updateAt

Update tag.go

please....

Fix builds
@Gykes Gykes force-pushed the Tag-Stash-Ids-clean branch from e1410ce to a405455 Compare November 12, 2025 05:40
@Gykes Gykes added the needs testing Pull requests that require testing label Nov 12, 2025
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.

I'm happy with this implementation.

Tests ran:

  • creating tags from the tagger interface correctly sets the stash id
  • tags matched in the tagger by name do not set stash id when saving, as expected
  • creating a tag from the scrape scene dialog does not set the stash id, more on this below
  • exporting includes stash id in json data
  • importing correctly sets stash id from json data
  • anonymise correctly removed stash ids from anonymised database
  • submitted draft to stash-box after renaming a tag with a stash id, to ensure it didn't match on name

I'd like to add the following work into 0.30 scope as a result of this addition:

  • as a first step, add stash-ids to created performers/studios/tags when creating inside the scrape dialog, to be more consistent with the tagger (ref: #4239) done: #6269
  • improve the create tag operation inside the tagger. This should probably be discussed in a separate issue, but clicking the plus button on a new tag should optionally allow the tag to be matched to an existing tag - something similar to what we do for performers
  • add the ability to add stash ids to scenes/performers/studios/tags - again this should probably be discussed in a separate issue. I figure an add button dropdown to select the stash-box instance, then opens a dialog to search for the object via name or stash id

@WithoutPants WithoutPants added the bounty This issue has a bounty on it in the OpenCollective label Nov 13, 2025
@WithoutPants WithoutPants merged commit c99825a into stashapp:develop Nov 13, 2025
2 checks passed
feederbox826 added a commit to feederbox826/plugins that referenced this pull request Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bounty This issue has a bounty on it in the OpenCollective feature Pull requests that add a new feature needs testing Pull requests that require testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add StashID's to Tags

4 participants