utorrent-cluster
Advanced tools
Comparing version 0.0.5 to 0.0.7
@@ -12,3 +12,3 @@ var uCluster = require('../'); | ||
uc.add('http://torcache.net/torrent/FB8E28A6D2E17F41F804A24EC1CBB9791708A0ED.torrent', function(err, events) { | ||
uc.add('magnet:?xt=urn:btih:1FA6D2D6A5FE21D00E0B822CCDA7699547163F65&dn=Ed+Sheeran+-+x+%28Deluxe+Edition%29+%7B2014-Album%7D&tr=udp%3A%2F%2Ftracker.istole.it%3A80%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=udp%3A%2F%2F11.rarbg.me%3A80%2Fannounce&tr=udp%3A%2F%2F10.rarbg.me%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.token.ro%3A80%2Fannounce&tr=udp%3A%2F%2F12.rarbg.me%3A80%2Fannounce', function(err, events) { | ||
@@ -29,3 +29,7 @@ if (err) { | ||
events.on('complete', function(torrent) { | ||
console.log('complete', torrent); | ||
uc.remove(torrent.hash, function(err, res) { | ||
}); | ||
}); | ||
@@ -32,0 +36,0 @@ |
@@ -169,11 +169,25 @@ var request = require('request'); | ||
/** | ||
* Find in cluster and get the torrent object for the associated hash | ||
*/ | ||
uCluster.prototype.get = function(hash, callback) { | ||
uCluster.prototype.remove = function(hash, callback) { | ||
this.getServer(hash, function(err, server) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (!server) { | ||
return callback(null, null); | ||
} | ||
server.remove(hash, callback); | ||
}); | ||
} | ||
uCluster.prototype.getServer = function(hash, callback) { | ||
var self = this; | ||
var torrent = null; | ||
//Check our cache for associated server, with fallback to checking all servers | ||
async.waterfall([ | ||
@@ -189,4 +203,14 @@ function(cb) { | ||
} | ||
], function(err, server) { | ||
], callback); | ||
}; | ||
/** | ||
* Find in cluster and get the torrent object for the associated hash | ||
*/ | ||
uCluster.prototype.get = function(hash, callback) { | ||
this.getServer(hash, function(err, server) { | ||
if (err) { | ||
@@ -193,0 +217,0 @@ return callback(err); |
@@ -87,7 +87,16 @@ var request = require('request'); | ||
/** | ||
* Remove torrent | ||
* @param {[type]} hash [description] | ||
* @param {Function} callback [description] | ||
* @return {[type]} [description] | ||
*/ | ||
uTorrent.prototype.remove = function(hash, callback) { | ||
var options = { | ||
qs: { | ||
action: 'remove', | ||
hash: hash | ||
} | ||
} | ||
this.call(options, callback); | ||
}; | ||
@@ -358,2 +367,4 @@ | ||
requestOptions.qs = options.qs || {}; | ||
requestOptions.qs.t = new Date().getTime(); | ||
if (options.path !== '/token.html') { | ||
@@ -360,0 +371,0 @@ requestOptions.qs.token = this.token; |
{ | ||
"name": "utorrent-cluster", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"description": "Redis-backed utorrent cluster in node.js for torrent downloads.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22156
788