From cfcbfb668ec6add622ae55d5c6fd88c930fc22df Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Jan 2024 15:06:24 +0100 Subject: [PATCH] Prevent error when live doesn't have replay files --- .../core/lib/job-queue/handlers/video-live-ending.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/core/lib/job-queue/handlers/video-live-ending.ts b/server/core/lib/job-queue/handlers/video-live-ending.ts index 1837f9d33..6012ac127 100644 --- a/server/core/lib/job-queue/handlers/video-live-ending.ts +++ b/server/core/lib/job-queue/handlers/video-live-ending.ts @@ -60,6 +60,12 @@ async function processVideoLiveEnding (job: Job) { return cleanupLiveAndFederate({ permanentLive, video, streamingPlaylistId: payload.streamingPlaylistId }) } + if (await hasReplayFiles(payload.replayDirectory) !== true) { + logger.info(`No replay files found for live ${video.uuid}, skipping video replay creation.`, { ...lTags(video.uuid) }) + + return cleanupLiveAndFederate({ permanentLive, video, streamingPlaylistId: payload.streamingPlaylistId }) + } + if (permanentLive) { await saveReplayToExternalVideo({ liveVideo: video, @@ -310,3 +316,7 @@ function createStoryboardJob (video: MVideo) { } }) } + +async function hasReplayFiles (replayDirectory: string) { + return (await readdir(replayDirectory)).length !== 0 +}