command api supports pause new task
This commit is contained in:
parent
ee1ea1626c
commit
bb41b52917
|
@ -13,6 +13,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {};
|
var options = {};
|
||||||
|
var isPaused = false;
|
||||||
|
|
||||||
if (params) {
|
if (params) {
|
||||||
for (var key in params) {
|
for (var key in params) {
|
||||||
|
@ -24,17 +25,25 @@
|
||||||
options[key] = params[key];
|
options[key] = params[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.pause === 'true') {
|
||||||
|
isPaused = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.loadPromise = aria2TaskService.newUriTask({
|
$rootScope.loadPromise = aria2TaskService.newUriTask({
|
||||||
urls: [url],
|
urls: [url],
|
||||||
options: options
|
options: options
|
||||||
}, false, function (response) {
|
}, isPaused, function (response) {
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPaused) {
|
||||||
|
$location.path('/waiting');
|
||||||
|
} else {
|
||||||
$location.path('/downloading');
|
$location.path('/downloading');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ariaNgLogService.info('[CommandController] new download: ' + url);
|
ariaNgLogService.info('[CommandController] new download: ' + url);
|
||||||
|
|
Reference in a new issue