Web Interface For Lite Argus Control modules
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.

62 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. //require_once('../php/onvif/toto.php');
  4. if( $CUser->Data['id'] > 1 ){
  5. if( isset( $_POST['cam_sources'] ) ){
  6. if( $_POST['cam_sources'] == 'ipv' ){
  7. $QS = "SELECT * FROM `cameras` WHERE `node_id`=0";
  8. $Result = $DATABASE->Query($QS,false);
  9. foreach( $Result as $CD ){
  10. $cnode['id'] = $CD['id'];
  11. $cnode['status'] = $CD['status'];
  12. $cnode['login'] = $CD['access_login'];
  13. $cnode['password']= $CD['access_pass'];
  14. $cnode['name'] = urldecode($CD['name']);
  15. $cnode['hardware']= urldecode($CD['hardware']);
  16. $cnode['caps'] = 'IP';
  17. $cnode['ip'] = $CD['ip'];
  18. $cnode['mac'] = $CD['mac'];
  19. $cnode['ena'] = 1;
  20. $Data['nodes'][] = $cnode;
  21. };
  22. } else {
  23. // Update Current Analog Sources
  24. $CDATA = `v4l2-ctl --list-devices`;
  25. $LU = explode( "\n", $CDATA );
  26. $CDEVS = array();
  27. foreach( $LU as $U ){
  28. $CL = trim( $U );
  29. if( substr( $CL, 0, 10 ) == '/dev/video' ){
  30. $CN = getV4L2DeviceName( $CL );
  31. $RR = array( 'name'=>$CN, 'mrl'=>$CL );
  32. $QS = "SELECT * FROM `media_streams` WHERE `source_type`='A' AND `mrl`='{$CL}'";
  33. $KO = $DATABASE->Query( $QS );
  34. if( count( $KO ) == 0 ){
  35. $CDEVS[] = $RR;
  36. //$QS = "INSERT INTO `media_streams`(
  37. };
  38. };
  39. };
  40. $QS = "SELECT `ms`.* , `re`.`node_id` FROM `media_streams` `ms` LEFT JOIN `resources` `re` ON ( `re`.`aux_id` = `ms`.`id` ) WHERE `ms`.`source_type`='A' AND `ms`.`source_id`=0";
  41. $Result = $DATABASE->Query($QS,false);
  42. foreach( $Result as $CD ){
  43. $cnode['id'] = $CD['id'];
  44. $cnode['server'] = getServerID( $CD['node_id'] );//'local';
  45. $T = getV4L2DeviceName($CD['mrl']);
  46. $cnode['name'] = $T['name'];
  47. $cnode['hardware']= $T['dev'];
  48. $cnode['caps'] = 'Analog';
  49. $cnode['ip'] = '['.$CD['img_width'] .'x' . $CD['img_height'] .']';
  50. $cnode['mac'] = $CD['mrl'];
  51. if( $T['dev']=='unknown') $cnode['ena'] = 0; else $cnode['ena'] = 1;
  52. $Data['nodes'][] = $cnode;
  53. };
  54. };
  55. echo json_encode( $Data );
  56. } else {
  57. header('location: /');
  58. };
  59. } else {
  60. header('location: /');
  61. };
  62. ?>