const utils = require('./server/helpers/utils')
const webtorrent = require('./server/lib/webtorrent')
const Request = mongoose.model('Request')
+const Video = mongoose.model('Video')
// Get configurations
const port = config.get('listen.port')
// Activate the pool requests
Request.activate()
- // videos.seedAllExisting(function () {
+ Video.seedAllExisting(function (err) {
+ if (err) throw err
+
logger.info('Seeded all the videos')
logger.info('Server listening on port %d', port)
app.emit('ready')
- // })
+ })
})
})
})
findWithCount.call(this, query, start, count, sort, callback)
}
-// TODO
-function seedAllExisting () {
+function seedAllExisting (callback) {
+ listOwned.call(this, function (err, videos) {
+ if (err) return callback(err)
+ async.each(videos, function (video, callbackEach) {
+ const videoPath = pathUtils.join(uploadsDir, video.namePath)
+ seed(videoPath, callbackEach)
+ }, callback)
+ })
}
// ---------------------------------------------------------------------------