Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/cli/commands/video-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { isValidRecordingOutput } from 'csdm/common/types/recording-output';
import type { VideoContainer } from 'csdm/common/types/video-container';
import { isValidVideoContainer } from 'csdm/common/types/video-container';
import { InvalidArgument } from 'csdm/cli/errors/invalid-argument';
import { fetchPlayer } from 'csdm/node/database/player/fetch-player';
import { isHlaeInstalled } from 'csdm/node/video/hlae/is-hlae-installed';
import { installHlae } from 'csdm/node/video/hlae/install-hlae';
import { isVirtualDubInstalled } from 'csdm/node/video/virtual-dub/is-virtual-dub-installed';
Expand Down Expand Up @@ -52,6 +53,7 @@ export class VideoCommand extends Command {
private readonly noPlayerVoicesFlag = 'no-player-voices';
private readonly deathNoticesDurationFlag = 'death-notices-duration';
private readonly cfgFlag = 'cfg';
private readonly focusPlayerFlag = 'focus-player';
private outputFolderPath: string | undefined;
private demoPath: string = '';
private startTick: number = 0;
Expand All @@ -76,6 +78,7 @@ export class VideoCommand extends Command {
private playerVoices: boolean | undefined;
private deathNoticesDuration: number | undefined;
private cfg: string | undefined;
private focusPlayerSteamId: string | undefined;

public getDescription() {
return 'Generate videos from demos.';
Expand Down Expand Up @@ -114,6 +117,7 @@ export class VideoCommand extends Command {
console.log(` --${this.noPlayerVoicesFlag}`);
console.log(` --${this.deathNoticesDurationFlag} <number>`);
console.log(` --${this.cfgFlag} <string>`);
console.log(` --${this.focusPlayerFlag} <steamId>`);
}

public async run() {
Expand All @@ -138,6 +142,15 @@ export class VideoCommand extends Command {
cfg: this.cfg,
};

if (this.focusPlayerSteamId) {
const player = await fetchPlayer(this.focusPlayerSteamId);
sequence.cameras.push({
tick: this.startTick,
playerSteamId: this.focusPlayerSteamId,
playerName: player.name,
});
}

const recordingSystem = this.recordingSystem ?? settings.video.recordingSystem;
if (recordingSystem === RecordingSystem.HLAE && !(await isHlaeInstalled())) {
console.log('Installing HLAE...');
Expand Down Expand Up @@ -245,6 +258,7 @@ export class VideoCommand extends Command {
[this.noPlayerVoicesFlag]: { type: 'boolean' },
[this.deathNoticesDurationFlag]: { type: 'string' },
[this.cfgFlag]: { type: 'string' },
[this.focusPlayerFlag]: { type: 'string' },
},
allowPositionals: true,
args: this.args,
Expand Down Expand Up @@ -439,5 +453,8 @@ export class VideoCommand extends Command {
if (values[this.cfgFlag]) {
this.cfg = values[this.cfgFlag];
}
if (values[this.focusPlayerFlag]) {
this.focusPlayerSteamId = values[this.focusPlayerFlag] as string;
}
}
}