Commit ac64468a authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Update the list of partitions in camogmgui

parent 0faa9606
Loading
Loading
Loading
Loading
+39 −11
Original line number Diff line number Diff line
// store path to partition that camogm is currently using
var rawdev_path = "";
// shows if partition selection should be updated
var update_dev_radio = false;

function timer_functions(){
    list_files(getCookie("current_dir"));
    update_state();
@@ -22,8 +27,12 @@ function init() {
	update_audio_form(document.getElementById("audioform"));
	calc_split_size();
	//calling "is_mounted" at response
        scan_devices("is_mounted(selected_device)");
	//global_timer = setInterval(timer_functions,2000);
	if (document.getElementById('fast_rec').checked) {
		makeRequest('camogm_interface.php', '?cmd=list_raw_devices');
	} else {
		scan_devices("is_mounted(selected_device)");
	}
}
function reload() {
	makeRequest('camogm_interface.php', '?cmd=run_camogm');
@@ -104,8 +113,10 @@ function process_is_hdd_mounted(xmldoc) {

//scan_devices() - fills the device list.
function scan_devices(callback) {
	if (document.getElementById('fast_rec').checked == false) {
		makeRequest('camogm_interface.php','?cmd=listdevices',callback);
	}
}

var devices = Array();
var selected_device = "";
@@ -425,6 +436,18 @@ function process_recording(xmldoc) {
	
	if (xmldoc.getElementsByTagName('buffer_overruns')[0].firstChild.data > 0)
		alert ("Buffer overrun! current datarate exceeds max. write rate")

	// update partition selection
	if (update_dev_radio) {
		var radios = document.getElementsByName('rawdev_path');
		rawdev_path = xmldoc.getElementsByTagName('raw_device_path')[0].firstChild.data;
		for (var i = 0; i < radios.length; i++) {
			if (rawdev_path == '"' + radios[i].value + '"') {
				radios[i].checked = true;
			}
		}
		update_dev_radio = false;
	}
}
recording = false;
function update_state() {
@@ -807,7 +830,6 @@ function process_raw_dev_list(xmldoc)
			"<td></td><td>" + size.firstChild.nodeValue + " GB" + "</td>" +
			"<td></td><td></td></tr>";
		}

		content += "</table>";
	} else {
		content += "<p class=\"alert\">Device partitions without file system are not found. Fast recording can not be started. " +
@@ -815,4 +837,10 @@ function process_raw_dev_list(xmldoc)
		document.getElementById('submit_button').disabled = true;
	}
	document.getElementById('ajax_devices').innerHTML = content;
	
	// get current partition if we have more than one available and update selection
	if (items.length > 1) {
		update_dev_radio = true;
		makeRequest('camogm_interface.php', '?cmd=status');
	}
}
+38 −17
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@
	 	
	// format tab submit
	if (isset($_POST['settings_format'])){
		if (!isset($_POST['fastrec_checkbox'])) {
			switch($_POST['container']){
				case'ogm':
					$container = $_POST['container'];
@@ -131,14 +132,23 @@
					$container = "mov";
					break;
			}
			$rawdev_path = "";
			$prefix = $_POST['prefix'];
		} else {
			// fast recording supports jpeg format only
			$container = "jpeg";
			$rawdev_path = $_POST['rawdev_path'];
			$prefix = "";			
		}
		if ($camogm_running) {
			// set format
			fprintf($fcmd, "format=%s;\n", $container);

			// set record directory
			$prefix = $_POST['prefix'];
			if ($prefix != "") {
				fprintf($fcmd, "prefix=%s;\n", $prefix);
				setcookie("directory", $prefix); // save as cookie so we can get prefered record directory even after camera reboot
			}
			
			//set debug file
			$debug = $_POST['debug'];
@@ -150,6 +160,11 @@
			}	
			else	
				fprintf($fcmd, "debug;\ndebuglev=1;\n");
			
			if ($rawdev_path != "")
				fprintf($fcmd, "rawdev_path=%s;\n", $rawdev_path);
			else
				fprintf($fcmd, "rawdev_path;\n");
		}
	}
	
@@ -262,6 +277,7 @@
		$xml_frame_number = substr($logdata[0]['frame_number'], 0, strlen($logdata[0]['frame_number']));
		$xml_res_x = substr($logdata[0]['frame_width'], 0, strlen($logdata[0]['frame_width']));
		$xml_res_y = substr($logdata[0]['frame_height'], 0, strlen($logdata[0]['frame_height']));
		$xml_rawdev_path = substr($logdata[0]['raw_device_path'], 1, strlen($logdata[0]['raw_device_path']) - 2);
		
		// Advanced Settings
		$xml_timescale = substr($logdata[0]['timescale'], 0, strlen($logdata[0]['timescale']));
@@ -572,8 +588,13 @@
                    	echo "<input type=\"radio\" id=\"radioJpg\" style=\"top:3px; position:relative;\" name=\"container\" value=\"jpg\" onChange=\"format_changed(this);\" checked> JPEG Sequence<br />";
                    else
                    	echo "<input type=\"radio\" id=\"radioJpg\" style=\"top:3px; position:relative;\" name=\"container\" value=\"jpg\" onChange=\"format_changed(this);\"> JPEG Sequence<br />";
                    if ($xml_rawdev_path != "") {
                    	$fastrec_checked = "checked=\"checked\"";
                    } else {
                    	$fastrec_checked = "";
                    }
                    ?>
                    <input id="fast_rec" type="checkbox" style="left:1px; top:3px; position:relative;" name="fastrec_checkbox" value="checked" onChange="fast_rec_changed(this)"> Use fast recording 
                    <input id="fast_rec" type="checkbox" style="left:1px; top:3px; position:relative;" name="fastrec_checkbox" value="checked" onChange="fast_rec_changed(this)" <?php echo $fastrec_checked; ?>> Use fast recording 
                    <a href="#" onClick="help('fast_rec');"><img src="images/help.png"></a><br />
                    <br />