-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpusha_serial_migrate.php
More file actions
54 lines (51 loc) · 1.3 KB
/
pusha_serial_migrate.php
File metadata and controls
54 lines (51 loc) · 1.3 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
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
$worker= new GearmanWorker();
$worker->addServer();
$worker->addFunction("migrate_serial_to_kz", "migrate_serial_to_kz");
while ($worker->work());
function migrate_serial_to_kz($job) {
global $argv;
if ($argv[1] == "kz") {
$cat[16] = 18;
$cat[1] = 1;
$cat[2] = 2;
$cat[22] = 22;
$cat[3] = 3;
$cat[4] = 4;
$cat[21] = 23;
$cat[13] = 13;
$cat[9] = 9;
$cat[10] = 10;
$cat[5] = 5;
$cat[25] = 26;
$cat[6] = 6;
$cat[7] = 7;
$cat[8] = 8;
} else {
$cat[18] = 16;
$cat[1] = 1;
$cat[2] = 2;
$cat[22] = 22;
$cat[3] = 3;
$cat[4] = 4;
$cat[23] = 21;
$cat[13] = 13;
$cat[9] = 9;
$cat[10] = 10;
$cat[5] = 5;
$cat[26] = 25;
$cat[6] = 6;
$cat[7] = 7;
$cat[8] = 8;
}
system("rm -rf videos/*");
$tld = "kg";
if ($argv[1] == "kz") $tld = "kz";
$json = file_get_contents("http://video.namba.$tld/json/?_=1317879687192&action=video&id={$job->workload()}");
$video = json_decode($json);
mkdir ("videos/{$video->video->category->id}");
$video->video->title = preg_replace("/[^\ 0-9a-zA-Zа-яА-Я]/u", "", $video->video->title);
system("wget \"{$video->video->download->flv}\" -O \"videos/{$video->video->category->id}/{$video->video->title}.flv\"");
system("php pusha_video.php");
}
?>