diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-30 17:03:13 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-30 17:03:13 +0100 |
commit | 8c666c44ab3109ce2ad432bf2f98cc0505593543 (patch) | |
tree | 1dad1c4e56d22e1bccdde67998f8322255117050 /server/lib/job-queue/handlers/video-live-ending.ts | |
parent | a742b4b0e215f49928f7389d09de1023414fbeff (diff) | |
download | PeerTube-8c666c44ab3109ce2ad432bf2f98cc0505593543.tar.gz PeerTube-8c666c44ab3109ce2ad432bf2f98cc0505593543.tar.zst PeerTube-8c666c44ab3109ce2ad432bf2f98cc0505593543.zip |
Fix live saving after a server restart
Diffstat (limited to 'server/lib/job-queue/handlers/video-live-ending.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-live-ending.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 0d2bcaa28..6e1076d8f 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import * as Bull from 'bull' | 1 | import * as Bull from 'bull' |
2 | import { move, readdir, remove } from 'fs-extra' | 2 | import { copy, readdir, remove } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { hlsPlaylistToFragmentedMP4 } from '@server/helpers/ffmpeg-utils' | 4 | import { hlsPlaylistToFragmentedMP4 } from '@server/helpers/ffmpeg-utils' |
5 | import { getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils' | 5 | import { getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils' |
6 | import { VIDEO_LIVE } from '@server/initializers/constants' | ||
6 | import { generateVideoMiniature } from '@server/lib/thumbnail' | 7 | import { generateVideoMiniature } from '@server/lib/thumbnail' |
7 | import { publishAndFederateIfNeeded } from '@server/lib/video' | 8 | import { publishAndFederateIfNeeded } from '@server/lib/video' |
8 | import { getHLSDirectory } from '@server/lib/video-paths' | 9 | import { getHLSDirectory } from '@server/lib/video-paths' |
@@ -14,7 +15,6 @@ import { VideoStreamingPlaylistModel } from '@server/models/video/video-streamin | |||
14 | import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models' | 15 | import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models' |
15 | import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' | 16 | import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' |
16 | import { logger } from '../../../helpers/logger' | 17 | import { logger } from '../../../helpers/logger' |
17 | import { VIDEO_LIVE } from '@server/initializers/constants' | ||
18 | 18 | ||
19 | async function processVideoLiveEnding (job: Bull.Job) { | 19 | async function processVideoLiveEnding (job: Bull.Job) { |
20 | const payload = job.data as VideoLiveEndingPayload | 20 | const payload = job.data as VideoLiveEndingPayload |
@@ -61,11 +61,12 @@ async function saveLive (video: MVideo, live: MVideoLive) { | |||
61 | const playlistFiles: string[] = [] | 61 | const playlistFiles: string[] = [] |
62 | 62 | ||
63 | for (const file of rootFiles) { | 63 | for (const file of rootFiles) { |
64 | if (file.endsWith('.m3u8') !== true) continue | 64 | // Move remaining files in the replay directory |
65 | 65 | if (file.endsWith('.ts') || file.endsWith('.m3u8')) { | |
66 | await move(join(hlsDirectory, file), join(replayDirectory, file)) | 66 | await copy(join(hlsDirectory, file), join(replayDirectory, file)) |
67 | } | ||
67 | 68 | ||
68 | if (file !== 'master.m3u8') { | 69 | if (file.endsWith('.m3u8') && file !== 'master.m3u8') { |
69 | playlistFiles.push(file) | 70 | playlistFiles.push(file) |
70 | } | 71 | } |
71 | } | 72 | } |