aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/v1
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-06 14:44:09 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-06 14:44:09 +0200
commit0ae6a09d40fd30c86a2e0bd953830020c56045cd (patch)
tree286fbbc6036cecead1219cd22cdd51d3e2d042a5 /server/controllers/api/v1
parentae852eaf2da4dc88b638c79b8bbb07b91faf7dc7 (diff)
downloadPeerTube-0ae6a09d40fd30c86a2e0bd953830020c56045cd.tar.gz
PeerTube-0ae6a09d40fd30c86a2e0bd953830020c56045cd.tar.zst
PeerTube-0ae6a09d40fd30c86a2e0bd953830020c56045cd.zip
Move video duration logic in lib/
Diffstat (limited to 'server/controllers/api/v1')
-rw-r--r--server/controllers/api/v1/videos.js5
1 files changed, 1 insertions, 4 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index e69628961..7fdc50e52 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -3,7 +3,6 @@
3const config = require('config') 3const config = require('config')
4const crypto = require('crypto') 4const crypto = require('crypto')
5const express = require('express') 5const express = require('express')
6const ffmpeg = require('fluent-ffmpeg')
7const multer = require('multer') 6const multer = require('multer')
8 7
9const logger = require('../../../helpers/logger') 8const logger = require('../../../helpers/logger')
@@ -61,15 +60,13 @@ function addVideo (req, res, next) {
61 return next(err) 60 return next(err)
62 } 61 }
63 62
64 ffmpeg.ffprobe(video_file.path, function (err, metadata) { 63 videos.getVideoDuration(video_file.path, function (err, duration) {
65 if (err) { 64 if (err) {
66 // TODO: unseed the video 65 // TODO: unseed the video
67 logger.error('Cannot retrieve metadata of the file') 66 logger.error('Cannot retrieve metadata of the file')
68 return next(err) 67 return next(err)
69 } 68 }
70 69
71 const duration = Math.floor(metadata.format.duration)
72
73 const video_data = { 70 const video_data = {
74 name: video_infos.name, 71 name: video_infos.name,
75 namePath: video_file.filename, 72 namePath: video_file.filename,