This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdo.php
119 lines (109 loc) · 3.5 KB
/
do.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
define('IN_SYS', TRUE);
include_once 'function.php';
if(isCil()){
echo(date('Y/m/d H:i:s', time()).": 正在生成缩略图...".PHP_EOL);
mkpicForRoot($video_root_path);
echo(date('Y/m/d H:i:s', time()).": 正在识别番剧...".PHP_EOL);
saveVideoInformationForRoot($video_root_path);
echo(date('Y/m/d H:i:s', time()).": 正在下载弹幕...".PHP_EOL);
downloadCommentForRoot($video_root_path);
echo(date('Y/m/d H:i:s', time()).": 任务完成".PHP_EOL);
exit();
}
@header("Cache-Control: no-cache, must-revalidate");
function checkRefer($source=0){
if(!$_SERVER['HTTP_REFERER']){
//@header("refresh:1;url=./do.php");
@header('Location: ./do.php');
}
}
function mkContainer($str){
echo('<div class="container">'.$str.'</div>');
}
function doTask(){
switch($_GET['step']){
case 1:
checkRefer();
mkContainer('正在生成视频缩略图...');
@header("refresh:1;url=./do.php?step=1.5");
break;
case 1.5:
checkRefer();
mkpicForRoot($GLOBALS['video_root_path']);
@header("refresh:1;url=./do.php?step=2");
break;
case 2:
checkRefer();
mkContainer('正在识别番剧...');
@header("refresh:1;url=./do.php?step=2.5");
break;
case 2.5:
checkRefer();
saveVideoInformationForRoot($GLOBALS['video_root_path']);
@header("refresh:1;url=./do.php?step=3");
break;
case 3:
checkRefer();
mkContainer('正在获取弹幕...');
@header("refresh:1;url=./do.php?step=3.5");
break;
case 3.5:
checkRefer();
downloadCommentForRoot($GLOBALS['video_root_path']);
@header("refresh:1;url=./do.php?step=4");
break;
case 4:
mkContainer('<a id="cttx">任务完成</a></br></br> <div style="text-align: center"> <a id="jump" href="./do.php" id="cttx">重新执行</a><a>  </a><a id="jump" href="./" id="cttx">返回主页</a> </div>');
break;
default:
mkContainer('正在准备执行任务');
@header("refresh:1;url=./do.php?step=1");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="./css/icon.png" type="image/x-icon">
<title>执行任务中...</title>
<style>
html {
padding: 50px 10px;
font-size: 16px;
line-height: 1.4;
color: #666;
background: #F6F6F3;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px;
margin: 0 auto;
background: #FFF;
}
ul {
padding: 0 0 0 40px;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
#cttx {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<?php doTask(); ?>
</body>
</html>