]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/index.ts
Add ability to manually run transcoding job
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / index.ts
index c07430e6c85589a1c71de45f4d05853dbc63f3bb..7f5e74626e401714667d6be9c53d702e04116250 100644 (file)
@@ -244,7 +244,7 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi
 
     video.VideoFiles = [ videoFile ]
 
-    if (videoInfo.tags) {
+    if (videoInfo.tags !== undefined) {
       const tagInstances = await TagModel.findOrCreateTags(videoInfo.tags, t)
 
       await video.$set('Tags', tagInstances, sequelizeOptions)
@@ -267,7 +267,8 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi
   if (CONFIG.TRANSCODING.ENABLED === true) {
     // Put uuid because we don't have id auto incremented for now
     const dataInput = {
-      videoUUID: videoCreated.uuid
+      videoUUID: videoCreated.uuid,
+      isNewVideo: true
     }
 
     await JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput })
@@ -332,7 +333,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
       const videoInstanceUpdated = await videoInstance.save(sequelizeOptions)
 
       // Video tags update?
-      if (videoInfoToUpdate.tags) {
+      if (videoInfoToUpdate.tags !== undefined) {
         const tagInstances = await TagModel.findOrCreateTags(videoInfoToUpdate.tags, t)
 
         await videoInstanceUpdated.$set('Tags', tagInstances, sequelizeOptions)
@@ -341,7 +342,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
 
       // Video channel update?
       if (res.locals.videoChannel && videoInstanceUpdated.channelId !== res.locals.videoChannel.id) {
-        await videoInstanceUpdated.$set('VideoChannel', res.locals.videoChannel)
+        await videoInstanceUpdated.$set('VideoChannel', res.locals.videoChannel, { transaction: t })
         videoInstance.VideoChannel = res.locals.videoChannel
 
         if (wasPrivateVideo === false) await changeVideoChannelShare(videoInstanceUpdated, oldVideoChannel, t)