-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlist.php
More file actions
43 lines (41 loc) · 1.2 KB
/
list.php
File metadata and controls
43 lines (41 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require_once "webmastconfig.php";
require_once "config.php";
require_once "Client.php";
$client = new \JsonRPC\Client ( 'http://' . HOST . ':' . PORT . '/jsonrpc', SECRET );
$debug = false;
if($debug ){
error_log ( '---------list.php Begin ' . $_GET['type'] . '-----------\n' );
}
if(! isset ( $_GET['type'] )) {
$_GET['type'] = 'active';
}
if($_GET['type'] == 'waiting') {
$downloads = $client->execute ( 'aria2.tellWaiting', array(0, 1000) );
}elseif($_GET['type'] == 'active') {
$downloads = $client->execute ( 'aria2.tellActive' );
}elseif($_GET['type'] == 'completed') {
$downloads_temp = $client->execute ( 'aria2.tellStopped', array(0, 1000) );
$downloads = null;
if($downloads_temp != null) {
foreach($downloads_temp as $download) {
if($download['status'] == 'complete') {
$downloads[] = $download;
}
}
}
}elseif($_GET['type'] == 'failed') {
$downloads_temp = $client->execute ( 'aria2.tellStopped', array(0, 1000) );
$downloads = null;
if($downloads_temp != null) {
foreach($downloads_temp as $download) {
if($download['status'] == 'error') {
$downloads[] = $download;
}
}
}
}
if($debug ){
error_log ( '---------list.php End-----------\n' );
}
//print_r($downloads);