-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmedia_info.php
136 lines (99 loc) · 3.26 KB
/
media_info.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
<?php
require_once '../config.php';
$action = (string)$_GET['action'];
if (!$action) {
$action = (string)$_POST['action'];
if (!$action) {
$action = 'all';
}
}
if ($action == "all") {
///////////////////////////////////
$contents = file_get_contents('https://login:[email protected]/flussonic/api/playlist/playlist1');
if (!empty($contents))
{
$output = "";
$data = $contents;
$info = json_decode($contents);
$name = $info->current_entry;
$namecheck = substr($name,strrpos($name,"/")+1);
$fullname = substr($name,strrpos($name,"/")+1);
$string = explode('/', $name);
$checkedline = $string[1];
$lines = file('https://subty.ru/shed/playlist.txt');
$timezone = date_default_timezone_get();
//echo "The current server timezone is: " . $timezone."<br>";
$t=time();
//echo("Linux timestamp: ".$t . "<br>");
//echo "Realtime: ".(date("H:i:s",$t));
//echo "<br>Current data: ".$checkedline;
$sql3 = "SELECT * FROM media WHERE onair = '1' ORDER BY media_order DESC LIMIT 1";
$result3 = mysqli_query($link, $sql3) or die(mysql_error());
$row3 = mysqli_fetch_assoc($result3);
$marked_id = $row3['id'];
$marked = $row3['marked'];
//echo "<br>Last media in list as marked: ".$row3['name']."(ID:".$marked_id."), Marked as: ".$row3['marked'];
/*$output = "<table class=\"table\">
<thead>
<tr>
<th>TIMELINE#</th>
<th>Name</th>
</tr>
</thead>
<tbody>
";
*/
$sql = "SELECT * FROM media WHERE onair = '1' ORDER BY media_order ASC";
if($result = mysqli_query($link, $sql)){
foreach ($lines as $line_num => $line)
{
while ($row = mysqli_fetch_array($result))
{
$id = $row['id'];
$nameline = $row['name'];
$fname = $row['fname'];
$onair = $row['onair'];
$duration = gmdate("H:i:s", $row['duration']);
$rowcalc += $row['duration'];
$ended_time = $row['e_time'];
//$ended_time_check += $ended_time;
$startup_time = $row['s_time'];
$human_ended_time = date("H:i:s", $ended_time);
$human_startup_time = date("H:i:s", $startup_time);
//$calc = $duration + ;
$estimate = ($t-$startup_time) / ($ended_time-$startup_time) * 100;
$estimate = round($estimate);
similar_text($checkedline, $nameline, $percent);
if ($percent > 99)
{
// $output .= "<tr class=\"info\">
// <td>".$extinfo." | Duration: ".$duration." [Startup at: ".$human_startup_time." End at: ".$human_ended_time."]";
// $output .= "</td><td>";
//$output .= "<span class=\"label label-success\">ON AIR NOW</span> <b>(ID: ". $id .")". $percent . "". $fname . "</b>";
$output .= "<span class=\"label label-success\">Сейчас: </span> <b>". $fname . "</b>";
$output .="<div class=\"progress\">
<div class=\"progress-bar progress-bar-success\" role=\"progressbar\" aria-valuenow=\"".$estimate."\"
aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:".$estimate."%\">
".$estimate."% Complete
</div>
</div>";
//$output .= "</td><td></td>
//</tr>";
}
else
{
$output .= "";
}
}
/* }*/
}
// echo "<br />Checked: $checked";
mysql_data_seek($sql,0); // <=== Set the resultsets internal pointer back to zero (the first record).
}
//$output .= "</tbody></table>";
//$output .= "<br><a href=\"?action=save\" style=\"color:#999\">Recalculate all timestamp and restart stream</a>";
echo $output;
}
/////////////////////
}
?>