-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileFinder.php
56 lines (52 loc) · 2.43 KB
/
FileFinder.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
53
54
55
56
<?php
include_once "ShutterstockFiles.php";
include_once "FindeImagesFork.php";
include_once "FindeImages.php";
include_once "FindeImages2.php";
include_once "GetDataFromShutter.php";
include_once "PreCondition.php";
include_once "CashFiles.php";
include_once "CashFilesFork.php";
include_once "ConvertRezult.php";
include_once "PostCondition.php";
class FileFinder
{
public function FindData($File){
$files = new ShutterstockFiles();
$finder = new FindeImages2();
$getdata = new GetDataFromShutter();
$cash = new CashFiles();
$pre = new PreCondition();
$convert = new ConvertRezult();
$post = new PostCondition();
$time = microtime(true);
$Pre = $pre->PreConditions($File);
$Portfolio = $Pre['shutterstock_profile_url'];
$folder = $Pre['user_id'];
$FileThumbs = $Pre['items'];
print "Time for PreConditions: ".(int)(microtime(true) - $time). " seconds\n";
$AllFilesShuter = $files->ShutterFiles($Portfolio, $folder);
print "Time for Getting portfolio from shutter: ".(int)(microtime(true) - $time). " seconds\n";
$FileThumbs = $cash->CashDeposit($FileThumbs, $folder);
$AllFilesShuter = $cash->CashShutter($AllFilesShuter, $folder);
print "Time for Cashing: ".(int)(microtime(true) - $time). " seconds\n";
$ID_deposit_shutter = $finder->FindeImage($FileThumbs, $AllFilesShuter, $folder);
print "Time for Search of files: ".(int)(microtime(true) - $time). " seconds\n";
$Data = $getdata->GetData($ID_deposit_shutter, $folder);
print "Time for Getting Data from shutter: ".(int)(microtime(true) - $time). " seconds\n";
$Data = $convert->convertToJson($Data, $folder, $AllFilesShuter);
$post->PostConditions($folder);
print "---------------------------------\n
!!! END !!!
\n Full time of work: ".(int)(microtime(true) - $time). " seconds\n "
.count($ID_deposit_shutter)." files from ".count($Pre['items']). " were found\n
\n---------------------------------\n";
return $Data;
//return "END! ".count($Data). " files found!!!";
}
}
$compare = new FileFinder();
$compare->FindData($argv[1]);
//var_dump($compare->FindData("./1.txt")); // 250 sec
//var_dump($compare->FindData("./2.txt")); //1200 sec
//var_dump($compare->FindData("./3.txt")); // 380 sec