add ebug messages
This commit is contained in:
parent
e9d010fcd8
commit
103f73adbb
11
start.php
11
start.php
|
@ -1,14 +1,18 @@
|
|||
<?php
|
||||
include "config.php";
|
||||
|
||||
echo "StreamURL: ".$StreamURL."\n";
|
||||
echo "DiscordWebhook: ".$DiscordWebhook."\n";
|
||||
|
||||
$lastOnlineTime = time();
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
if(($lastOnlineTime + 500) < time())
|
||||
if(($lastOnlineTime + 30) < time())
|
||||
{
|
||||
$fileName = "output-".time().".jpg";
|
||||
|
||||
echo "Checking stream and creating image...\n";
|
||||
system("ffmpeg -i ".$StreamURL." -vframes 1 -q:v 2 -vf scale=535:346 ".$fileName);
|
||||
|
||||
if(is_file($fileName))
|
||||
|
@ -31,9 +35,14 @@ while(TRUE)
|
|||
]
|
||||
];
|
||||
|
||||
echo "Sending info to discord.\n";
|
||||
$result = file_get_contents($DiscordWebhook, false, stream_context_create($options));
|
||||
}else{
|
||||
echo "ERROR: Image not generated!\n";
|
||||
}
|
||||
}else{
|
||||
echo "Stream is online but the timeout is not yet over!\n";
|
||||
$lastOnlineTime = time();
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue