Import unlabeled style tokens from itemdb #30
Loading…
Reference in a new issue
No description provided.
Delete branch "armin-bot/impress:claude/itemdb-style-sync"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Builds on #28 and #29 (this branch includes their commits). Before merging, production needs an itemdb API key set as
ITEMDB_API_KEY.Why
Some of our alt styles are still unlabeled, mostly because the Styling Studio import wasn't running reliably while they were on sale. itemdb has the names and thumbnails of those styles' tokens, and sometimes their real descriptions.
What this does
Adds
Itemdb, a small client for itemdb's v2 API, authenticated in two steps: it trades the API key inITEMDB_API_KEYfor an hour-long token at/api/auth/token, then sends that token on each request. Following itemdb's advice, it loads their official NC Pet Styles list (/api/v2/lists/official/1037/itemdata) in one request, with pagination in case the list outgrows a page. For unnamed styles that aren't on the list yet, it falls back to/api/v2/items/manyby item ID, 100 at a time.Adds
rake itemdb:import:styles(supportsDRY_RUN=1), which:As a sanity check, only accepts a token name that ends in the style's species (like "Blended Burlap Aisha" for an Aisha style) or belongs to a character-named series ("Essence of…", "Treasured…"), unless run with
FORCE=1. Anything else is printed for a human to handle and left alone. The series name is inferred only when the name also ends in the style's color, as in the Styling Studio import.Credits itemdb on every style token's item page, with their logo and a link to the item on their site, since they ask that we be clear about where we use their data.
What it costs itemdb
One request for the list per run, using the
minimalintent. The by-ID fallback only covers unnamed styles missing from the list, which should be a handful at most.The list is maintained by hand and can include a non-token item by mistake. We only look up our own styles' IDs in it, so stray entries are ignored.
Open before merging
ITEMDB_API_KEY. (itemdb offered to raise our limits once we've created one.)neopets:importcron chain.Testing
🤖 Generated with Claude Code
https://claude.ai/code/session_014PWWd1ky1PrtZvpAv7vhe6
WIP: Import unlabeled style tokens from itemdbto Import unlabeled style tokens from itemdb16a9c7da6fe679b370bf