- // { path, data }
- pods.makeSecureRequest = function (data, callback) {
- PodsDB.find({}, { url: 1, publicKey: 1 }).exec(function (err, urls) {
- if (err) {
- logger.error('Cannot get the list of the pods.', { error: err })
- return callback(err)
- }
-
- logger.debug('Make multiple requests.')
-
- var params = {
- encrypt: true,
- sign: true,
- method: data.method,
- path: data.path,
- data: data.data
- }
-
- utils.makeMultipleRetryRequest(
- params,
-
- urls,
-
- function callbackEachPodFinished (err, response, body, url) {
- if (err || response.statusCode !== 200) {
- logger.error('Error sending secure request to %s/%s pod.', url, data.path, { error: err })
- }
- },
-
- function callbackAllPodsFinished (err) {
- if (err) {
- logger.error('There was some errors when sending the video meta data.', { error: err })
- return callback(err)
- }
+ pods.addVideoToFriends = function (video) {
+ // To avoid duplicates
+ var id = video.name + video.magnetUri
+ poolRequests.addToPoolRequests(id, 'add', video)
+ }