aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/controllers/api/v1/videos.js2
-rw-r--r--server/models/video.js18
2 files changed, 10 insertions, 10 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index 83734b35e..d06ec8d08 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -90,7 +90,7 @@ function addVideo (req, res, next) {
90 function insertIntoDB (callback) { 90 function insertIntoDB (callback) {
91 const videoData = { 91 const videoData = {
92 name: videoInfos.name, 92 name: videoInfos.name,
93 namePath: videoFile.filename, 93 filename: videoFile.filename,
94 description: videoInfos.description, 94 description: videoInfos.description,
95 author: res.locals.oauth.token.user.username, 95 author: res.locals.oauth.token.user.username,
96 duration: videoFile.duration, 96 duration: videoFile.duration,
diff --git a/server/models/video.js b/server/models/video.js
index b111e29aa..a8a70ba89 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -24,7 +24,7 @@ const thumbnailsDir = pathUtils.join(__dirname, '..', '..', config.get('storage.
24// TODO: add indexes on searchable columns 24// TODO: add indexes on searchable columns
25const VideoSchema = mongoose.Schema({ 25const VideoSchema = mongoose.Schema({
26 name: String, 26 name: String,
27 namePath: String, 27 filename: String,
28 description: String, 28 description: String,
29 magnetUri: String, 29 magnetUri: String,
30 podUrl: String, 30 podUrl: String,
@@ -98,7 +98,7 @@ VideoSchema.pre('save', function (next) {
98 const tasks = [] 98 const tasks = []
99 99
100 if (video.isOwned()) { 100 if (video.isOwned()) {
101 const videoPath = pathUtils.join(uploadsDir, video.namePath) 101 const videoPath = pathUtils.join(uploadsDir, video.filename)
102 this.podUrl = http + '://' + host + ':' + port 102 this.podUrl = http + '://' + host + ':' + port
103 103
104 tasks.push( 104 tasks.push(
@@ -134,7 +134,7 @@ mongoose.model('Video', VideoSchema)
134// ------------------------------ METHODS ------------------------------ 134// ------------------------------ METHODS ------------------------------
135 135
136function isOwned () { 136function isOwned () {
137 return this.namePath !== null 137 return this.filename !== null
138} 138}
139 139
140function toFormatedJSON () { 140function toFormatedJSON () {
@@ -169,7 +169,7 @@ function toRemoteJSON (callback) {
169 name: self.name, 169 name: self.name,
170 description: self.description, 170 description: self.description,
171 magnetUri: self.magnetUri, 171 magnetUri: self.magnetUri,
172 namePath: null, 172 filename: null,
173 author: self.author, 173 author: self.author,
174 duration: self.duration, 174 duration: self.duration,
175 thumbnailBase64: new Buffer(thumbnailData).toString('base64'), 175 thumbnailBase64: new Buffer(thumbnailData).toString('base64'),
@@ -206,12 +206,12 @@ function listByUrls (fromUrls, callback) {
206} 206}
207 207
208function listOwned (callback) { 208function listOwned (callback) {
209 // If namePath is not null this is *our* video 209 // If filename is not null this is *our* video
210 this.find({ namePath: { $ne: null } }, callback) 210 this.find({ filename: { $ne: null } }, callback)
211} 211}
212 212
213function listRemotes (callback) { 213function listRemotes (callback) {
214 this.find({ namePath: null }, callback) 214 this.find({ filename: null }, callback)
215} 215}
216 216
217function load (id, callback) { 217function load (id, callback) {
@@ -235,7 +235,7 @@ function seedAllExisting (callback) {
235 if (err) return callback(err) 235 if (err) return callback(err)
236 236
237 async.each(videos, function (video, callbackEach) { 237 async.each(videos, function (video, callbackEach) {
238 const videoPath = pathUtils.join(uploadsDir, video.namePath) 238 const videoPath = pathUtils.join(uploadsDir, video.filename)
239 seed(videoPath, callbackEach) 239 seed(videoPath, callbackEach)
240 }, callback) 240 }, callback)
241 }) 241 })
@@ -267,7 +267,7 @@ function removeThumbnail (video, callback) {
267} 267}
268 268
269function removeFile (video, callback) { 269function removeFile (video, callback) {
270 fs.unlink(uploadsDir + video.namePath, callback) 270 fs.unlink(uploadsDir + video.filename, callback)
271} 271}
272 272
273// Maybe the torrent is not seeded, but we catch the error to don't stop the removing process 273// Maybe the torrent is not seeded, but we catch the error to don't stop the removing process