Browse Source

compare the md5 hash

master
Chris 3 years ago
parent
commit
46ee658a90
  1. 21
      getPreview.php

21
getPreview.php

@ -81,11 +81,13 @@ function getFullNumberString($number)
return $number;
}
$imageDataHash = "";
while(true)
{
$streamInfo = getStreamInfo($globalData['Channel']);
$previewURL = getPreviewURL($streamInfo, "1920", "1080");
$streamInfo = getStreamInfo($globalData['Channel']);
$previewURL = getPreviewURL($streamInfo, "1920", "1080");
if($previewURL == "")
{
print_r($globalData);
@ -94,13 +96,20 @@ while(true)
echo "URL == ".$previewURL."\n";
die("fatal error");
}
$imageFileName = $globalData['Folder'].getFullNumberString((getFileCountInFolder() + 1)).".".getFileExtention($previewURL);
echo "Copy preview url '".$previewURL."' to '".$imageFileName."' ...";
file_put_contents($imageFileName, file_get_contents($previewURL, false, $globalData['sslContext']));
echo "done\n";
$imageRawData = file_get_contents($previewURL, false, $globalData['sslContext']);
if(md5($imageRawData) != $imageDataHash)
{
file_put_contents($imageFileName, $imageRawData);
echo "done\n";
}else{
echo "canceled\n";
}
$imageRawData = "";
system("ffmpeg -f image2 -framerate 3 -i /data/images/%07d.jpg -r 25 -vcodec libx264 -y /data/images/video.mp4");

Loading…
Cancel
Save