diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video.js | 7 |
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') | |||
19 | const http = config.get('webserver.https') === true ? 'https' : 'http' | 19 | const http = config.get('webserver.https') === true ? 'https' : 'http' |
20 | const host = config.get('webserver.host') | 20 | const host = config.get('webserver.host') |
21 | const port = config.get('webserver.port') | 21 | const port = config.get('webserver.port') |
22 | const uploadsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.uploads')) | ||
23 | const thumbnailsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.thumbnails')) | ||
24 | const torrentsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.torrents')) | ||
25 | const webseedBaseUrl = http + '://' + host + ':' + port + constants.STATIC_PATHS.WEBSEED | 22 | const 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 |
265 | function removeTorrent (video, callback) { | 262 | function 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 | ||
269 | function createThumbnail (videoPath, callback) { | 266 | function createThumbnail (videoPath, callback) { |