aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-07 11:33:59 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-07 11:33:59 +0100
commitb9a3e09ad5a7673f64556d1dba122ed4c4fac980 (patch)
tree66d4928b82af19a2372a2505822233884f3fd471 /lib/videos.js
parentb2ff5e3e686eb552c5ccd64ce67b0455972ceef0 (diff)
downloadPeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.tar.gz
PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.tar.zst
PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.zip
Prepare folders structure for angular app
Diffstat (limited to 'lib/videos.js')
-rw-r--r--lib/videos.js50
1 files changed, 0 insertions, 50 deletions
diff --git a/lib/videos.js b/lib/videos.js
deleted file mode 100644
index 2d7d9500d..000000000
--- a/lib/videos.js
+++ /dev/null
@@ -1,50 +0,0 @@
1'use strict'
2
3var async = require('async')
4var config = require('config')
5var path = require('path')
6var webtorrent = require('../lib/webtorrent')
7
8var logger = require('../helpers/logger')
9var Videos = require('../models/videos')
10
11var uploadDir = path.join(__dirname, '..', config.get('storage.uploads'))
12
13var videos = {
14 seed: seed,
15 seedAllExisting: seedAllExisting
16}
17
18function seed (path, callback) {
19 logger.info('Seeding %s...', path)
20
21 webtorrent.seed(path, function (torrent) {
22 logger.info('%s seeded (%s).', path, torrent.magnetURI)
23
24 return callback(null, torrent)
25 })
26}
27
28function seedAllExisting (callback) {
29 Videos.listOwned(function (err, videos_list) {
30 if (err) {
31 logger.error('Cannot get list of the videos to seed.')
32 return callback(err)
33 }
34
35 async.each(videos_list, function (video, each_callback) {
36 seed(uploadDir + video.namePath, function (err) {
37 if (err) {
38 logger.error('Cannot seed this video.')
39 return callback(err)
40 }
41
42 each_callback(null)
43 })
44 }, callback)
45 })
46}
47
48// ---------------------------------------------------------------------------
49
50module.exports = videos