-function removeRemotesOfByMagnetUris (fromUrl, magnetUris, callback) {
- if (callback === undefined) callback = function () {}
-
- VideosDB.find({ magnetUri: { $in: magnetUris } }, function (err, videos) {
- if (err || !videos) {
- logger.error('Cannot find the torrent URI of these remote videos.')
- return callback(err)
- }
-
- var to_remove = []
- async.each(videos, function (video, callback_async) {
- callback_async = dz(callback_async)
-
- if (video.podUrl !== fromUrl) {
- logger.error('The pod %s has not the rights on the video of %s.', fromUrl, video.podUrl)
- } else {
- to_remove.push(video._id)
- }
-
- callback_async()
- }, function () {
- VideosDB.remove({ _id: { $in: to_remove } }, function (err) {
- if (err) {
- logger.error('Cannot remove the remote videos.')
- return callback(err)
- }
-
- logger.info('Removed remote videos from %s.', fromUrl)
- callback(null)
- })
- })
- })
+function removeByIds (ids, callback) {
+ VideosDB.remove({ _id: { $in: ids } }, callback)