Fix Steam ID being skipped/cleared

This commit is contained in:
mtkennerly 2022-07-05 15:39:39 +08:00
parent 77809e7ed9
commit 4d8218b042
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
2 changed files with 11 additions and 8 deletions

View file

@ -50820,6 +50820,7 @@ Dirty Education:
renamedFrom: renamedFrom:
- Dirty Education / 肉的教育 - Dirty Education / 肉的教育
revId: 1261825 revId: 1261825
steam: 1018040
Dirty Fighter 1: Dirty Fighter 1:
pageId: 65329 pageId: 65329
revId: 1184703 revId: 1184703
@ -166101,7 +166102,7 @@ Sonic Origins:
steam: 1794960 steam: 1794960
templates: templates:
- |- - |-
{{Game data/config|Steam|{{p|appdata}}\Sega\SonicOrigins\steam\{{p|uid}}\option\data.dat | {{Game data/config|Steam|{{p|appdata}}\Sega\SonicOrigins\steam\{{p|uid}}\option\data.dat |
{{p|appdata}}\Sega\SonicOrigins\steam\x64\screen_setting.xml}} {{p|appdata}}\Sega\SonicOrigins\steam\x64\screen_setting.xml}}
- '{{Game data/saves|Steam|{{p|appdata}}\Sega\SonicOrigins\steam\{{p|uid}}\game\data.dat}}' - '{{Game data/saves|Steam|{{p|appdata}}\Sega\SonicOrigins\steam\{{p|uid}}\game\data.dat}}'
Sonic P-06: Sonic P-06:

View file

@ -90,13 +90,15 @@ export class WikiGameCacheFile extends YamlFile<WikiGameCache> {
continue; continue;
} }
} }
if (games.length > 0 && !games.includes(pageTitle)) { if (games.length > 0) {
continue; if (!games.includes(pageTitle)) {
continue;
}
} else if (!all && this.data[pageTitle].revId !== null && !this.data[pageTitle].recentlyChanged) { } else if (!all && this.data[pageTitle].revId !== null && !this.data[pageTitle].recentlyChanged) {
continue; continue;
} }
// console.log(`Refreshing wiki page ${pageTitle}`); // console.log(`Refreshing wiki page: ${pageTitle}`);
await getGame(pageTitle, this.data, client); await getGame(pageTitle, this.data, client);
i++; i++;
@ -139,8 +141,8 @@ export class WikiGameCacheFile extends YamlFile<WikiGameCache> {
console.log(`[ M ] ${recentName} <<< ${existingName}`); console.log(`[ M ] ${recentName} <<< ${existingName}`);
renamed = true; renamed = true;
this.data[recentName] = { this.data[recentName] = {
...existingInfo,
pageId: recentInfo.pageId, pageId: recentInfo.pageId,
revId: existingInfo.revId,
recentlyChanged: true, recentlyChanged: true,
renamedFrom: [...(existingInfo.renamedFrom ?? []), existingName] renamedFrom: [...(existingInfo.renamedFrom ?? []), existingName]
}; };
@ -410,7 +412,7 @@ function getConstraintFromSystem(system: string, path: string): Constraint {
} else { } else {
try { try {
constraint.os = parseOs(system); constraint.os = parseOs(system);
} catch {} } catch { }
} }
const storeFromPath = getStoreConstraintFromPath(path); const storeFromPath = getStoreConstraintFromPath(path);
@ -568,7 +570,7 @@ export async function getGame(pageTitle: string, cache: WikiGameCache, client: W
delete cache[pageTitle].templates; delete cache[pageTitle].templates;
page.parse().each("template", template => { page.parse().each("template", template => {
const templateName = template.name.toLowerCase(); const templateName = template.name.toLowerCase();
if (templateName === "Infobox game") { if (templateName === "infobox game") {
const steamId = Number(template.parameters["steam appid"]); const steamId = Number(template.parameters["steam appid"]);
if (!isNaN(steamId) && steamId > 0) { if (!isNaN(steamId) && steamId > 0) {
cache[pageTitle].steam = steamId; cache[pageTitle].steam = steamId;
@ -591,7 +593,7 @@ export async function getGame(pageTitle: string, cache: WikiGameCache, client: W
function flattenParameter(nodes: Array<WikiNode>): [string, boolean] { function flattenParameter(nodes: Array<WikiNode>): [string, boolean] {
let composite = ""; let composite = "";
let regular = true; let regular = true;
for (const node of nodes) { for (const node of nodes) {
if (typeof node === "string") { if (typeof node === "string") {