forked from mohtamohit/Videofy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·231 lines (189 loc) · 6.67 KB
/
index.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
error_reporting(0);
function connect($data){
$host = "127.0.0.1";
$port = 2000;
$output=$data;
$socket1 = socket_create(AF_INET, SOCK_STREAM,0) or die("Could not create socket\n");
socket_connect ($socket1 , $host,$port ) ;
socket_write($socket1, $output, strlen ($output)) or die("Python Server is not running....\nPlease start python server first...");
socket_close($socket1);
}
function imgshow($path,$id){
echo '<img src="'.$path.'" id="'.$id.'" height="220" width="360">';
}
function textshow($text,$id){
// echo $text;
echo '<label for="textarea">'.($id-1).'.</label>';
echo '<textarea name="'.$id.'" rows="4" cols="50" class="edit">'.$text.'</textarea>';
}
function edit_box(){
$result = file_get_contents("assets/data.json");
$resultData = json_decode($result, true);
for($i=2;$i<sizeof($resultData);$i++){
if($resultData[$i][0]=='img'){
imgshow($resultData[$i],$i);
}
else{
textshow($resultData[$i],$i);
}
}
}
function transcript(){
echo readfile("assets/f1.txt");
}
?>
<?php
$result = file_get_contents("assets/data.json");
$resultData = json_decode($result, true);
if(isset($_POST['edit']))
{
connect("sdf");
$result = file_get_contents("assets/data.json");
print($result);
// Decode the result
$resultData = json_decode($result, true);
for($i=2;$i<sizeof($resultData);$i++){
// echo $resultData[$i][1]+'<br>';
if($resultData[$i]=='img'){
// imgshow($resultData[$i][1],$i);
}
else{
echo $resultData[$i]=$_POST[$i];
}
}
echo $resultData;
$fp = fopen('assets/data.json', 'w');
fwrite($fp, json_encode($resultData));
fclose($fp);
echo '<script type="text/javascript">location.href = "redirect.php";</script>';
}
if(isset($_POST['url'])) {
$url = $_POST["url"];
$resultData =array("first",$url);
// $resultData = $url;
$fp = fopen('assets/data.json', 'w');
fwrite($fp, json_encode($resultData));
fclose($fp);
connect("123");
echo '<script type="text/javascript">location.href = "redirect.php";</script>';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Videos</title>
<!--Import Google Icon Font-->
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="materialize/css/materialize.min.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="mdl/material.min.css">
<script src="mdl/material.min.js"></script>
<!--Import jQuery before materialize.js-->
</head>
<body>
<nav class="nav-extended">
<div class="nav-wrapper">
<a href="#" class="brand-logo" style="margin-left: 2em;margin-top: 10px;">Video<b>fy</b></a>
<form method="POST">
<input type="text" name="url" placeholder="Link" style="background-color: white;color: black;margin-top: 20px;margin-left: 12em;width: 25em;font-size: 1.5em;padding-left: 10px;border-radius: 5px">
<a href="#" class="brand-logo" style="margin-left: 3em;margin-top: 10px;font-size: 1.5em">Made for <b>#Wittyhacks </b></a>
<img src="https://cdn.wittyfeed.com/assets_main_new/images/wittyfeed_new_update.svg" class="logo_new" alt="wittyfeed-beyond-stories" style="margin-left: 26.5em;width: 100px">
</form>
</div>
</nav>
<div style="background-color: #eeeeee ;
margin-left:0;margin:2.5em;
float: left;width: 60%;
padding: 5px;
margin-bottom: 20px;
box-shadow: 1px 2px 20px grey">
<video id="video1" width="770" height="405" controls >
<source src="test.mp4" type="video/mp4">
<source src="test.ogg" type="video/ogg">
</video>
</div>
<form action="" method="POST">
<div style="background-color: #f0f0f0;
margin-top:2.5em;
margin-right: 2.5em;
width: 31%;
float: right;
box-shadow: 1px 2px 20px grey;
height: 525px">
<div style="margin-left: 9em;
font-size: 1.2em;
font-style: bold
padding-top:2em">
<p ><b>Frame No.</b></p>
</div>
<div style="
float: right;
overflow-y: auto;
padding: 1.5em;
height: 490px;">
<?php edit_box();?>
</div>
<div>
<!-- <button id="edit" name="edit"></button> -->
<button class="waves-effect waves-light btn" id="edit" name="edit" type="submit" style="width: 100%"><i class="material-icons right"></i>Edit video</button>
</div>
</div>
</form>
<u><a href="<?php echo $resultData[1]; ?>" style="
font-size: 1.5em;
margin-left: 1.5em;
color: grey;
margin-bottom:1em;"><?php echo $resultData[2]; ?></a></u>
<div style="background-color: #eeeeee ;
margin-left:0;margin:2.5em;
margin-top: 20px;
float: left;width: 60%;
padding: 5px;
box-shadow: 1px 2px 20px grey">
<a class="waves-effect waves-light btn" href="test.mp4"><i class="material-icons right">file_download</i>Download</a>
<a class="waves-effect waves-light btn" style="background-color: #3b5998"><i class="material-icons right">share</i>facebook</a>
<ul class="collection with-header" style="margin: 0;margin-top: 5px">
<li class="collection-header"><h5 style="margin:0">Transcript</h5></li>
<li class="collection-item"><?php transcript();?></li>
</ul>
</div>
</body>
</html>
<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 560;
}
function makeSmall() {
myVideo.width = 320;
}
function makeNormal() {
myVideo.width = 420;
}
</script>
<style type="text/css">
.edit{
background-color: #fafafa;
height: 5em;
margin-bottom: .5em;
border: 1px solid #616161;
border-radius: 0;
outline: none;
height: 5rem;
width: 100%;
font-size: 1rem;
color: grey;
margin: 0 0 20px 0;
box-shadow: 1px 2px 10px grey;
}
</style>