Browse Source
Some working version (internal demo)
Some working version (internal demo)
18 changed files with 899 additions and 43 deletions
-
6lib/controller/doSessionOperations.php
-
55lib/controller/getComposedVideo.php
-
106lib/controller/getComposerStatus.php
-
6lib/controller/getMonitoringPlatformView.php
-
8lib/controller/getMonitoringSessionView.php
-
8lib/controller/getMonitoringTrackView.php
-
72lib/controller/getSessionData.php
-
50lib/controller/getVideoSegment.php
-
4lib/controller/validateUserSession.php
-
3lib/javascript/jsapi_dynamic/argus_global_vars.js
-
32lib/javascript/jsapi_dynamic/argus_main.js
-
66lib/javascript/jsapi_dynamic/argus_monitoring.js
-
425lib/javascript/jsapi_dynamic/argus_reports.js
-
32lib/php/argus/templates.php
-
31lib/upgrade_database.php
-
BINstyle/assets/lside.png
-
BINstyle/assets/rside.png
-
38style/style.css
@ -0,0 +1,55 @@ |
|||
<?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.");
|
|||
//};
|
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,106 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/argus/server.php'); |
|||
ob_start(); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Data['status'] = 'error'; |
|||
if( isset( $_POST['SESSION'] ) ) $SESID = intval( $_POST['SESSION'] ); else $SESID = 0; |
|||
if( $SESID ){ |
|||
$QS = "SELECT * FROM `sessions` WHERE `id`={$SESID}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
if( count( $RR ) ){ |
|||
$SD = $RR[0]; |
|||
$Data['ses_status']=intval( $SD['status'] ); |
|||
$Data['start_ts'] = intval( $SD['ts'] ) * 1000 + intval( $SD['ts_ms'] ); |
|||
$Data['track_id'] = intval( $SD['track_id'] ); |
|||
$QS = "SELECT * FROM `metro_tracks` WHERE `id`={$Data['track_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$TRD = $RR[0]; |
|||
if( $TRD['side'] == 'U' ){ |
|||
$Data['r_module_id'] = intval( $TRD['near_module_id'] ); |
|||
$Data['l_module_id'] = intval( $TRD['far_module_id'] ); |
|||
} else { |
|||
$Data['r_module_id'] = intval( $TRD['far_module_id'] ); |
|||
$Data['l_module_id'] = intval( $TRD['near_module_id'] ); |
|||
}; |
|||
$QS = "SELECT `layout` FROM `metro_platforms` WHERE `id`={$TRD['platform_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$Data['layout'] = $RR[0]['layout']; |
|||
//Get Names
|
|||
$QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$Data['l_module_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$Data['l_module_name'] = $RR[0]['name']; |
|||
$QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$Data['r_module_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$Data['r_module_name'] = $RR[0]['name']; |
|||
|
|||
$QS = "SELECT * FROM `media_composer_queue` WHERE `session_id`={$SESID}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
if( count( $RR ) ){ |
|||
$Data['composed_video'] = true; |
|||
$Data['composed_video_progress'] = intval( $RR[0]['process'] ) ; |
|||
if( $Data['composed_video_progress'] < 255 ){ |
|||
$Data['composed_video_status'] = 'W'; |
|||
} else { |
|||
$Data['composed_video_status'] = 'D'; |
|||
$Data['composed_left_video_exists'] = file_exists('data/composed_videos/' . $RR[0]['uuid'].'_L.mp4' ); |
|||
if( $Data['composed_left_video_exists'] ){ |
|||
$CMD = "ffprobe -hide_banner ./data/composed_videos/{$RR[0]['uuid']}_L.mp4 2>&1"; |
|||
$Zaza = `$CMD`; |
|||
$TA = explode( "\n", $Zaza ); |
|||
$Data['composed_left_info'] = array(); |
|||
$Data['composed_left_info']['file_size']= sprintf("%.2f Mb",filesize("./data/composed_videos/{$RR[0]['uuid']}_L.mp4")/1048576.0 ); |
|||
foreach( $TA as $A ){ |
|||
if( stripos( $A, "Duration:" ) !== false ){ |
|||
$YY = explode( "Duration:", $A ); |
|||
$JJ = explode( ",", $YY[1] ); |
|||
$Data['composed_left_info']['duration'] = trim( $JJ[0] ); |
|||
}; |
|||
if( stripos( $A, "Video:" ) !== false ){ |
|||
$YY = explode( "Video:", $A ); |
|||
$JJ = explode( ",", $YY[1] ); |
|||
$Data['composed_left_info']['codec']= trim( $JJ[0] ); |
|||
$Data['composed_left_info']['pic_size']= trim( $JJ[2] ); |
|||
$Data['composed_left_info']['bitrate']= trim( $JJ[3] ); |
|||
$Data['composed_left_info']['fps']= trim( $JJ[4] ); |
|||
}; |
|||
}; |
|||
}; |
|||
$Data['composed_right_video_exists'] = file_exists('data/composed_videos/' . $RR[0]['uuid'].'_R.mp4' ); |
|||
if( $Data['composed_right_video_exists'] ){ |
|||
$CMD = "ffprobe -hide_banner ./data/composed_videos/{$RR[0]['uuid']}_R.mp4 2>&1"; |
|||
$Zaza = `$CMD`; |
|||
$TA = explode( "\n", $Zaza ); |
|||
$Data['composed_right_info'] = array(); |
|||
$Data['composed_right_info']['file_size']= sprintf("%.2f Mb",filesize("./data/composed_videos/{$RR[0]['uuid']}_R.mp4")/1048576.0 ); |
|||
foreach( $TA as $A ){ |
|||
if( stripos( $A, "Duration:" ) !== false ){ |
|||
$YY = explode( "Duration:", $A ); |
|||
$JJ = explode( ",", $YY[1] ); |
|||
$Data['composed_right_info']['duration'] = trim( $JJ[0] ); |
|||
}; |
|||
if( stripos( $A, "Video:" ) !== false ){ |
|||
$YY = explode( "Video:", $A ); |
|||
$JJ = explode( ",", $YY[1] ); |
|||
$Data['composed_right_info']['codec']= trim( $JJ[0] ); |
|||
$Data['composed_right_info']['pic_size']= trim( $JJ[2] ); |
|||
$Data['composed_right_info']['bitrate']= trim( $JJ[3] ); |
|||
$Data['composed_right_info']['fps']= trim( $JJ[4] ); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
$Data['status'] = 'ok'; |
|||
} else { |
|||
$Data['err_msg'] = 'No Composer Record!'; |
|||
}; |
|||
} else $Data['err_msg'] = 'Session ID is Wrong!'; |
|||
} else $Data['err_msg'] = 'No Session ID provided!'; |
|||
$Data['messages'] = ob_get_clean(); |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,50 @@ |
|||
<?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['VID'] ) ) $VID = intval( $_GET['VID'] ); else $VID = 0; |
|||
if( $SESID ){ |
|||
$QS = "SELECT * FROM `sessions` WHERE `id`={$SESID}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
if( count( $RR ) ){ |
|||
$SD = $RR[0]; |
|||
$Data['basepath'] = '/lib/controller/data/reports/'.$SD['track_id'].'/'.date("Y/m/d",intval( $SD['ts'] )); |
|||
if( file_exists( $SYSPath . $Data['basepath'] )){ |
|||
$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 = $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."); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
?>
|
|||
Binary file not shown.
|
After Width: 64 | Height: 27 | Size: 3.0 KiB |
Binary file not shown.
|
After Width: 64 | Height: 27 | Size: 3.0 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue