chore(auto): task completed - unknown
This commit is contained in:
@@ -15,6 +15,7 @@ import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js"
|
|||||||
import {
|
import {
|
||||||
createRecordingSession,
|
createRecordingSession,
|
||||||
type RecordingSession,
|
type RecordingSession,
|
||||||
|
type SessionRecordingMetadata,
|
||||||
} from "./recorder/sessionRecording.js";
|
} from "./recorder/sessionRecording.js";
|
||||||
import { createSpeakingHandler } from "./recorder/speakingHandler.js";
|
import { createSpeakingHandler } from "./recorder/speakingHandler.js";
|
||||||
|
|
||||||
@@ -188,9 +189,11 @@ export function stopRecording(guildId: string): void {
|
|||||||
const session = activeSessions.get(guildId);
|
const session = activeSessions.get(guildId);
|
||||||
finalizeActiveRecordingSession(guildId);
|
finalizeActiveRecordingSession(guildId);
|
||||||
|
|
||||||
// Broadcast voice_recording_stopped event
|
// Broadcast voice_recording_stopped + finalize session
|
||||||
if (session && _eventBroadcaster) {
|
if (session && _eventBroadcaster) {
|
||||||
const snapshot = session.snapshot(Date.now());
|
const snapshot = session.snapshot(Date.now());
|
||||||
|
const stoppedAt = Date.now();
|
||||||
|
|
||||||
_eventBroadcaster.voiceRecordingStopped({
|
_eventBroadcaster.voiceRecordingStopped({
|
||||||
guild_id: guildId,
|
guild_id: guildId,
|
||||||
session_id: session.sessionId,
|
session_id: session.sessionId,
|
||||||
@@ -198,7 +201,22 @@ export function stopRecording(guildId: string): void {
|
|||||||
participants: snapshot.participants.length,
|
participants: snapshot.participants.length,
|
||||||
segment_count: snapshot.segments.length,
|
segment_count: snapshot.segments.length,
|
||||||
status: snapshot.status,
|
status: snapshot.status,
|
||||||
stopped_at: Date.now(),
|
stopped_at: stoppedAt,
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
|
// Auto-enqueue muxer job if there are multiple segments
|
||||||
|
const segments = snapshot.segments;
|
||||||
|
if (segments.length >= 2) {
|
||||||
|
const outputFile = `${config.RECORDINGS_DIR}/merged/${session.sessionId}.ogg`;
|
||||||
|
import("./muxer.js").then(({ enqueueMuxerJob }) => {
|
||||||
|
enqueueMuxerJob({
|
||||||
|
inputs: segments.map((s) => s.oggPath),
|
||||||
|
output: outputFile,
|
||||||
|
guildId,
|
||||||
|
channelId: snapshot.channelId,
|
||||||
|
sessionId: session.sessionId,
|
||||||
|
}).catch(() => {});
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user