aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
commitf0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch)
tree99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/models/videos.js
parent5101105ef91bfe478f97546b78b321882da2079c (diff)
downloadPeerTube-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.js36
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
3var async = require('async') 3const async = require('async')
4var config = require('config') 4const config = require('config')
5var dz = require('dezalgo') 5const dz = require('dezalgo')
6var fs = require('fs') 6const fs = require('fs')
7var mongoose = require('mongoose') 7const mongoose = require('mongoose')
8var path = require('path') 8const path = require('path')
9 9
10var logger = require('../helpers/logger') 10const logger = require('../helpers/logger')
11 11
12var http = config.get('webserver.https') === true ? 'https' : 'http' 12const http = config.get('webserver.https') === true ? 'https' : 'http'
13var host = config.get('webserver.host') 13const host = config.get('webserver.host')
14var port = config.get('webserver.port') 14const port = config.get('webserver.port')
15var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) 15const uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads'))
16 16
17// --------------------------------------------------------------------------- 17// ---------------------------------------------------------------------------
18 18
19var videosSchema = mongoose.Schema({ 19const 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})
26var VideosDB = mongoose.model('videos', videosSchema) 26const VideosDB = mongoose.model('videos', videosSchema)
27 27
28// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
29 29
30var Videos = { 30const 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 = {
43function add (video, callback) { 43function 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) {
60function addRemotes (videos, callback) { 60function 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