diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-03 09:38:24 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-12-03 10:05:10 +0100 |
commit | 4a54a93941d1c095bf249331df799c51e39c3774 (patch) | |
tree | 3a2b2958bf6f845e375790818ec475a1cb2dc23c /server/lib/job-queue | |
parent | 09c55770bcc96785fb1f199b4cd8ce66b545486a (diff) | |
download | PeerTube-4a54a93941d1c095bf249331df799c51e39c3774.tar.gz PeerTube-4a54a93941d1c095bf249331df799c51e39c3774.tar.zst PeerTube-4a54a93941d1c095bf249331df799c51e39c3774.zip |
Fix live invalid save replay duration
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/video-live-ending.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 55bee0b83..d3c84ce75 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts | |||
@@ -89,7 +89,7 @@ async function saveLive (video: MVideo, live: MVideoLive) { | |||
89 | hlsPlaylist.VideoFiles = [] | 89 | hlsPlaylist.VideoFiles = [] |
90 | 90 | ||
91 | const replayFiles = await readdir(replayDirectory) | 91 | const replayFiles = await readdir(replayDirectory) |
92 | let duration: number | 92 | let durationDone: boolean |
93 | 93 | ||
94 | for (const playlistFile of playlistFiles) { | 94 | for (const playlistFile of playlistFiles) { |
95 | const playlistPath = join(replayDirectory, playlistFile) | 95 | const playlistPath = join(replayDirectory, playlistFile) |
@@ -109,9 +109,11 @@ async function saveLive (video: MVideo, live: MVideoLive) { | |||
109 | isPortraitMode | 109 | isPortraitMode |
110 | }) | 110 | }) |
111 | 111 | ||
112 | if (!duration) { | 112 | if (!durationDone) { |
113 | videoWithFiles.duration = await getDurationFromVideoFile(outputPath) | 113 | videoWithFiles.duration = await getDurationFromVideoFile(outputPath) |
114 | await videoWithFiles.save() | 114 | await videoWithFiles.save() |
115 | |||
116 | durationDone = true | ||
115 | } | 117 | } |
116 | } | 118 | } |
117 | 119 | ||
@@ -126,7 +128,7 @@ async function saveLive (video: MVideo, live: MVideoLive) { | |||
126 | await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.PREVIEW) | 128 | await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.PREVIEW) |
127 | } | 129 | } |
128 | 130 | ||
129 | await publishAndFederateIfNeeded(video, true) | 131 | await publishAndFederateIfNeeded(videoWithFiles, true) |
130 | } | 132 | } |
131 | 133 | ||
132 | async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) { | 134 | async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) { |