Work on #16 - add PCGW gogcom_id to manifest

This commit is contained in:
Sascha Lüdecke 2022-11-01 12:19:03 +01:00
parent c9be033706
commit 555f869dfa
4 changed files with 22 additions and 0 deletions

View file

@ -100,3 +100,8 @@ additionalProperties:
properties:
id:
type: integer
gog:
type: object
properties:
id:
type: integer

View file

@ -81,3 +81,8 @@ additionalProperties:
properties:
id:
type: integer
gog:
type: object
properties:
id:
type: integer

View file

@ -40,6 +40,9 @@ export interface Game {
steam?: {
id?: number
};
gog?: {
id?: number,
};
}
export interface Constraint {
@ -77,6 +80,9 @@ function integrateWikiData(game: Game, cache: WikiGameCache[""]): void {
if (cache.steam !== undefined) {
game.steam = { id: cache.steam };
}
if (cache.gog !== undefined) {
game.gog = { id: cache.gog };
}
const info = parseTemplates(cache.templates ?? []);
game.files = info.files;
game.registry = info.registry;

View file

@ -37,6 +37,8 @@ export type WikiGameCache = {
renamedFrom?: Array<string>,
templates?: Array<string>,
steam?: number,
gog?: number
};
};
@ -587,6 +589,10 @@ export async function getGame(pageTitle: string, cache: WikiGameCache, client: W
if (!isNaN(steamId) && steamId > 0) {
cache[pageTitle].steam = steamId;
}
const gogId = Number(template.parameters["gogcom id"]);
if (!isNaN(gogId) && gogId > 0) {
cache[pageTitle].gog = gogId
}
} else if (templateName === "game data/saves" || templateName === "game data/config") {
const reparsed = parseWiki(template.toString());
if (reparsed[0].positionalParameters[1]?.length > 0 ?? false) {