From: Chocobozzz Date: Tue, 2 Feb 2021 13:00:46 +0000 (+0100) Subject: Fix HLS generation after import script X-Git-Tag: v3.1.0-rc.1~190 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=69eddafb17c4cf8e5a6dbd19e6d216c58140d153;p=github%2FChocobozzz%2FPeerTube.git Fix HLS generation after import script --- diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index 582efea3a..cd95aa075 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts @@ -23,10 +23,21 @@ async function processVideoFileImport (job: Bull.Job) { return undefined } + const data = await getVideoFileResolution(payload.filePath) + await updateVideoFile(video, payload.filePath) const user = await UserModel.loadByChannelActorId(video.VideoChannel.actorId) - await onNewWebTorrentFileResolution(video, user) + + const newResolutionPayload = { + type: 'new-resolution-to-webtorrent' as 'new-resolution-to-webtorrent', + videoUUID: video.uuid, + resolution: data.videoFileResolution, + isPortraitMode: data.isPortraitMode, + copyCodecs: false, + isNewVideo: false + } + await onNewWebTorrentFileResolution(video, user, newResolutionPayload) return video } diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 853cfebcd..4718a7d5c 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts @@ -189,7 +189,7 @@ async function onVideoFileOptimizer ( async function onNewWebTorrentFileResolution ( video: MVideoUUID, user: MUserId, - payload?: NewResolutionTranscodingPayload | MergeAudioTranscodingPayload + payload: NewResolutionTranscodingPayload | MergeAudioTranscodingPayload ) { await publishAndFederateIfNeeded(video) diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index d32372fe5..88a6e0673 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts @@ -334,9 +334,9 @@ async function generateHlsPlaylistCommon (options: { // Move playlist file const playlistPath = join(baseHlsDirectory, playlistFilename) - await move(playlistFileTranscodePath, playlistPath) + await move(playlistFileTranscodePath, playlistPath, { overwrite: true }) // Move video file - await move(join(videoTranscodedBasePath, videoFilename), videoFilePath) + await move(join(videoTranscodedBasePath, videoFilename), videoFilePath, { overwrite: true }) // Cleanup directory await remove(videoTranscodedBasePath)