aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/v1/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/v1/videos.js')
-rw-r--r--server/controllers/api/v1/videos.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index 0e058836e..5bdfdbf58 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -111,13 +111,15 @@ function addVideo (req, res, next) {
111 thumbnail: thumbnailName 111 thumbnail: thumbnailName
112 } 112 }
113 113
114 Videos.add(videoData, function (err) { 114 Videos.add(videoData, function (err, insertedVideo) {
115 if (err) { 115 if (err) {
116 // TODO unseed the video 116 // TODO unseed the video
117 logger.error('Cannot insert this video in the database.') 117 logger.error('Cannot insert this video in the database.')
118 return next(err) 118 return next(err)
119 } 119 }
120 120
121 videoData.createdDate = insertedVideo.createdDate
122
121 fs.readFile(thumbnailsDir + thumbnailName, function (err, data) { 123 fs.readFile(thumbnailsDir + thumbnailName, function (err, data) {
122 if (err) { 124 if (err) {
123 // TODO: remove video? 125 // TODO: remove video?
@@ -205,7 +207,8 @@ function getFormatedVideo (videoObj) {
205 magnetUri: videoObj.magnetUri, 207 magnetUri: videoObj.magnetUri,
206 author: videoObj.author, 208 author: videoObj.author,
207 duration: videoObj.duration, 209 duration: videoObj.duration,
208 thumbnailPath: constants.THUMBNAILS_STATIC_PATH + '/' + videoObj.thumbnail 210 thumbnailPath: constants.THUMBNAILS_STATIC_PATH + '/' + videoObj.thumbnail,
211 createdDate: videoObj.createdDate
209 } 212 }
210 213
211 return formatedVideo 214 return formatedVideo