Compare commits

..

No commits in common. "72c3b7c9d31dfe455708f81519b41e2a035c08ee" and "cc348653d6c19e48b0f8b09369c8ae19201bfcf7" have entirely different histories.

3 changed files with 3 additions and 31 deletions

View File

@ -4,7 +4,7 @@ import { flags } from "./deps.ts";
const parseArgs = (args: string[]) => {
const parsed = flags.parse(args, {
string: ["profilePath", "exporter", "skipMode", "listMethod", "nxapiPresenceUrl"],
string: ["profilePath", "exporter", "skipMode", "listMethod"],
boolean: ["help", "noProgress", "monitor", "withSummary"],
alias: {
"help": "h",
@ -15,7 +15,6 @@ const parseArgs = (args: string[]) => {
"skipMode": ["s", "skip-mode"],
"withSummary": "with-summary",
"listMethod": "list-method",
"nxapiPresenceUrl": ["nxapi-presence-url", "nxapi-presence"]
},
});
return parsed;
@ -40,8 +39,7 @@ Options:
--skip-mode <mode>, -s Skip mode (default: null)
("vs", "coop")
--with-summary Include summary in the output
--help Show this help message and exit
--nxapi-presence-url Extends monitoring mode to use Nintendo Switch presence from nxapi`,
--help Show this help message and exit`,
);
Deno.exit(0);
}

View File

@ -9,7 +9,6 @@ import { FileExporter } from "./exporters/file.ts";
import { delay, showError } from "./utils.ts";
import { GameFetcher } from "./GameFetcher.ts";
import { DEFAULT_ENV, Env } from "./env.ts";
import { SPLATOON3_TITLE_ID } from "./constant.ts";
export type Opts = {
profilePath: string;
@ -22,7 +21,6 @@ export type Opts = {
cache?: Cache;
stateBackend?: StateBackend;
env: Env;
nxapiPresenceUrl?: string;
};
export const DEFAULT_OPTS: Opts = {
@ -164,7 +162,6 @@ function progress({ total, currentUrl, done }: StepProgress): Progress {
export class App {
profile: Profile;
env: Env;
splatoon3PreviouslyActive = false;
constructor(public opts: Opts) {
const stateBackend = opts.stateBackend ??
@ -398,25 +395,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() {
while (true) {
await this.exportOnce();
@ -454,9 +432,7 @@ export class App {
});
}
if (this.opts.nxapiPresenceUrl) {
await this.monitorWithNxapi();
} else if (this.opts.monitor) {
if (this.opts.monitor) {
await this.monitor();
} else {
await this.exportOnce();

View File

@ -116,5 +116,3 @@ export const SPLATNET3_STATINK_MAP: {
2: "high",
},
};
export const SPLATOON3_TITLE_ID = "0100c2500fc20000";