Ensure the addtime parameter is set for each added torrent

Add destination only if a destination was specified
This commit is contained in:
John Furrow
2015-11-08 21:31:22 -08:00
parent 43a92ea98a
commit 5f9d2a9889
+12 -5
View File
@@ -28,13 +28,20 @@ client.prototype.add = function(data, callback) {
var torrentsAdded = 0;
while (torrentsAdded < data.urls.length) {
var parameters = [
'',
data.urls[torrentsAdded]
];
if (data.destination !== null && data.destination !== '') {
parameters.push('d.directory.set="' + data.destination + '"');
}
parameters.push('d.custom.set=addtime,' + Math.floor(Date.now() / 1000));
multicall[0].push({
methodName: 'load.start',
params: [
'',
data.urls[torrentsAdded],
'd.directory.set="' + data.destination + '"'
]
params: parameters
});
torrentsAdded++;