Fix irregular Steam entries thanks to steam-user library update

This commit is contained in:
mtkennerly 2023-06-23 01:31:35 +08:00
parent 307fc3470c
commit 06265bff9d
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
4 changed files with 10994 additions and 306 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,7 @@ interface Cli {
stats?: boolean,
duplicates?: boolean,
all?: boolean,
irregular?: boolean,
irregularPathUntagged?: boolean,
skipUntil?: string,
recent?: boolean,
@ -27,6 +28,7 @@ async function main() {
"manifest",
"stats",
"all",
"irregular",
"irregularPathUntagged",
"steam",
"missing",
@ -101,6 +103,7 @@ async function main() {
if (args.steam) {
await steamCache.refresh(
args.skipUntil,
args.irregular ?? false,
args.irregularPathUntagged ?? false,
args.limit ?? DEFAULT_GAME_LIMIT,
);

View file

@ -62,12 +62,7 @@ export class SteamGameCacheFile extends YamlFile<SteamGameCache> {
const installDir = info.apps[key].appinfo.config?.installdir;
if (installDir !== undefined) {
if (!this.isIrregularString(installDir)) {
// Avoid: https://github.com/DoctorMcKay/node-steam-user/issues/397
this.data[key].installDir = installDir;
} else {
this.data[key].irregular = true;
}
this.data[key].installDir = installDir;
}
const nameLocalized = info.apps[key].appinfo.common?.name_localized;
@ -79,18 +74,13 @@ export class SteamGameCacheFile extends YamlFile<SteamGameCache> {
if (launch !== undefined) {
const keys = Object.keys(launch).sort((x, y) => parseInt(x) - parseInt(y));
const launchArray = keys.map(x => launch[x]);
if (launchArray.every(x => !this.hasIrregularKeys(x))) {
// Avoid: https://github.com/DoctorMcKay/node-steam-user/issues/397
this.data[key].launch = launchArray;
} else {
this.data[key].irregular = true;
}
this.data[key].launch = launchArray;
}
return this.data[key];
}
async refresh(skipUntil: string | undefined, irregularUntagged: boolean, limit: number): Promise<void> {
async refresh(skipUntil: string | undefined, irregularTagged: boolean, irregularUntagged: boolean, limit: number): Promise<void> {
let i = 0;
let foundSkipUntil = false;
for (const appId of Object.keys(this.data).sort()) {
@ -102,6 +92,12 @@ export class SteamGameCacheFile extends YamlFile<SteamGameCache> {
}
}
if (irregularTagged) {
if (!this.data[appId].irregular) {
continue;
}
}
if (irregularUntagged) {
const irregular = (this.data[appId].launch ?? []).some(x => this.hasIrregularKeys(x)) ||
this.isIrregularString(this.data[appId].installDir ?? "");