49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
$DATA = array();
|
|
|
|
$DATA['AssetServer'] = "http://127.0.0.1:8002/";
|
|
|
|
function getAssetData($assetServer, $assetUUID)
|
|
{
|
|
global $DATA;
|
|
@chdir("/var/www/html");
|
|
|
|
if(!is_file('./data/'.$assetUUID.'.png'))
|
|
{
|
|
if(is_file("/usr/bin/wget"))
|
|
$DATA['WGETCMD'] = '/usr/bin/wget '.$assetServer.'/assets/'.$assetUUID.'/data -O '.$assetUUID;
|
|
|
|
if(is_file("/usr/bin/ffmpeg"))
|
|
$DATA['MPEGCMD'] = '/usr/bin/ffmpeg -i '.$assetUUID.' ./data/'.$assetUUID.'.png';
|
|
|
|
if(is_file("wget.exe"))
|
|
$DATA['WGETCMD'] = 'wget.exe '.$assetServer.'/assets/'.$assetUUID.'/data -O '.$assetUUID;
|
|
|
|
if(is_file("ffmpeg.exe"))
|
|
$DATA['MPEGCMD'] = 'ffmpeg.exe -i '.$assetUUID.' ./data/'.$assetUUID.'.png';
|
|
|
|
$DATA['WGET'] = shell_exec($DATA['WGETCMD']);
|
|
$DATA['FFMPEG'] = shell_exec($DATA['MPEGCMD']);
|
|
|
|
unlink($assetUUID);
|
|
}
|
|
|
|
return $assetUUID.'.png';
|
|
}
|
|
|
|
if(@$_REQUEST['AssetID'] == "")
|
|
die("Need AssetID");
|
|
|
|
if($_REQUEST['AssetServer'] != "")
|
|
$DATA['AssetServer'] = $_REQUEST['AssetServer'];
|
|
|
|
if(!is_dir("data"))
|
|
mkdir("data", 0777);
|
|
|
|
$DATA['AssetPath'] = getAssetData($DATA['AssetServer'], $_REQUEST['AssetID']);
|
|
|
|
header("Location: data/".$DATA['AssetPath']);
|
|
exit;
|
|
?>
|
|
|