aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/v1
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/v1')
-rw-r--r--server/controllers/api/v1/remote.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/server/controllers/api/v1/remote.js b/server/controllers/api/v1/remote.js
index 7af9b7e84..9c2ca86e0 100644
--- a/server/controllers/api/v1/remote.js
+++ b/server/controllers/api/v1/remote.js
@@ -39,6 +39,8 @@ function remoteVideos (req, res, next) {
39 addRemoteVideo(videoData, callbackEach) 39 addRemoteVideo(videoData, callbackEach)
40 } else if (request.type === 'remove') { 40 } else if (request.type === 'remove') {
41 removeRemoteVideo(videoData, fromUrl, callbackEach) 41 removeRemoteVideo(videoData, fromUrl, callbackEach)
42 } else {
43 logger.error('Unkown remote request type %s.', request.type)
42 } 44 }
43 }, function (err) { 45 }, function (err) {
44 if (err) logger.error('Error managing remote videos.', { error: err }) 46 if (err) logger.error('Error managing remote videos.', { error: err })
@@ -49,6 +51,8 @@ function remoteVideos (req, res, next) {
49} 51}
50 52
51function addRemoteVideo (videoToCreateData, callback) { 53function addRemoteVideo (videoToCreateData, callback) {
54 logger.debug('Adding remote video %s.', videoToCreateData.magnetUri)
55
52 // Mongoose pre hook will automatically create the thumbnail on disk 56 // Mongoose pre hook will automatically create the thumbnail on disk
53 videoToCreateData.thumbnail = videoToCreateData.thumbnailBase64 57 videoToCreateData.thumbnail = videoToCreateData.thumbnailBase64
54 58
@@ -64,7 +68,13 @@ function removeRemoteVideo (videoToRemoveData, fromUrl, callback) {
64 return callback(err) 68 return callback(err)
65 } 69 }
66 70
71 if (videosList.length === 0) {
72 logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podUrl: fromUrl })
73 }
74
67 async.each(videosList, function (video, callbackEach) { 75 async.each(videosList, function (video, callbackEach) {
76 logger.debug('Removing remote video %s.', video.magnetUri)
77
68 video.remove(callbackEach) 78 video.remove(callbackEach)
69 }, callback) 79 }, callback)
70 }) 80 })