]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video.js
Server: do not make friends with myself
[github/Chocobozzz/PeerTube.git] / server / models / video.js
index 4b941a40cf6ee8d11ef8b71b8f30a1fe3fd841bc..05c4f51cb2d7211918e71f5c261b605c2d90b51c 100644 (file)
@@ -57,7 +57,7 @@ VideoSchema.statics = {
   getDurationFromFile,
   listForApi,
   listByUrlAndMagnet,
-  listByUrls,
+  listByUrl,
   listOwned,
   listOwnedByAuthor,
   listRemotes,
@@ -94,7 +94,7 @@ VideoSchema.pre('save', function (next) {
   const tasks = []
 
   if (video.isOwned()) {
-    const videoPath = pathUtils.join(constants.CONFIG.STORAGE.UPLOAD_DIR, video.filename)
+    const videoPath = pathUtils.join(constants.CONFIG.STORAGE.VIDEOS_DIR, video.filename)
     this.podUrl = constants.CONFIG.WEBSERVER.URL
 
     tasks.push(
@@ -218,8 +218,8 @@ function listByUrlAndMagnet (fromUrl, magnetUri, callback) {
   this.find({ podUrl: fromUrl, magnetUri: magnetUri }, callback)
 }
 
-function listByUrls (fromUrls, callback) {
-  this.find({ podUrl: { $in: fromUrls } }, callback)
+function listByUrl (fromUrl, callback) {
+  this.find({ podUrl: fromUrl }, callback)
 }
 
 function listOwned (callback) {
@@ -258,7 +258,7 @@ function removeThumbnail (video, callback) {
 }
 
 function removeFile (video, callback) {
-  fs.unlink(constants.CONFIG.STORAGE.UPLOAD_DIR + video.filename, callback)
+  fs.unlink(constants.CONFIG.STORAGE.VIDEOS_DIR + video.filename, callback)
 }
 
 // Maybe the torrent is not seeded, but we catch the error to don't stop the removing process