diff options
-rw-r--r-- | server.js | 7 | ||||
-rw-r--r-- | server/models/video.js | 10 |
2 files changed, 13 insertions, 4 deletions
@@ -37,6 +37,7 @@ const routes = require('./server/controllers') | |||
37 | const utils = require('./server/helpers/utils') | 37 | const utils = require('./server/helpers/utils') |
38 | const webtorrent = require('./server/lib/webtorrent') | 38 | const webtorrent = require('./server/lib/webtorrent') |
39 | const Request = mongoose.model('Request') | 39 | const Request = mongoose.model('Request') |
40 | const Video = mongoose.model('Video') | ||
40 | 41 | ||
41 | // Get configurations | 42 | // Get configurations |
42 | const port = config.get('listen.port') | 43 | const port = config.get('listen.port') |
@@ -139,11 +140,13 @@ installer.installApplication(function (err) { | |||
139 | // Activate the pool requests | 140 | // Activate the pool requests |
140 | Request.activate() | 141 | Request.activate() |
141 | 142 | ||
142 | // videos.seedAllExisting(function () { | 143 | Video.seedAllExisting(function (err) { |
144 | if (err) throw err | ||
145 | |||
143 | logger.info('Seeded all the videos') | 146 | logger.info('Seeded all the videos') |
144 | logger.info('Server listening on port %d', port) | 147 | logger.info('Server listening on port %d', port) |
145 | app.emit('ready') | 148 | app.emit('ready') |
146 | // }) | 149 | }) |
147 | }) | 150 | }) |
148 | }) | 151 | }) |
149 | }) | 152 | }) |
diff --git a/server/models/video.js b/server/models/video.js index 8b14e9b35..b111e29aa 100644 --- a/server/models/video.js +++ b/server/models/video.js | |||
@@ -230,9 +230,15 @@ function search (value, field, start, count, sort, callback) { | |||
230 | findWithCount.call(this, query, start, count, sort, callback) | 230 | findWithCount.call(this, query, start, count, sort, callback) |
231 | } | 231 | } |
232 | 232 | ||
233 | // TODO | 233 | function seedAllExisting (callback) { |
234 | function seedAllExisting () { | 234 | listOwned.call(this, function (err, videos) { |
235 | if (err) return callback(err) | ||
235 | 236 | ||
237 | async.each(videos, function (video, callbackEach) { | ||
238 | const videoPath = pathUtils.join(uploadsDir, video.namePath) | ||
239 | seed(videoPath, callbackEach) | ||
240 | }, callback) | ||
241 | }) | ||
236 | } | 242 | } |
237 | 243 | ||
238 | // --------------------------------------------------------------------------- | 244 | // --------------------------------------------------------------------------- |