Split steamId into an object and add --unchecked flag

This commit is contained in:
mtkennerly 2020-06-29 00:56:30 -04:00
parent f2a461f1a0
commit d715380e0b
9 changed files with 471 additions and 193 deletions

View file

@ -5,8 +5,9 @@ Requires Node.js.
* `npm run cache` * `npm run cache`
* Update the manifest with games from the cache (`--limit 25` is default at a time): * Update the manifest with games from the cache (`--limit 25` is default at a time):
* All games in cache: `npm run manifest -- --all` * All games in cache: `npm run manifest -- --all`
* Games missing from manifest: `npm run manifest -- --missing`
* Games already in the manifest: `npm run manifest -- --existing` * Games already in the manifest: `npm run manifest -- --existing`
* Games missing from manifest: `npm run manifest -- --missing`
* Games not yet checked on the wiki: `npm run manifest -- --unchecked`
* Games that had an unknown OS: `npm run manifest -- --unsuportedOs` * Games that had an unknown OS: `npm run manifest -- --unsuportedOs`
* Games that had an unusable path: `npm run manifest -- --unsupportedPath` * Games that had an unusable path: `npm run manifest -- --unsupportedPath`
* A specific game: `npm run manifest -- --game "Name of Game"` * A specific game: `npm run manifest -- --game "Name of Game"`

View file

@ -50,7 +50,8 @@ An Example Game:
tags: tags:
- save - save
- config - config
steamId: 123 steam:
id: 123
``` ```
This means: This means:
@ -78,8 +79,8 @@ Paths can include these placeholders:
| `<winDir>` | `%WINDIR%` on Windows | | `<winDir>` | `%WINDIR%` on Windows |
| `<xdgData>` | `$XDG_DATA_HOME` on Linux | | `<xdgData>` | `$XDG_DATA_HOME` on Linux |
| `<xdgConfig>` | `$XDG_CONFIG_HOME` on Linux | | `<xdgConfig>` | `$XDG_CONFIG_HOME` on Linux |
| `regHkcu` | `HKEY_CURRENT_USER` in the Windows registry | | `<regHkcu>` | `HKEY_CURRENT_USER` in the Windows registry |
| `regHklm` | `HKEY_LOCAL_MACHINE` in the Windows registry | | `<regHklm>` | `HKEY_LOCAL_MACHINE` in the Windows registry |
## Implementation ## Implementation
Tools must implement the following in addition to respecting the schema: Tools must implement the following in addition to respecting the schema:

File diff suppressed because it is too large Load diff

View file

@ -469,7 +469,6 @@
* [A Legionary's Life](https://www.pcgamingwiki.com/wiki/?curid=134830) * [A Legionary's Life](https://www.pcgamingwiki.com/wiki/?curid=134830)
* [A Lenda do Herói](https://www.pcgamingwiki.com/wiki/?curid=38191) * [A Lenda do Herói](https://www.pcgamingwiki.com/wiki/?curid=38191)
* [A Light in the Dark](https://www.pcgamingwiki.com/wiki/?curid=87557) * [A Light in the Dark](https://www.pcgamingwiki.com/wiki/?curid=87557)
* [A Little Lily Princess](https://www.pcgamingwiki.com/wiki/?curid=34700)
* [A Little Rabbit Story](https://www.pcgamingwiki.com/wiki/?curid=80968) * [A Little Rabbit Story](https://www.pcgamingwiki.com/wiki/?curid=80968)
* [A Long Night For Crazy King](https://www.pcgamingwiki.com/wiki/?curid=150754) * [A Long Night For Crazy King](https://www.pcgamingwiki.com/wiki/?curid=150754)
* [A Long Road Home](https://www.pcgamingwiki.com/wiki/?curid=56912) * [A Long Road Home](https://www.pcgamingwiki.com/wiki/?curid=56912)
@ -21089,7 +21088,6 @@
* [Lone Echo](https://www.pcgamingwiki.com/wiki/?curid=128780) * [Lone Echo](https://www.pcgamingwiki.com/wiki/?curid=128780)
* [Lone Leader](https://www.pcgamingwiki.com/wiki/?curid=52107) * [Lone Leader](https://www.pcgamingwiki.com/wiki/?curid=52107)
* [Lone Pirate VR](https://www.pcgamingwiki.com/wiki/?curid=62951) * [Lone Pirate VR](https://www.pcgamingwiki.com/wiki/?curid=62951)
* [Lone Survivor](https://www.pcgamingwiki.com/wiki/?curid=3011)
* [Lone Vessel](https://www.pcgamingwiki.com/wiki/?curid=71723) * [Lone Vessel](https://www.pcgamingwiki.com/wiki/?curid=71723)
* [Lone Warrior](https://www.pcgamingwiki.com/wiki/?curid=71621) * [Lone Warrior](https://www.pcgamingwiki.com/wiki/?curid=71621)
* [Lone Wolf: Horizon](https://www.pcgamingwiki.com/wiki/?curid=44653) * [Lone Wolf: Horizon](https://www.pcgamingwiki.com/wiki/?curid=44653)
@ -27655,8 +27653,6 @@
* [Pretty Girls Panic!](https://www.pcgamingwiki.com/wiki/?curid=55261) * [Pretty Girls Panic!](https://www.pcgamingwiki.com/wiki/?curid=55261)
* [Prevent the Fall](https://www.pcgamingwiki.com/wiki/?curid=58469) * [Prevent the Fall](https://www.pcgamingwiki.com/wiki/?curid=58469)
* [Preventive Strike](https://www.pcgamingwiki.com/wiki/?curid=75149) * [Preventive Strike](https://www.pcgamingwiki.com/wiki/?curid=75149)
* [Prey](https://www.pcgamingwiki.com/wiki/?curid=10517)
* [Prey (2017)](https://www.pcgamingwiki.com/wiki/?curid=33371)
* [Prey with Gun](https://www.pcgamingwiki.com/wiki/?curid=73532) * [Prey with Gun](https://www.pcgamingwiki.com/wiki/?curid=73532)
* [Prey: Typhon Hunter](https://www.pcgamingwiki.com/wiki/?curid=124903) * [Prey: Typhon Hunter](https://www.pcgamingwiki.com/wiki/?curid=124903)
* [PRICE](https://www.pcgamingwiki.com/wiki/?curid=40042) * [PRICE](https://www.pcgamingwiki.com/wiki/?curid=40042)

View file

@ -14,22 +14,23 @@ definitions:
Os: Os:
type: string type: string
enum: enum:
- windows
- linux - linux
- mac - mac
- windows
Store: Store:
type: string type: string
enum: enum:
- steam
- epic
- discord - discord
- epic
- gog
- origin - origin
- steam
- uplay - uplay
Tag: Tag:
type: string type: string
enum: enum:
- save
- config - config
- save
type: object type: object
additionalProperties: additionalProperties:
@ -63,5 +64,8 @@ additionalProperties:
type: array type: array
items: items:
$ref: "#/definitions/RegistryConstraint" $ref: "#/definitions/RegistryConstraint"
steamId: steam:
type: object
properties:
id:
type: integer type: integer

View file

@ -50,5 +50,8 @@ additionalProperties:
type: array type: array
items: items:
$ref: "#/definitions/RegistryConstraint" $ref: "#/definitions/RegistryConstraint"
steamId: steam:
type: object
properties:
id:
type: integer type: integer

View file

@ -22,6 +22,8 @@
installDir: '1406' installDir: '1406'
'1055140': '1055140':
installDir: 10-4 installDir: 10-4
'1058430':
installDir: A Legionary's Life
'1063230': '1063230':
installDir: '6120' installDir: '6120'
'1063560': '1063560':
@ -68,6 +70,8 @@
installDir: 123kickit installDir: 123kickit
'205690': '205690':
installDir: 1000 Amps installDir: 1000 Amps
'209830':
installDir: Lone Survivor
'211670': '211670':
installDir: 007 Legends installDir: 007 Legends
'227580': '227580':
@ -116,6 +120,8 @@
installDir: 10 Minute Barbarian installDir: 10 Minute Barbarian
'396800': '396800':
installDir: 12 Labours of Hercules IV Mother Nature installDir: 12 Labours of Hercules IV Mother Nature
'3970':
installDir: Prey 2006
'405180': '405180':
installDir: 123 Slaughter Me Street installDir: 123 Slaughter Me Street
'406730': '406730':
@ -132,6 +138,8 @@
installDir: 10 Second Ninja X installDir: 10 Second Ninja X
'439550': '439550':
installDir: '''n Verlore Verstand' installDir: '''n Verlore Verstand'
'449250':
installDir: A Little Lily Princess
'449940': '449940':
installDir: '! That Bastard Is Trying To Steal Our Gold !' installDir: '! That Bastard Is Trying To Steal Our Gold !'
'470060': '470060':
@ -140,6 +148,8 @@
installDir: .EXE installDir: .EXE
'477010': '477010':
installDir: 10 Minute Tower installDir: 10 Minute Tower
'480490':
installDir: Prey
'491330': '491330':
installDir: 12 Labours of Hercules V Kids of Hellas installDir: 12 Labours of Hercules V Kids of Hellas
'497400': '497400':
@ -200,6 +210,8 @@
installDir: projekt installDir: projekt
'761190': '761190':
installDir: '1010' installDir: '1010'
'766280':
installDir: A Light in the Dark
'771710': '771710':
installDir: Test Expected Behaviour installDir: Test Expected Behaviour
'791180': '791180':

View file

@ -36,13 +36,13 @@ $1 Ride:
revId: 841129 revId: 841129
'''90s Football Stars': '''90s Football Stars':
pageId: 98644 pageId: 98644
revId: 841107 revId: 975157
'''n Verlore Verstand': '''n Verlore Verstand':
pageId: 43728 pageId: 43728
revId: 892716 revId: 892716
'***': '***':
pageId: 129579 pageId: 129579
revId: 841120 revId: 976962
'-KLAUS-': '-KLAUS-':
pageId: 113092 pageId: 113092
revId: 841110 revId: 841110
@ -69,7 +69,7 @@ $1 Ride:
revId: 952124 revId: 952124
0 A.D.: 0 A.D.:
pageId: 6203 pageId: 6203
revId: 974024 revId: 978749
0 Day: 0 Day:
pageId: 53391 pageId: 53391
revId: 841116 revId: 841116
@ -93,7 +93,7 @@ $1 Ride:
revId: 841123 revId: 841123
0°N 0°W: 0°N 0°W:
pageId: 67968 pageId: 67968
revId: 841124 revId: 978315
1 Hit Kill: 1 Hit Kill:
pageId: 103249 pageId: 103249
revId: 841125 revId: 841125
@ -165,7 +165,7 @@ $1 Ride:
revId: 839598 revId: 839598
100$: 100$:
pageId: 127526 pageId: 127526
revId: 910085 revId: 976963
100% Orange Juice!: 100% Orange Juice!:
pageId: 27256 pageId: 27256
revId: 947097 revId: 947097
@ -363,7 +363,7 @@ $1 Ride:
revId: 939407 revId: 939407
18+: 18+:
pageId: 98580 pageId: 98580
revId: 917659 revId: 978068
18+ MEMORY: 18+ MEMORY:
pageId: 156473 pageId: 156473
revId: 931643 revId: 931643
@ -1500,22 +1500,22 @@ A Legend of Luca:
revId: 841528 revId: 841528
A Legionary's Life: A Legionary's Life:
pageId: 134830 pageId: 134830
revId: null revId: 936654
A Lenda do Herói: A Lenda do Herói:
pageId: 38191 pageId: 38191
revId: null revId: 977793
A Light in the Dark: A Light in the Dark:
pageId: 87557 pageId: 87557
revId: null revId: 841531
A Little Lily Princess: A Little Lily Princess:
pageId: 34700 pageId: 34700
revId: null revId: 841532
A Little Rabbit Story: A Little Rabbit Story:
pageId: 80968 pageId: 80968
revId: null revId: 841533
A Long Night For Crazy King: A Long Night For Crazy King:
pageId: 150754 pageId: 150754
revId: null revId: 902479
A Long Road Home: A Long Road Home:
pageId: 56912 pageId: 56912
revId: null revId: null
@ -63414,7 +63414,7 @@ Lone Pirate VR:
revId: null revId: null
Lone Survivor: Lone Survivor:
pageId: 3011 pageId: 3011
revId: null revId: 962604
Lone Vessel: Lone Vessel:
pageId: 71723 pageId: 71723
revId: null revId: null
@ -83139,10 +83139,11 @@ Preventive Strike:
revId: null revId: null
Prey: Prey:
pageId: 10517 pageId: 10517
revId: null revId: 973111
Prey (2017): Prey (2017):
pageId: 33371 pageId: 33371
revId: null revId: 978549
unsupportedOs: true
Prey with Gun: Prey with Gun:
pageId: 73532 pageId: 73532
revId: null revId: null

View file

@ -4,9 +4,9 @@ import * as pathMod from "path";
import * as minimist from "minimist"; import * as minimist from "minimist";
import * as yaml from "js-yaml"; import * as yaml from "js-yaml";
import * as SteamUser from "steam-user"; import * as SteamUser from "steam-user";
import { resolve } from "path";
const REPO = pathMod.dirname(__dirname); const REPO = pathMod.dirname(__dirname);
const DELAY_BETWEEN_GAMES_MS = 1000;
interface Cli { interface Cli {
cache?: boolean, cache?: boolean,
@ -14,6 +14,7 @@ interface Cli {
all?: boolean, all?: boolean,
existing?: boolean, existing?: boolean,
missing?: boolean, missing?: boolean,
unchecked?: boolean,
unsupportedOs?: boolean, unsupportedOs?: boolean,
unsupportedPath?: boolean, unsupportedPath?: boolean,
game?: string, game?: string,
@ -185,7 +186,9 @@ interface Game {
tags?: Array<Tag>, tags?: Array<Tag>,
} }
}; };
steamId?: number; steam?: {
id?: number
};
} }
interface Constraint { interface Constraint {
@ -381,6 +384,7 @@ class ManifestFile extends YamlFile<Manifest> {
all: boolean, all: boolean,
existing: boolean, existing: boolean,
missing: boolean, missing: boolean,
unchecked: boolean,
unsupportedOs: boolean, unsupportedOs: boolean,
unsupportedPath: boolean, unsupportedPath: boolean,
game: string | undefined, game: string | undefined,
@ -400,6 +404,9 @@ class ManifestFile extends YamlFile<Manifest> {
if (filter.missing && !this.data.hasOwnProperty(title)) { if (filter.missing && !this.data.hasOwnProperty(title)) {
check = true; check = true;
} }
if (filter.unchecked && wikiCache[title].revId === null) {
check = true;
}
if (filter.unsupportedOs && info.unsupportedOs) { if (filter.unsupportedOs && info.unsupportedOs) {
check = true; check = true;
} }
@ -419,12 +426,12 @@ class ManifestFile extends YamlFile<Manifest> {
} }
const game = await getGame(title, wikiCache); const game = await getGame(title, wikiCache);
if (game.files === undefined && game.registry === undefined && game.steamId === undefined) { if (game.files === undefined && game.registry === undefined && game.steam?.id === undefined) {
delete this.data[title]; delete this.data[title];
continue; continue;
} }
if (game.steamId !== undefined) { if (game.steam?.id !== undefined) {
const installDir = await steamCache.getAppInstallDir(game.steamId); const installDir = await steamCache.getAppInstallDir(game.steam.id);
if (installDir !== undefined) { if (installDir !== undefined) {
if (game.installDir === undefined) { if (game.installDir === undefined) {
game.installDir = {} game.installDir = {}
@ -433,6 +440,8 @@ class ManifestFile extends YamlFile<Manifest> {
} }
} }
this.data[title] = game; this.data[title] = game;
await new Promise(resolve => setTimeout(resolve, DELAY_BETWEEN_GAMES_MS));
} }
} }
} }
@ -455,7 +464,7 @@ async function getGame(pageTitle: string, cache: WikiGameCache): Promise<Game> {
if (template.name === "Infobox game") { if (template.name === "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) {
game.steamId = steamId; game.steam = { id: steamId };
} }
} else if (template.name === "Game data/saves" || template.name === "Game data/config") { } else if (template.name === "Game data/saves" || template.name === "Game data/config") {
const rawPath = typeof template.parameters[2] === "string" ? template.parameters[2] : template.parameters[2].toString(); const rawPath = typeof template.parameters[2] === "string" ? template.parameters[2] : template.parameters[2].toString();
@ -465,13 +474,6 @@ async function getGame(pageTitle: string, cache: WikiGameCache): Promise<Game> {
try { try {
const [path, pathType] = parsePath(rawPath); const [path, pathType] = parsePath(rawPath);
if (pathType === PathType.FileSystem) { if (pathType === PathType.FileSystem) {
if (!game.files.hasOwnProperty(path)) {
game.files[path] = {
when: [],
tags: [],
};
}
let os: Os | undefined = undefined; let os: Os | undefined = undefined;
let store: Store | undefined = undefined; let store: Store | undefined = undefined;
if ((template.parameters[1] as string).match(/steam/i)) { if ((template.parameters[1] as string).match(/steam/i)) {
@ -480,6 +482,14 @@ async function getGame(pageTitle: string, cache: WikiGameCache): Promise<Game> {
os = parseOs(template.parameters[1]); os = parseOs(template.parameters[1]);
store = getStoreConstraintFromPath(rawPath); store = getStoreConstraintFromPath(rawPath);
} }
if (!game.files.hasOwnProperty(path)) {
game.files[path] = {
when: [],
tags: [],
};
}
if (!game.files[path].when.some(x => x.os === os && x.store === store)) { if (!game.files[path].when.some(x => x.os === os && x.store === store)) {
if (os !== undefined && store !== undefined) { if (os !== undefined && store !== undefined) {
game.files[path].when.push({ os, store }); game.files[path].when.push({ os, store });
@ -616,6 +626,7 @@ async function main() {
all: args.all ?? false, all: args.all ?? false,
existing: args.existing ?? false, existing: args.existing ?? false,
missing: args.missing ?? false, missing: args.missing ?? false,
unchecked: args.unchecked ?? false,
unsupportedOs: args.unsupportedOs ?? false, unsupportedOs: args.unsupportedOs ?? false,
unsupportedPath: args.unsupportedPath ?? false, unsupportedPath: args.unsupportedPath ?? false,
game: args.game, game: args.game,