You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
2.5 KiB

<?php
require_once('../ajax_asm.php');
require_once('../php/argus/server.php');
$UID = intval( $CUser->Data['id'] );
$ACCESS = intval( $CUser->Data['access'] );
if( $CUser->Data['id'] > 1 ){
if( isset( $_GET['SESSION'] ) ) $SESID = intval( $_GET['SESSION'] ); else $SESID = 0;
if( isset( $_GET['SIDE'] ) ) $SIDE = $_GET['SIDE']; else $SIDE = 'L';
if( $SESID ){
$QS = "SELECT * FROM `media_composer_queue` WHERE `session_id`={$SESID}";
$RR = $DATABASE->Query( $QS );
if( count( $RR ) ){
$SD = $RR[0];
if( $SIDE == 'L' ){
$Data['basepath'] = '/lib/controller/data/composed_videos/'.$SD['uuid'].'_L.mp4';
} else {
$Data['basepath'] = '/lib/controller/data/composed_videos/'.$SD['uuid'].'_R.mp4';
}
$filePath = $SYSPath . $Data['basepath'];
if( file_exists( $filePath )){
//$DBN = $SYSPath . $Data['basepath'] .'/report.db';
//echo $DBN;
//if( !file_exists( $DBN )) echo "Not Exist!!";
//$RBASE = new SQLite_DB( $DBN );
//$QS = "SELECT * FROM `videos` WHERE `session_id`={$SESID} AND `id`={$VID}";
//$RR = $RBASE->Query( $QS );
//$CR = $RR[0];
//$NAME = $CR['uuid'] . '.'. $CR['ext'];
//$filePath = $SYSPath . $Data['basepath'] . '/' . $NAME;
//if( file_exists($filePath) ){
//$QS = "SELECT `ms`.`short`, `mp`.`level`, `mt`.`short` as `tshort` FROM ( `metro_tracks` `mt` LEFT JOIN `metro_platforms` `mp` ON ( `mt`.`platform_id`=`mp`.`id`) ) LEFT JOIN `metro_stations` `ms` ON ( `mp`.`station_id` = `ms`.`id` ) WHERE `mt`.`id`={$SD['track_id']}";
//$RR = $DATABASE->Query( $QS );
$downloadName = 'some_name_that_must_be_corrected.mp4';//$RR[0]['short'].'_'.$RR[0]['level'].'_'.$RR[0]['tshort'].'_'.date("Y-m-d_H.i.s", $CR['ts'] ).'.'. $CR['ext'];
// 1. Clear any previous output buffers
if (ob_get_level()) {
ob_end_clean();
}
// 2. Set the content type (e.g., application/pdf, image/jpeg, or application/octet-stream)
header('Content-Type: application/octet-stream');
// 3. Force download and define the file name
header('Content-Disposition: attachment; filename="' . $downloadName. '"');
// 4. Provide the exact file size to show download progress
header('Content-Length: ' . filesize($filePath));
// 5. Read the file and write it directly to the output buffer
readfile($filePath);
exit;
//} else {
// die("Error: The requested file does not exist.");
//};
};
};
};
};
?>