-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgetdetect.php
52 lines (41 loc) · 1.21 KB
/
getdetect.php
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
42
43
44
45
46
47
48
49
50
51
52
<?php
$updateId = isset($argv[1]) ? $argv[1] : 'c2a1d787-647b-486d-b264-f90f3782cdc6';
$usePack = isset($argv[2]) ? $argv[2] : 0;
$desiredEdition = isset($argv[3]) ? $argv[3] : 0;
$simple = isset($argv[4]) ? $argv[4] : 0;
require_once dirname(__FILE__).'/api/get.php';
require_once dirname(__FILE__).'/shared/main.php';
require_once dirname(__FILE__).'/shared/genpack.php';
consoleLogger(brand('get'));
if(!get7ZipLocation()) {
throwError('NO_7ZIP');
}
if(!generatePack($updateId)) {
throwError('PACKS_FAILED');
}
$files = uupGetFiles($updateId, $usePack, $desiredEdition);
if(isset($files['error'])) {
throwError($files['error']);
}
$files = $files['files'];
$filesKeys = array_keys($files);
function sortBySize($a, $b) {
global $files;
if ($files[$a]['size'] == $files[$b]['size']) {
return 0;
}
return ($files[$a]['size'] < $files[$b]['size']) ? -1 : 1;
}
usort($filesKeys, 'sortBySize');
if($simple == 1) {
foreach($filesKeys as $val) {
echo $val."|".$files[$val]['sha1']."|".$files[$val]['url']."\n";
}
die();
}
foreach($filesKeys as $val) {
echo $files[$val]['url']."\n";
echo ' out='.$val."\n";
echo ' checksum=sha-1='.$files[$val]['sha1']."\n\n";
}
?>