#10: Add mechanism to omit games from manifest
This commit is contained in:
parent
09e8b28ab2
commit
a442599a94
5 changed files with 31 additions and 12 deletions
5
data/manifest-override.yaml
Normal file
5
data/manifest-override.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Overwatch:
|
||||||
|
# The game is no longer playable at all,
|
||||||
|
# and its save locations are identical to Overwatch 2,
|
||||||
|
# leading to duplicate backups.
|
||||||
|
omit: true
|
|
@ -352911,13 +352911,6 @@ Overview:
|
||||||
OVERVIEW: {}
|
OVERVIEW: {}
|
||||||
steam:
|
steam:
|
||||||
id: 751110
|
id: 751110
|
||||||
Overwatch:
|
|
||||||
files:
|
|
||||||
<winDocuments>/Overwatch/Settings/Settings_v0.ini:
|
|
||||||
tags:
|
|
||||||
- config
|
|
||||||
when:
|
|
||||||
- os: windows
|
|
||||||
Overwatch 2:
|
Overwatch 2:
|
||||||
files:
|
files:
|
||||||
<winDocuments>/Overwatch/Settings/Settings_v0.ini:
|
<winDocuments>/Overwatch/Settings/Settings_v0.ini:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import minimist from "minimist";
|
import minimist from "minimist";
|
||||||
|
|
||||||
import { DEFAULT_GAME_LIMIT } from ".";
|
import { DEFAULT_GAME_LIMIT } from ".";
|
||||||
import { ManifestFile } from "./manifest";
|
import { ManifestFile, ManifestOverrideFile } from "./manifest";
|
||||||
import { SteamGameCacheFile, getSteamClient } from "./steam";
|
import { SteamGameCacheFile, getSteamClient } from "./steam";
|
||||||
import { WikiGameCacheFile, WikiMetaCacheFile } from "./wiki";
|
import { WikiGameCacheFile, WikiMetaCacheFile } from "./wiki";
|
||||||
import { saveMissingGames } from "./missing";
|
import { saveMissingGames } from "./missing";
|
||||||
|
@ -44,6 +44,8 @@ async function main() {
|
||||||
steamCache.load();
|
steamCache.load();
|
||||||
const manifest = new ManifestFile();
|
const manifest = new ManifestFile();
|
||||||
manifest.load();
|
manifest.load();
|
||||||
|
const manifestOverride = new ManifestOverrideFile();
|
||||||
|
manifestOverride.load();
|
||||||
|
|
||||||
if (args.stats) {
|
if (args.stats) {
|
||||||
console.log(`Total games in manifest: ${Object.keys(manifest.data).length}`);
|
console.log(`Total games in manifest: ${Object.keys(manifest.data).length}`);
|
||||||
|
@ -109,6 +111,7 @@ async function main() {
|
||||||
wikiCache.data,
|
wikiCache.data,
|
||||||
args._ ?? [],
|
args._ ?? [],
|
||||||
steamCache,
|
steamCache,
|
||||||
|
manifestOverride,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +119,7 @@ async function main() {
|
||||||
wikiMetaCache.save();
|
wikiMetaCache.save();
|
||||||
steamCache.save();
|
steamCache.save();
|
||||||
manifest.save();
|
manifest.save();
|
||||||
saveMissingGames(wikiCache.data, manifest.data);
|
saveMissingGames(wikiCache.data, manifest.data, manifestOverride.data);
|
||||||
if (steamCache.steamClient) {
|
if (steamCache.steamClient) {
|
||||||
steamCache.steamClient.logOff();
|
steamCache.steamClient.logOff();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +129,7 @@ async function main() {
|
||||||
wikiMetaCache.save();
|
wikiMetaCache.save();
|
||||||
steamCache.save();
|
steamCache.save();
|
||||||
manifest.save();
|
manifest.save();
|
||||||
saveMissingGames(wikiCache.data, manifest.data);
|
saveMissingGames(wikiCache.data, manifest.data, manifestOverride.data);
|
||||||
if (steamCache.steamClient) {
|
if (steamCache.steamClient) {
|
||||||
steamCache.steamClient.logOff();
|
steamCache.steamClient.logOff();
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,10 +175,16 @@ export class ManifestFile extends YamlFile<Manifest> {
|
||||||
wikiCache: WikiGameCache,
|
wikiCache: WikiGameCache,
|
||||||
games: Array<string>,
|
games: Array<string>,
|
||||||
steamCache: SteamGameCacheFile,
|
steamCache: SteamGameCacheFile,
|
||||||
|
override: ManifestOverrideFile,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
|
||||||
for (const [title, info] of Object.entries(wikiCache).sort()) {
|
for (const [title, info] of Object.entries(wikiCache).sort()) {
|
||||||
|
const overridden = override.data[title];
|
||||||
|
if (overridden?.omit) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (games?.length > 0 && !games.includes(title)) {
|
if (games?.length > 0 && !games.includes(title)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -197,3 +203,14 @@ export class ManifestFile extends YamlFile<Manifest> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ManifestOverride {
|
||||||
|
[game: string]: {
|
||||||
|
omit?: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ManifestOverrideFile extends YamlFile<ManifestOverride> {
|
||||||
|
path = `${REPO}/data/manifest-override.yaml`;
|
||||||
|
defaultData = {};
|
||||||
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { REPO } from ".";
|
import { REPO } from ".";
|
||||||
import { Manifest } from "./manifest";
|
import { Manifest, ManifestOverride } from "./manifest";
|
||||||
import { WikiGameCache } from "./wiki";
|
import { WikiGameCache } from "./wiki";
|
||||||
|
|
||||||
export function saveMissingGames(cache: WikiGameCache, manifest: Manifest): void {
|
export function saveMissingGames(cache: WikiGameCache, manifest: Manifest, override: ManifestOverride): void {
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
`${REPO}/data/missing.md`,
|
`${REPO}/data/missing.md`,
|
||||||
Object.entries(cache)
|
Object.entries(cache)
|
||||||
.sort((x, y) => x[0].localeCompare(y[0]))
|
.sort((x, y) => x[0].localeCompare(y[0]))
|
||||||
.filter(([k, _]) => (manifest[k]?.files ?? []).length === 0 && (manifest[k]?.registry ?? []).length === 0)
|
.filter(([k, _]) => (manifest[k]?.files ?? []).length === 0 && (manifest[k]?.registry ?? []).length === 0)
|
||||||
|
.filter(([k, _]) => override[k]?.omit !== true)
|
||||||
.map(([k, v]) => `* [${k}](https://www.pcgamingwiki.com/wiki/?curid=${v.pageId})`)
|
.map(([k, v]) => `* [${k}](https://www.pcgamingwiki.com/wiki/?curid=${v.pageId})`)
|
||||||
.join("\n") + "\n",
|
.join("\n") + "\n",
|
||||||
);
|
);
|
||||||
|
|
Reference in a new issue