Prevent error when live doesn't have replay files

pull/6135/head
Chocobozzz 2024-01-03 15:06:24 +01:00
parent d7804627c2
commit cfcbfb668e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 0 deletions

View File

@ -60,6 +60,12 @@ async function processVideoLiveEnding (job: Job) {
return cleanupLiveAndFederate({ permanentLive, video, streamingPlaylistId: payload.streamingPlaylistId }) 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) { if (permanentLive) {
await saveReplayToExternalVideo({ await saveReplayToExternalVideo({
liveVideo: video, liveVideo: video,
@ -310,3 +316,7 @@ function createStoryboardJob (video: MVideo) {
} }
}) })
} }
async function hasReplayFiles (replayDirectory: string) {
return (await readdir(replayDirectory)).length !== 0
}