diff --git a/app/scripts/controllers/new.js b/app/scripts/controllers/new.js index 5b99dca..3aaa354 100644 --- a/app/scripts/controllers/new.js +++ b/app/scripts/controllers/new.js @@ -57,10 +57,6 @@ var options = angular.copy($scope.context.options); var tasks = []; - if (pauseOnAdded) { - options.pause = 'true'; - } - for (var i = 0; i < urls.length; i++) { tasks.push({ urls: [urls[i].trim()], @@ -68,7 +64,7 @@ }); } - $rootScope.loadPromise = aria2TaskService.newUriTasks(tasks, function (response) { + $rootScope.loadPromise = aria2TaskService.newUriTasks(tasks, pauseOnAdded, function (response) { if (!response.hasSuccess) { return; } diff --git a/app/scripts/services/aria2RpcService.js b/app/scripts/services/aria2RpcService.js index 3fd098e..c1de289 100644 --- a/app/scripts/services/aria2RpcService.js +++ b/app/scripts/services/aria2RpcService.js @@ -168,10 +168,17 @@ var contexts = []; for (var i = 0; i < context.tasks.length; i++) { + var task = context.tasks[i]; + var options = angular.copy(task.options); + + if (context.pauseOnAdded) { + options.pause = 'true'; + } + contexts.push({ silent: !!context.silent, - urls: context.tasks[i].urls, - options: context.tasks[i].options + urls: task.urls, + options: options }); } diff --git a/app/scripts/services/aria2TaskService.js b/app/scripts/services/aria2TaskService.js index d533355..1380971 100644 --- a/app/scripts/services/aria2TaskService.js +++ b/app/scripts/services/aria2TaskService.js @@ -248,9 +248,10 @@ } }); }, - newUriTasks: function (tasks, callback, silent) { + newUriTasks: function (tasks, pauseOnAdded, callback, silent) { return aria2RpcService.addUriMulti({ tasks: tasks, + pauseOnAdded: !!pauseOnAdded, silent: !!silent, callback: callback });