From 9f10b2928df655c3672d9607e864e667d4bc903a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 7 Feb 2016 11:23:23 +0100 Subject: Remove useless anonymous functions of files --- lib/videos.js | 102 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 50 insertions(+), 52 deletions(-) (limited to 'lib/videos.js') diff --git a/lib/videos.js b/lib/videos.js index 0e8143351..2d7d9500d 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -1,52 +1,50 @@ -;(function () { - 'use strict' - - var async = require('async') - var config = require('config') - var path = require('path') - var webtorrent = require('../lib/webtorrent') - - var logger = require('../helpers/logger') - var Videos = require('../models/videos') - - var uploadDir = path.join(__dirname, '..', config.get('storage.uploads')) - - var videos = { - seed: seed, - seedAllExisting: seedAllExisting - } - - function seed (path, callback) { - logger.info('Seeding %s...', path) - - webtorrent.seed(path, function (torrent) { - logger.info('%s seeded (%s).', path, torrent.magnetURI) - - return callback(null, torrent) - }) - } - - function seedAllExisting (callback) { - Videos.listOwned(function (err, videos_list) { - if (err) { - logger.error('Cannot get list of the videos to seed.') - return callback(err) - } - - async.each(videos_list, function (video, each_callback) { - seed(uploadDir + video.namePath, function (err) { - if (err) { - logger.error('Cannot seed this video.') - return callback(err) - } - - each_callback(null) - }) - }, callback) - }) - } - - // --------------------------------------------------------------------------- - - module.exports = videos -})() +'use strict' + +var async = require('async') +var config = require('config') +var path = require('path') +var webtorrent = require('../lib/webtorrent') + +var logger = require('../helpers/logger') +var Videos = require('../models/videos') + +var uploadDir = path.join(__dirname, '..', config.get('storage.uploads')) + +var videos = { + seed: seed, + seedAllExisting: seedAllExisting +} + +function seed (path, callback) { + logger.info('Seeding %s...', path) + + webtorrent.seed(path, function (torrent) { + logger.info('%s seeded (%s).', path, torrent.magnetURI) + + return callback(null, torrent) + }) +} + +function seedAllExisting (callback) { + Videos.listOwned(function (err, videos_list) { + if (err) { + logger.error('Cannot get list of the videos to seed.') + return callback(err) + } + + async.each(videos_list, function (video, each_callback) { + seed(uploadDir + video.namePath, function (err) { + if (err) { + logger.error('Cannot seed this video.') + return callback(err) + } + + each_callback(null) + }) + }, callback) + }) +} + +// --------------------------------------------------------------------------- + +module.exports = videos -- cgit v1.2.3