1
0
Fork 0

add ebug messages

This commit is contained in:
Christopher Latza 2020-06-07 18:29:04 +02:00
parent e9d010fcd8
commit 103f73adbb
1 changed files with 10 additions and 1 deletions

View File

@ -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);
}
}