Skip to content

Commit

Permalink
fixed add the camera(s) from the list view
Browse files Browse the repository at this point in the history
  • Loading branch information
divsbhalala authored and curtishall committed Apr 3, 2023
1 parent ecb40fe commit 854fcc2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion www/lib/lib.php
Expand Up @@ -862,7 +862,12 @@ public static function create($rawData){
#if errors were detected -- return error
if (!$data[0]) { return $data; } else { $data = $data[1]; };
#if there were no errors, add the camera
$result = data::query("INSERT INTO Devices (device_name, protocol, device, driver, rtsp_username, rtsp_password, resolutionX, resolutionY, mjpeg_path, model, rtsp_rtp_prefer_tcp, onvif_port, substream_path, hls_window_size, hls_segment_size, hls_segment_duration) VALUES ('{$data['device_name']}', '{$data['protocol']}', '{$data['device']}', '{$data['driver']}', '{$data['rtsp_username']}', '{$data['rtsp_password']}', 640, 480, '{$data['mjpeg_path']}', '{$data['model']}', {$data['rtsp_rtp_prefer_tcp']}, {$data['onvif_port']},'{$data['substream_path']}', {$data['hls_window_size']}, {$data['hls_segment_size']}, {$data['hls_segment_duration']})", true);

$hls_segment_size = $data['hls_segment_size'] ? $data['hls_segment_size'] : 0;
$hls_segment_duration = $data['hls_segment_duration'] ? $data['hls_segment_duration'] : 0;
$inputQuery = "INSERT INTO Devices (device_name, protocol, device, driver, rtsp_username, rtsp_password, resolutionX, resolutionY, mjpeg_path, model, rtsp_rtp_prefer_tcp, onvif_port, substream_path, hls_window_size, hls_segment_size, hls_segment_duration) VALUES ('{$data['device_name']}', '{$data['protocol']}', '{$data['device']}', '{$data['driver']}', '{$data['rtsp_username']}', '{$data['rtsp_password']}', 640, 480, '{$data['mjpeg_path']}', '{$data['model']}', {$data['rtsp_rtp_prefer_tcp']}, {$data['onvif_port']},'{$data['substream_path']}', {$data['hls_window_size']}, {$hls_segment_size}, {$hls_segment_duration})";

$result = data::query($inputQuery, true);
#try to automatically set the camera up
$message = ($result) ? AIP_CAMADDED : false;
if ($result)
Expand Down

0 comments on commit 854fcc2

Please sign in to comment.