From 644a7e1d9278094d6f1403ad09730e7dabeca621 Mon Sep 17 00:00:00 2001 From: ewin Date: Wed, 20 Aug 2025 00:03:24 -0600 Subject: [PATCH] Update categories for EDB ID script --- bin/add-edb-ids | 25 ++++++++++++++----------- bin/add-gt-ids | 4 ++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bin/add-edb-ids b/bin/add-edb-ids index c388da3..cbb1f07 100755 --- a/bin/add-edb-ids +++ b/bin/add-edb-ids @@ -33,18 +33,21 @@ function insertInfoboxEDBID (pageContent, edbID) { const mw = await getMediawikiClient(); -// Get pages in the "Missing EDB ID" category from the main article namespace -const [itemPagesWithoutEDBIDs, questPagesWithoutEDBIDs] = await Promise.all([ - mw.listCategoryPages('Category:Missing EDB ID', [0], +process.env.LIMIT || 500), - mw.listCategoryPages('Category:Missing quest EDB ID', [0], +process.env.LIMIT || 500), -]); -console.log('Processing', itemPagesWithoutEDBIDs.length, 'item pages from [[Category:Missing EDB ID]]\n'); -console.log('Processing', questPagesWithoutEDBIDs.length, 'item pages from [[Category:Missing quest EDB ID]]\n'); +const categoryTypes = { + 'Category:Items with no EDB ID specified': 'item', + 'Category:Minions with no EDB ID specified': 'item', + 'Category:Triple Triad cards with no EDB ID specified': 'item', + 'Category:Quests with no EDB ID specified': 'quest', +}; -for (const {title, type} of [ - ...itemPagesWithoutEDBIDs.map(({title}) => ({title, type: 'item'})), - ...questPagesWithoutEDBIDs.map(({title}) => ({title, type: 'quest'})), -]) { +const pages = (await Promise.all(Object.entries(categoryTypes).map(async ([category, type]) => { + const pages = await mw.listCategoryPages(category, [0], +process.env.LIMIT || 500); + return pages.map(({title}) => ({title, type})); +}))).flat(); + +console.log('Processing', pages.length, 'items\n'); + +for (const {title, type} of pages) { // this runs serially with an artificial delay between requests to decrease // the chance of sqenix sending ninjas to my house await new Promise(resolve => setTimeout(resolve, 1000)); diff --git a/bin/add-gt-ids b/bin/add-gt-ids index 49b47f7..f6988be 100755 --- a/bin/add-gt-ids +++ b/bin/add-gt-ids @@ -1,5 +1,8 @@ #!/usr/bin/env -S node --env-file-if-exists=.env +console.log(process.env); +process.exit(1); + import {findItemGTID} from '../lib/api/xivapi.js'; import {getMediawikiClient} from '../lib/config.js'; import {diff} from '../lib/util/diff.js'; @@ -33,6 +36,7 @@ function insertInfoboxGTBID (pageContent, gtID) { const mw = await getMediawikiClient(); +// TODO: update this to work with the new maintenance category hierarchy // Get pages in the "Missing internal ID" category from the main article namespace const itemPagesWithoutGTIDs = await mw.listCategoryPages('Category:Missing internal ID', [0], +process.env.LIMIT || 500); console.log('Processing', itemPagesWithoutGTIDs.length, 'item pages from [[Category:Missing internal ID]]\n');