-
Notifications
You must be signed in to change notification settings - Fork 975
/
Copy pathunfinishLives.php
116 lines (105 loc) · 3.87 KB
/
unfinishLives.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
<?php
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
AVideoPlugin::loadPlugin('Live');
error_reporting(E_ALL);
ini_set('display_errors', 1);
/*
$rows = Live_servers::getAllActive();
foreach ($rows as $liveS) {
echo "id= {$liveS['id']}".PHP_EOL;
$lives = LiveTransmitionHistory::getActiveLives($liveS['id'], true);
foreach ($lives as $live) {
echo "key ={$live['key']}".PHP_EOL;
$found = false;
foreach ($stats as $liveFromStats) {
echo "compare ={$liveFromStats['key']} == {$live['key']}".PHP_EOL;
if (!empty($liveFromStats['key']) && $liveFromStats['key'] == $live['key'] ) {
$found = true;
break;
}
}
if(!$found){
LiveTransmitionHistory::finishFromTransmitionHistoryId($live['id']);
}
}
}
$stats = Live::getStatsApplications(true);
foreach ($stats as $key => $live) {
if (!empty($live['key'])) {
echo "key= {$live['key']}".PHP_EOL;
$row = LiveTransmitionHistory::getLatest($live['key'], $live['live_servers_id']);
echo "id={$row['id']} finished= {$row['finished']}".PHP_EOL;
if (!empty($row['finished'])) {
LiveTransmitionHistory::unfinishFromTransmitionHistoryId($row['id']);
var_dump($resp, $unfinishFromTransmitionHistoryIdSQL);
echo "id={$row['id']} unfinished".PHP_EOL;
}else{
$row = LiveTransmition::keyExists($live['key']);
if(!empty($row)){
$lth = new LiveTransmitionHistory();
$lth->setTitle($row['title']);
$lth->setDescription($row['description']);
$lth->setKey($live['key']);
$lth->setUsers_id($row['users_id']);
$lth->setLive_servers_id($live['live_servers_id']);
$id = $lth->save();
echo ("unfinishAllFromStats saving LiveTransmitionHistory [{$id}]").PHP_EOL;
echo "not empty id={$row['id']}".PHP_EOL;
}else{
}
}
}
}
Live::finishAllFromStats();
Live::unfinishAllFromStats(true);
*/
error_reporting(E_ALL);
ini_set('display_errors', 1);
$stats = Live::getStats(1);
foreach ($stats as $key => $server) {
if (is_array($server) || is_object($server)) {
foreach ($server as $key2 => $live) {
if (!empty($live->key)) {
echo __LINE__ . " {$live->key} ".PHP_EOL;
} else if (!empty($live['key'])) {
echo __LINE__ . " {$live['key']} ".PHP_EOL;
} else {
if ($key2 == 'applications' && is_array($live)) {
foreach ($live as $key3 => $value3) {
var_dump($value3);
}
}
}
}
}
}
$stats = Live::getStatsApplications(1);
foreach ($stats as $key => $live) {
if (!empty($live['key'])) {
echo __LINE__ . " {$live['key']} ".PHP_EOL;
if (!empty($row['finished'])) {
echo __LINE__ . " {$live['key']} ".PHP_EOL;
}else{
$row = LiveTransmition::keyExists($live['key']);
if(!empty($row)){
echo __LINE__ . " {$live['key']} ".PHP_EOL;
$lth = new LiveTransmitionHistory();
$lth->setTitle($row['title']);
$lth->setDescription($row['description']);
$lth->setKey($live['key']);
$lth->setUsers_id($row['users_id']);
$lth->setLive_servers_id($live['live_servers_id']);
$id = $lth->save();
echo ("unfinishAllFromStats saving LiveTransmitionHistory {$live['key']} [{$id}]".PHP_EOL);
}else{
echo __LINE__ . " {$live['key']} ".PHP_EOL;
}
}
}else{
var_dump($live);
}
}