You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin fetches performer images and scene screenshots via raw urllib.request.urlopen():
# line ~189image=face_recognition.load_image_file(urllib.request.urlopen(performer['image_path']))
# line ~202image=urllib.request.urlopen(scene['paths']['screenshot'])
Neither call attaches the session cookie Stash hands plugins via json_input["server_connection"]["SessionCookie"]["Value"]. With Stash configured to require authentication (username + password set in config.yml), every urlopen returns the login page HTML instead of the image, and PIL raises:
ERRO [Plugin / Star Identifier] cannot identify image file <_io.BytesIO object at 0x...>
Export Performers writes no encodings file, and the subsequent identify task then fails with:
Encoding database not found at .../star-identifier-encodings/star-identifier-encodings.npz.
Run Export Performers and try again.
Without auth (the unsecured deployment case) this path works by accident.
The plugin's IdentifierStashInterface class already receives and stores the session cookie — it's used for the GraphQL POST in __callGraphQL, just not for the image fetches.
Repro
Configure Stash with username + password in config.yml.
Run Export Performers — every performer hits cannot identify image file.
Suggested fix
Module-global the cookie (so ProcessPoolExecutor workers inherit it via fork() on Linux) and route the two image fetches through a helper. Minimal patch:
# near the top, after the existing imports:SESSION_COOKIE=Nonedef_open_with_cookie(url):
req=urllib.request.Request(url)
ifSESSION_COOKIE:
req.add_header("Cookie", f"session={SESSION_COOKIE}")
returnurllib.request.urlopen(req)
# inside run(), right after `client = IdentifierStashInterface(...)`:globalSESSION_COOKIESESSION_COOKIE=client.cookies.get("session")
# encode_performer_from_url + get_recognized_ids_from_scene_screenshot:# replace `urllib.request.urlopen(...)` calls with `_open_with_cookie(...)`
Verified locally — Export Performers now actually processes images and writes the .npz.
Portability note
This works because Python's ProcessPoolExecutor uses fork as the default start-method on Linux, and forked workers inherit module-level state set before the fork point. On spawn/forkserver (Windows; or if a future CPython release changes the default) the global wouldn't propagate. Passing the cookie as an explicit arg via executor.submit(fn, item, SESSION_COOKIE) is more portable but requires changing the call sites and the execute_identification_list harness signature.
Plugin
plugins/starIdentifier—star_identifier.pyBug
The plugin fetches performer images and scene screenshots via raw
urllib.request.urlopen():Neither call attaches the session cookie Stash hands plugins via
json_input["server_connection"]["SessionCookie"]["Value"]. With Stash configured to require authentication (username + password set inconfig.yml), everyurlopenreturns the login page HTML instead of the image, and PIL raises:Export Performerswrites no encodings file, and the subsequent identify task then fails with:Without auth (the unsecured deployment case) this path works by accident.
The plugin's
IdentifierStashInterfaceclass already receives and stores the session cookie — it's used for the GraphQL POST in__callGraphQL, just not for the image fetches.Repro
username+passwordinconfig.yml.cannot identify image file.Suggested fix
Module-global the cookie (so
ProcessPoolExecutorworkers inherit it viafork()on Linux) and route the two image fetches through a helper. Minimal patch:Verified locally —
Export Performersnow actually processes images and writes the.npz.Portability note
This works because Python's
ProcessPoolExecutorusesforkas the default start-method on Linux, and forked workers inherit module-level state set before the fork point. Onspawn/forkserver(Windows; or if a future CPython release changes the default) the global wouldn't propagate. Passing the cookie as an explicit arg viaexecutor.submit(fn, item, SESSION_COOKIE)is more portable but requires changing the call sites and theexecute_identification_listharness signature.Environment
v0.31.1(4de2351e)stashapp/stash:latest(Alpine, Python 3.12.13)1.0config.yml