diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 22:29:27 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 22:29:27 +0100 |
commit | f0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch) | |
tree | 99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/models/videos.js | |
parent | 5101105ef91bfe478f97546b78b321882da2079c (diff) | |
download | PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.gz PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.zst PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.zip |
Use const/let now we use node 4.2
Diffstat (limited to 'server/models/videos.js')
-rw-r--r-- | server/models/videos.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/server/models/videos.js b/server/models/videos.js index fd02ec9e1..0141cbb7f 100644 --- a/server/models/videos.js +++ b/server/models/videos.js | |||
@@ -1,33 +1,33 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var async = require('async') | 3 | const async = require('async') |
4 | var config = require('config') | 4 | const config = require('config') |
5 | var dz = require('dezalgo') | 5 | const dz = require('dezalgo') |
6 | var fs = require('fs') | 6 | const fs = require('fs') |
7 | var mongoose = require('mongoose') | 7 | const mongoose = require('mongoose') |
8 | var path = require('path') | 8 | const path = require('path') |
9 | 9 | ||
10 | var logger = require('../helpers/logger') | 10 | const logger = require('../helpers/logger') |
11 | 11 | ||
12 | var http = config.get('webserver.https') === true ? 'https' : 'http' | 12 | const http = config.get('webserver.https') === true ? 'https' : 'http' |
13 | var host = config.get('webserver.host') | 13 | const host = config.get('webserver.host') |
14 | var port = config.get('webserver.port') | 14 | const port = config.get('webserver.port') |
15 | var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) | 15 | const uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) |
16 | 16 | ||
17 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |
18 | 18 | ||
19 | var videosSchema = mongoose.Schema({ | 19 | const videosSchema = mongoose.Schema({ |
20 | name: String, | 20 | name: String, |
21 | namePath: String, | 21 | namePath: String, |
22 | description: String, | 22 | description: String, |
23 | magnetUri: String, | 23 | magnetUri: String, |
24 | podUrl: String | 24 | podUrl: String |
25 | }) | 25 | }) |
26 | var VideosDB = mongoose.model('videos', videosSchema) | 26 | const VideosDB = mongoose.model('videos', videosSchema) |
27 | 27 | ||
28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
29 | 29 | ||
30 | var Videos = { | 30 | const Videos = { |
31 | add: add, | 31 | add: add, |
32 | addRemotes: addRemotes, | 32 | addRemotes: addRemotes, |
33 | get: get, | 33 | get: get, |
@@ -43,7 +43,7 @@ var Videos = { | |||
43 | function add (video, callback) { | 43 | function add (video, callback) { |
44 | logger.info('Adding %s video to database.', video.name) | 44 | logger.info('Adding %s video to database.', video.name) |
45 | 45 | ||
46 | var params = video | 46 | const params = video |
47 | params.podUrl = http + '://' + host + ':' + port | 47 | params.podUrl = http + '://' + host + ':' + port |
48 | 48 | ||
49 | VideosDB.create(params, function (err, video) { | 49 | VideosDB.create(params, function (err, video) { |
@@ -60,13 +60,13 @@ function add (video, callback) { | |||
60 | function addRemotes (videos, callback) { | 60 | function addRemotes (videos, callback) { |
61 | if (!callback) callback = function () {} | 61 | if (!callback) callback = function () {} |
62 | 62 | ||
63 | var to_add = [] | 63 | const to_add = [] |
64 | 64 | ||
65 | async.each(videos, function (video, callback_each) { | 65 | async.each(videos, function (video, callback_each) { |
66 | callback_each = dz(callback_each) | 66 | callback_each = dz(callback_each) |
67 | logger.debug('Add remote video from pod: %s', video.podUrl) | 67 | logger.debug('Add remote video from pod: %s', video.podUrl) |
68 | 68 | ||
69 | var params = { | 69 | const params = { |
70 | name: video.name, | 70 | name: video.name, |
71 | namePath: null, | 71 | namePath: null, |
72 | description: video.description, | 72 | description: video.description, |
@@ -159,7 +159,7 @@ function removeRemotesOfByMagnetUris (fromUrl, magnetUris, callback) { | |||
159 | return callback(err) | 159 | return callback(err) |
160 | } | 160 | } |
161 | 161 | ||
162 | var to_remove = [] | 162 | const to_remove = [] |
163 | async.each(videos, function (video, callback_async) { | 163 | async.each(videos, function (video, callback_async) { |
164 | callback_async = dz(callback_async) | 164 | callback_async = dz(callback_async) |
165 | 165 | ||