Browse Source

split days

master
Chris 3 years ago
parent
commit
5bec7bae6e
  1. 13
      getPreview.php

13
getPreview.php

@ -2,6 +2,7 @@
$globalData['ClientID'] = "";
$globalData['Channel'] = "";
$globalData['Folder'] = "./images/";
$globalData['DayString'] = date("Ydm");
if (isset($argv[1]))
$globalData['ClientID'] = @$argv[1];
@ -46,9 +47,12 @@ function getFileCountInFolder()
if (!file_exists($globalData['Folder']))
mkdir($globalData['Folder'] , 0777, true);
if (!file_exists($globalData['Folder'].$globalData['DayString']."/"))
mkdir($globalData['Folder'].$globalData['DayString']."/", 0777, true);
$files = array();
if ($handle = opendir($globalData['Folder'])) {
if ($handle = opendir($globalData['Folder'].$globalData['DayString']."/")) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..")
{
@ -85,6 +89,7 @@ $imageDataHash = "";
while(true)
{
$streamInfo = getStreamInfo($globalData['Channel']);
$previewURL = getPreviewURL($streamInfo, "1920", "1080");
@ -97,7 +102,9 @@ while(true)
die("fatal error");
}
$imageFileName = $globalData['Folder'].getFullNumberString((getFileCountInFolder() + 1)).".".getFileExtention($previewURL);
$currentDayString =
$imageFileName = $globalData['Folder'].$globalData['DayString']."/".getFullNumberString((getFileCountInFolder() + 1)).".".getFileExtention($previewURL);
echo "Copy preview url '".$previewURL."' to '".$imageFileName."' ...";
@ -113,7 +120,7 @@ while(true)
}
$imageRawData = "";
system("ffmpeg -f image2 -framerate 3 -i /data/images/%07d.jpg -r 25 -vcodec libx264 -y /data/images/video.mp4");
system("ffmpeg -f image2 -framerate 3 -i /data/images/".$globalData['DayString']."/%07d.jpg -r 25 -vcodec libx264 -y /data/images/".$globalData['DayString'].".mp4");
sleep(180);
}
Loading…
Cancel
Save