Compare commits
No commits in common. "7d6b71d75265a31637c89bc0de283fe8b5f8099f" and "94fb731fe01d4c7060c6b9b683b52ff724a1bcd1" have entirely different histories.
7d6b71d752
...
94fb731fe0
|
|
@ -30,7 +30,6 @@ Options:
|
||||||
("vs", "coop")
|
("vs", "coop")
|
||||||
--with-summary Include summary in the output
|
--with-summary Include summary in the output
|
||||||
--help Show this help message and exit
|
--help Show this help message and exit
|
||||||
--nxapi-presence Extends monitoring mode to use Nintendo Switch presence from nxapi
|
|
||||||
```
|
```
|
||||||
|
|
||||||
3. If it's your first time running this, follow the instructions to login to
|
3. If it's your first time running this, follow the instructions to login to
|
||||||
|
|
|
||||||
12
s3si.ts
12
s3si.ts
|
|
@ -4,13 +4,7 @@ import { flags } from "./deps.ts";
|
||||||
|
|
||||||
const parseArgs = (args: string[]) => {
|
const parseArgs = (args: string[]) => {
|
||||||
const parsed = flags.parse(args, {
|
const parsed = flags.parse(args, {
|
||||||
string: [
|
string: ["profilePath", "exporter", "skipMode", "listMethod"],
|
||||||
"profilePath",
|
|
||||||
"exporter",
|
|
||||||
"skipMode",
|
|
||||||
"listMethod",
|
|
||||||
"nxapiPresenceUrl",
|
|
||||||
],
|
|
||||||
boolean: ["help", "noProgress", "monitor", "withSummary"],
|
boolean: ["help", "noProgress", "monitor", "withSummary"],
|
||||||
alias: {
|
alias: {
|
||||||
"help": "h",
|
"help": "h",
|
||||||
|
|
@ -21,7 +15,6 @@ const parseArgs = (args: string[]) => {
|
||||||
"skipMode": ["s", "skip-mode"],
|
"skipMode": ["s", "skip-mode"],
|
||||||
"withSummary": "with-summary",
|
"withSummary": "with-summary",
|
||||||
"listMethod": "list-method",
|
"listMethod": "list-method",
|
||||||
"nxapiPresenceUrl": ["nxapi-presence"],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return parsed;
|
return parsed;
|
||||||
|
|
@ -46,8 +39,7 @@ Options:
|
||||||
--skip-mode <mode>, -s Skip mode (default: null)
|
--skip-mode <mode>, -s Skip mode (default: null)
|
||||||
("vs", "coop")
|
("vs", "coop")
|
||||||
--with-summary Include summary in the output
|
--with-summary Include summary in the output
|
||||||
--help Show this help message and exit
|
--help Show this help message and exit`,
|
||||||
--nxapi-presence Extends monitoring mode to use Nintendo Switch presence from nxapi`,
|
|
||||||
);
|
);
|
||||||
Deno.exit(0);
|
Deno.exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
src/app.ts
31
src/app.ts
|
|
@ -10,7 +10,6 @@ import { delay, showError } from "./utils.ts";
|
||||||
import { GameFetcher } from "./GameFetcher.ts";
|
import { GameFetcher } from "./GameFetcher.ts";
|
||||||
import { DEFAULT_ENV, Env } from "./env.ts";
|
import { DEFAULT_ENV, Env } from "./env.ts";
|
||||||
import { SplashcatExporter } from "./exporters/splashcat.ts";
|
import { SplashcatExporter } from "./exporters/splashcat.ts";
|
||||||
import { SPLATOON3_TITLE_ID } from "./constant.ts";
|
|
||||||
|
|
||||||
export type Opts = {
|
export type Opts = {
|
||||||
profilePath: string;
|
profilePath: string;
|
||||||
|
|
@ -23,7 +22,6 @@ export type Opts = {
|
||||||
cache?: Cache;
|
cache?: Cache;
|
||||||
stateBackend?: StateBackend;
|
stateBackend?: StateBackend;
|
||||||
env: Env;
|
env: Env;
|
||||||
nxapiPresenceUrl?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_OPTS: Opts = {
|
export const DEFAULT_OPTS: Opts = {
|
||||||
|
|
@ -165,7 +163,6 @@ function progress({ total, currentUrl, done }: StepProgress): Progress {
|
||||||
export class App {
|
export class App {
|
||||||
profile: Profile;
|
profile: Profile;
|
||||||
env: Env;
|
env: Env;
|
||||||
splatoon3PreviouslyActive = false;
|
|
||||||
|
|
||||||
constructor(public opts: Opts) {
|
constructor(public opts: Opts) {
|
||||||
const stateBackend = opts.stateBackend ??
|
const stateBackend = opts.stateBackend ??
|
||||||
|
|
@ -422,30 +419,6 @@ export class App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async monitorWithNxapi() {
|
|
||||||
this.env.logger.debug("Monitoring with nxapi presence");
|
|
||||||
await this.exportOnce();
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
await this.countDown(this.profile.state.monitorInterval);
|
|
||||||
const nxapiResponse = await fetch(this.opts.nxapiPresenceUrl!);
|
|
||||||
const nxapiData = await nxapiResponse.json();
|
|
||||||
const isSplatoon3Active = nxapiData.title?.id === SPLATOON3_TITLE_ID;
|
|
||||||
if (isSplatoon3Active || this.splatoon3PreviouslyActive) {
|
|
||||||
this.env.logger.log("Splatoon 3 is active, exporting data");
|
|
||||||
await this.exportOnce();
|
|
||||||
}
|
|
||||||
if (isSplatoon3Active !== this.splatoon3PreviouslyActive) {
|
|
||||||
this.env.logger.debug(
|
|
||||||
"Splatoon 3 status has changed from",
|
|
||||||
this.splatoon3PreviouslyActive,
|
|
||||||
"to",
|
|
||||||
isSplatoon3Active,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.splatoon3PreviouslyActive = isSplatoon3Active;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async monitor() {
|
async monitor() {
|
||||||
while (true) {
|
while (true) {
|
||||||
await this.exportOnce();
|
await this.exportOnce();
|
||||||
|
|
@ -483,9 +456,7 @@ export class App {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.opts.nxapiPresenceUrl) {
|
if (this.opts.monitor) {
|
||||||
await this.monitorWithNxapi();
|
|
||||||
} else if (this.opts.monitor) {
|
|
||||||
await this.monitor();
|
await this.monitor();
|
||||||
} else {
|
} else {
|
||||||
await this.exportOnce();
|
await this.exportOnce();
|
||||||
|
|
|
||||||
|
|
@ -116,5 +116,3 @@ export const SPLATNET3_STATINK_MAP: {
|
||||||
2: "high",
|
2: "high",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SPLATOON3_TITLE_ID = "0100c2500fc20000";
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue