aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/server/models/video.js b/server/models/video.js
index 7d073cffa..9272bea6d 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -19,9 +19,6 @@ const utils = require('../helpers/utils')
19const http = config.get('webserver.https') === true ? 'https' : 'http' 19const http = config.get('webserver.https') === true ? 'https' : 'http'
20const host = config.get('webserver.host') 20const host = config.get('webserver.host')
21const port = config.get('webserver.port') 21const port = config.get('webserver.port')
22const uploadsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.uploads'))
23const thumbnailsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.thumbnails'))
24const torrentsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.torrents'))
25const webseedBaseUrl = http + '://' + host + ':' + port + constants.STATIC_PATHS.WEBSEED 22const webseedBaseUrl = http + '://' + host + ':' + port + constants.STATIC_PATHS.WEBSEED
26 23
27// --------------------------------------------------------------------------- 24// ---------------------------------------------------------------------------
@@ -112,7 +109,7 @@ VideoSchema.pre('save', function (next) {
112 createTorrent(videoPath, { announceList: [ [ 'ws://' + host + ':' + port + '/tracker/socket' ] ], urlList: [ webseedBaseUrl + video.filename ] }, function (err, torrent) { 109 createTorrent(videoPath, { announceList: [ [ 'ws://' + host + ':' + port + '/tracker/socket' ] ], urlList: [ webseedBaseUrl + video.filename ] }, function (err, torrent) {
113 if (err) return callback(err) 110 if (err) return callback(err)
114 111
115 fs.writeFile(torrentsDir + video.filename + '.torrent', torrent, function (err) { 112 fs.writeFile(constants.CONFIG.STORAGE.TORRENTS_DIR + video.filename + '.torrent', torrent, function (err) {
116 if (err) return callback(err) 113 if (err) return callback(err)
117 114
118 const parsedTorrent = parseTorrent(torrent) 115 const parsedTorrent = parseTorrent(torrent)
@@ -263,7 +260,7 @@ function removeFile (video, callback) {
263 260
264// Maybe the torrent is not seeded, but we catch the error to don't stop the removing process 261// Maybe the torrent is not seeded, but we catch the error to don't stop the removing process
265function removeTorrent (video, callback) { 262function removeTorrent (video, callback) {
266 fs.unlink(torrentsDir + video.filename + '.torrent') 263 fs.unlink(constants.CONFIG.STORAGE.TORRENTS_DIR + video.filename + '.torrent', callback)
267} 264}
268 265
269function createThumbnail (videoPath, callback) { 266function createThumbnail (videoPath, callback) {