]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix HLS generation after import script
authorChocobozzz <me@florianbigard.com>
Tue, 2 Feb 2021 13:00:46 +0000 (14:00 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 2 Feb 2021 13:00:46 +0000 (14:00 +0100)
server/lib/job-queue/handlers/video-file-import.ts
server/lib/job-queue/handlers/video-transcoding.ts
server/lib/video-transcoding.ts

index 582efea3a87df2a30fc9ac660c544d0227fbe022..cd95aa07561846511c4a292398fbc8fc1ef8c256 100644 (file)
@@ -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
 }
index 853cfebcdf5c69b1bc980c85798d51e63e5ab33a..4718a7d5c456fb8945eab9205b9415bc99647429 100644 (file)
@@ -189,7 +189,7 @@ async function onVideoFileOptimizer (
 async function onNewWebTorrentFileResolution (
   video: MVideoUUID,
   user: MUserId,
-  payload?: NewResolutionTranscodingPayload | MergeAudioTranscodingPayload
+  payload: NewResolutionTranscodingPayload | MergeAudioTranscodingPayload
 ) {
   await publishAndFederateIfNeeded(video)
 
index d32372fe5487c768aae30554dbe825ba09092d47..88a6e0673abb94415d589805d61b058a65b16817 100644 (file)
@@ -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)