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, stats?: boolean,
duplicates?: boolean, duplicates?: boolean,
all?: boolean, all?: boolean,
irregular?: boolean,
irregularPathUntagged?: boolean, irregularPathUntagged?: boolean,
skipUntil?: string, skipUntil?: string,
recent?: boolean, recent?: boolean,
@ -27,6 +28,7 @@ async function main() {
"manifest", "manifest",
"stats", "stats",
"all", "all",
"irregular",
"irregularPathUntagged", "irregularPathUntagged",
"steam", "steam",
"missing", "missing",
@ -101,6 +103,7 @@ async function main() {
if (args.steam) { if (args.steam) {
await steamCache.refresh( await steamCache.refresh(
args.skipUntil, args.skipUntil,
args.irregular ?? false,
args.irregularPathUntagged ?? false, args.irregularPathUntagged ?? false,
args.limit ?? DEFAULT_GAME_LIMIT, 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; const installDir = info.apps[key].appinfo.config?.installdir;
if (installDir !== undefined) { if (installDir !== undefined) {
if (!this.isIrregularString(installDir)) { this.data[key].installDir = installDir;
// Avoid: https://github.com/DoctorMcKay/node-steam-user/issues/397
this.data[key].installDir = installDir;
} else {
this.data[key].irregular = true;
}
} }
const nameLocalized = info.apps[key].appinfo.common?.name_localized; const nameLocalized = info.apps[key].appinfo.common?.name_localized;
@ -79,18 +74,13 @@ export class SteamGameCacheFile extends YamlFile<SteamGameCache> {
if (launch !== undefined) { if (launch !== undefined) {
const keys = Object.keys(launch).sort((x, y) => parseInt(x) - parseInt(y)); const keys = Object.keys(launch).sort((x, y) => parseInt(x) - parseInt(y));
const launchArray = keys.map(x => launch[x]); const launchArray = keys.map(x => launch[x]);
if (launchArray.every(x => !this.hasIrregularKeys(x))) { this.data[key].launch = launchArray;
// Avoid: https://github.com/DoctorMcKay/node-steam-user/issues/397
this.data[key].launch = launchArray;
} else {
this.data[key].irregular = true;
}
} }
return this.data[key]; 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 i = 0;
let foundSkipUntil = false; let foundSkipUntil = false;
for (const appId of Object.keys(this.data).sort()) { 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) { if (irregularUntagged) {
const irregular = (this.data[appId].launch ?? []).some(x => this.hasIrregularKeys(x)) || const irregular = (this.data[appId].launch ?? []).some(x => this.hasIrregularKeys(x)) ||
this.isIrregularString(this.data[appId].installDir ?? ""); this.isIrregularString(this.data[appId].installDir ?? "");