Skip to content

fix(javstashAutofill): correct name casing, store the stash-box id, simplify the source setting - #774

Open
dude-stash wants to merge 1 commit into
stashapp:mainfrom
dude-stash:javstash-autofill-fixes
Open

fix(javstashAutofill): correct name casing, store the stash-box id, simplify the source setting#774
dude-stash wants to merge 1 commit into
stashapp:mainfrom
dude-stash:javstash-autofill-fixes

Conversation

@dude-stash

Copy link
Copy Markdown

Fixes #773. Three fixes for Javstash Autofill, version bumped to 1.4.

1. The name is now corrected to the scraper's spelling

I usually type performer names without the right casing, and the plugin never fixed them. The rename check was:

prefer_scraper = bool(use_scraper_name) and bool(cand_name) and norm(cand_name) != norm(name)

norm() lowercases and strips spaces, so yua mikami and Yua Mikami are equal there and nothing happens.

Now:

same_name = norm(cand_name) == norm(name)
prefer_scraper = (bool(cand_name) and nfc(cand_name) != nfc(name)
                  and (bool(use_scraper_name) or same_name))

A difference in casing or spacing is always corrected, because it is the same name. A really different name still needs the "use scraper name as primary" toggle, as before. find_by_name() compares with norm() now as well, so an existing "Yua Mikami" is found as the duplicate and merged, instead of the rename hitting it.

2. The stash-box id is stored

remote_site_id was missing from the scrape query, so the id was never available. It is requested now and, when the source is a stash-box, written into stash_ids in all three paths (fill, rename, merge), without touching ids from other endpoints. Identify and the Tagger recognise the performer after autofill.

urls was added to the query too, because build_update() was reading cand.get("url") and that field was never fetched.

3. The source setting no longer needs the endpoint URL

Before, the setting wanted the full endpoint URL that Stash already has under Settings → Metadata Providers. Worse, resolveStashBox only accepts an endpoint that matches a configured one exactly, so a trailing slash or a small typo failed with "stash box not found" and the hook only logged a scrape error.

resolve_source() now looks the value up in configuration.general.stashBoxes and listScrapers(types: [PERFORMER]), in this order:

  1. stash-box name, e.g. StashDB
  2. exact endpoint URL
  3. any URL, passed through as before
  4. part of a name or endpoint, e.g. stashdb
  5. performer scraper id or name, e.g. Minnano-AV-JP

Empty uses javstash if it is configured, otherwise the first configured stash-box. The log line now says which source was used, for example via stash-box 'StashDB' (by name).

Old values keep working: a full URL and a scraper_id are still accepted, so nobody has to change their settings.

Testing

  • Tested against my own library: a manually created performer typed in lowercase gets the correct name, the StashDB id in stash_ids, and the fields filled.
  • The source resolution and the update building were also checked with a stubbed GraphQL client for every case listed above, including a stash-box that is not configured and a scraper name that does not exist.
  • node validate.js plugins/javstashAutofill/javstashAutofill.yml passes.

README and CHANGELOG updated.

AI assistance was used for this change.

…d, simplify the source setting

Three fixes, all reported in stashapp#773.

1. The primary name was never replaced when the typed name and the scraper
   name differed only in casing or spacing. The rename check compared the
   names through norm(), which lowercases and strips spaces, so
   "yua mikami" and "Yua Mikami" looked identical and the rename was
   skipped. A casing/spacing difference is now always corrected to the
   scraper's spelling; a genuinely different name still needs the
   "use scraper name as primary" toggle.

2. The scrape never requested remote_site_id, so the stash-box id of the
   matched performer could not be stored. It is now requested and written
   into stash_ids (fill, rename and merge paths), so Identify and the
   Tagger recognise the performer afterwards. The modern urls list is
   requested too - build_update() read cand["url"], which was never
   fetched.

3. The source setting required the full stash-box endpoint URL, even
   though Stash knows its own endpoints, and only accepts one that matches
   a configured endpoint exactly - a trailing slash or a wrong path failed
   with "stash box not found". resolve_source() now matches the value
   against configuration.general.stashBoxes and
   listScrapers(types: [PERFORMER]), so a stash-box name ("StashDB"), part
   of a name or endpoint ("stashdb"), a performer scraper name or id, or a
   full URL all work. Empty falls back to javstash when configured,
   otherwise the first configured stash-box. The resolved source is named
   in the log.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@garfolino

Copy link
Copy Markdown
Contributor

@suzuhiroruri Love the plugin, its been very helpful. I added a few improvements. :)

@discourse-stashapp

Copy link
Copy Markdown

This pull request has been mentioned on Stash Forum. There might be relevant details there:

https://discourse.stashapp.cc/t/javstash-autofill/11502/2

@DogmaDragon DogmaDragon added the type:plugin Plugins label Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Javstash Autofill] Scraped name never replaces the typed name; stash-box id is not stored; source needs a URL Stash already has

4 participants