diff options
Diffstat (limited to 'server/models/video.js')
-rw-r--r-- | server/models/video.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/models/video.js b/server/models/video.js index 8054caa77..98f43a06d 100644 --- a/server/models/video.js +++ b/server/models/video.js | |||
@@ -1,9 +1,10 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const async = require('async') | ||
4 | const config = require('config') | 3 | const config = require('config') |
4 | const each = require('async/each') | ||
5 | const ffmpeg = require('fluent-ffmpeg') | 5 | const ffmpeg = require('fluent-ffmpeg') |
6 | const fs = require('fs') | 6 | const fs = require('fs') |
7 | const parallel = require('async/parallel') | ||
7 | const pathUtils = require('path') | 8 | const pathUtils = require('path') |
8 | const mongoose = require('mongoose') | 9 | const mongoose = require('mongoose') |
9 | 10 | ||
@@ -90,7 +91,7 @@ VideoSchema.pre('remove', function (next) { | |||
90 | ) | 91 | ) |
91 | } | 92 | } |
92 | 93 | ||
93 | async.parallel(tasks, next) | 94 | parallel(tasks, next) |
94 | }) | 95 | }) |
95 | 96 | ||
96 | VideoSchema.pre('save', function (next) { | 97 | VideoSchema.pre('save', function (next) { |
@@ -110,7 +111,7 @@ VideoSchema.pre('save', function (next) { | |||
110 | } | 111 | } |
111 | ) | 112 | ) |
112 | 113 | ||
113 | async.parallel(tasks, function (err, results) { | 114 | parallel(tasks, function (err, results) { |
114 | if (err) return next(err) | 115 | if (err) return next(err) |
115 | 116 | ||
116 | video.magnetUri = results[0].magnetURI | 117 | video.magnetUri = results[0].magnetURI |
@@ -234,7 +235,7 @@ function seedAllExisting (callback) { | |||
234 | listOwned.call(this, function (err, videos) { | 235 | listOwned.call(this, function (err, videos) { |
235 | if (err) return callback(err) | 236 | if (err) return callback(err) |
236 | 237 | ||
237 | async.each(videos, function (video, callbackEach) { | 238 | each(videos, function (video, callbackEach) { |
238 | const videoPath = pathUtils.join(uploadsDir, video.filename) | 239 | const videoPath = pathUtils.join(uploadsDir, video.filename) |
239 | seed(videoPath, callbackEach) | 240 | seed(videoPath, callbackEach) |
240 | }, callback) | 241 | }, callback) |
@@ -246,7 +247,7 @@ function seedAllExisting (callback) { | |||
246 | function findWithCount (query, start, count, sort, callback) { | 247 | function findWithCount (query, start, count, sort, callback) { |
247 | const self = this | 248 | const self = this |
248 | 249 | ||
249 | async.parallel([ | 250 | parallel([ |
250 | function (asyncCallback) { | 251 | function (asyncCallback) { |
251 | self.find(query).skip(start).limit(count).sort(sort).exec(asyncCallback) | 252 | self.find(query).skip(start).limit(count).sort(sort).exec(asyncCallback) |
252 | }, | 253 | }, |