diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-23 10:29:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-23 10:30:48 +0200 |
commit | 53023be33af420675d0060eb95c99a8038457564 (patch) | |
tree | 699a13694b0c1c8589d10de95184708a451fcab4 /server/lib/job-queue/handlers/video-live-ending.ts | |
parent | 50341c8fe988ca2a3d7c700f9aa918673dc979c2 (diff) | |
download | PeerTube-53023be33af420675d0060eb95c99a8038457564.tar.gz PeerTube-53023be33af420675d0060eb95c99a8038457564.tar.zst PeerTube-53023be33af420675d0060eb95c99a8038457564.zip |
Fix fast restream in saved permanent live
Diffstat (limited to 'server/lib/job-queue/handlers/video-live-ending.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-live-ending.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index feec257fc..450bda2fd 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts | |||
@@ -4,7 +4,7 @@ import { join } from 'path' | |||
4 | import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamDuration } from '@server/helpers/ffmpeg' | 4 | import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamDuration } from '@server/helpers/ffmpeg' |
5 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 5 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
6 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | 6 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' |
7 | import { cleanupNormalLive, cleanupPermanentLive, cleanupTMPLiveFiles, LiveSegmentShaStore } from '@server/lib/live' | 7 | import { cleanupUnsavedNormalLive, cleanupPermanentLive, cleanupTMPLiveFiles, LiveSegmentShaStore } from '@server/lib/live' |
8 | import { | 8 | import { |
9 | generateHLSMasterPlaylistFilename, | 9 | generateHLSMasterPlaylistFilename, |
10 | generateHlsSha256SegmentsFilename, | 10 | generateHlsSha256SegmentsFilename, |
@@ -22,15 +22,17 @@ import { VideoLiveSessionModel } from '@server/models/video/video-live-session' | |||
22 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | 22 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' |
23 | import { MVideo, MVideoLive, MVideoLiveSession, MVideoWithAllFiles } from '@server/types/models' | 23 | import { MVideo, MVideoLive, MVideoLiveSession, MVideoWithAllFiles } from '@server/types/models' |
24 | import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' | 24 | import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' |
25 | import { logger } from '../../../helpers/logger' | 25 | import { logger, loggerTagsFactory } from '../../../helpers/logger' |
26 | |||
27 | const lTags = loggerTagsFactory('live', 'job') | ||
26 | 28 | ||
27 | async function processVideoLiveEnding (job: Job) { | 29 | async function processVideoLiveEnding (job: Job) { |
28 | const payload = job.data as VideoLiveEndingPayload | 30 | const payload = job.data as VideoLiveEndingPayload |
29 | 31 | ||
30 | logger.info('Processing video live ending for %s.', payload.videoId, { payload }) | 32 | logger.info('Processing video live ending for %s.', payload.videoId, { payload, ...lTags() }) |
31 | 33 | ||
32 | function logError () { | 34 | function logError () { |
33 | logger.warn('Video live %d does not exist anymore. Cannot process live ending.', payload.videoId) | 35 | logger.warn('Video live %d does not exist anymore. Cannot process live ending.', payload.videoId, lTags()) |
34 | } | 36 | } |
35 | 37 | ||
36 | const liveVideo = await VideoModel.load(payload.videoId) | 38 | const liveVideo = await VideoModel.load(payload.videoId) |
@@ -73,8 +75,6 @@ async function saveReplayToExternalVideo (options: { | |||
73 | }) { | 75 | }) { |
74 | const { liveVideo, liveSession, publishedAt, replayDirectory } = options | 76 | const { liveVideo, liveSession, publishedAt, replayDirectory } = options |
75 | 77 | ||
76 | await cleanupTMPLiveFiles(getLiveDirectory(liveVideo)) | ||
77 | |||
78 | const video = new VideoModel({ | 78 | const video = new VideoModel({ |
79 | name: `${liveVideo.name} - ${new Date(publishedAt).toLocaleString()}`, | 79 | name: `${liveVideo.name} - ${new Date(publishedAt).toLocaleString()}`, |
80 | isLive: false, | 80 | isLive: false, |
@@ -243,7 +243,7 @@ async function cleanupLiveAndFederate (options: { | |||
243 | if (live.permanentLive) { | 243 | if (live.permanentLive) { |
244 | await cleanupPermanentLive(video, streamingPlaylist) | 244 | await cleanupPermanentLive(video, streamingPlaylist) |
245 | } else { | 245 | } else { |
246 | await cleanupNormalLive(video, streamingPlaylist) | 246 | await cleanupUnsavedNormalLive(video, streamingPlaylist) |
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||