/dev/null 2>&1 &'); } } if(isset($_GET["ice_pwd"])) { $ice_pwd = $_GET["ice_pwd"]; if(strcmp($ice_pwd,$config['ICE_PWD']) !== 0) { $contents = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents); $contents2 = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents2); } } if(isset($_GET["birdnetpi_url"])) { $birdnetpi_url = $_GET["birdnetpi_url"]; if(strcmp($birdnetpi_url,$config['BIRDNETPI_URL']) !== 0) { $contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents); $contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2); $fh = fopen('/etc/birdnet/birdnet.conf', "w"); $fh2 = fopen("./scripts/thisrun.txt", "w"); fwrite($fh, $contents); fwrite($fh2, $contents2); exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &'); } } if(isset($_GET["rtsp_stream"])) { $rtsp_stream = $_GET["rtsp_stream"]; if(strcmp($rtsp_stream,$config['RTSP_STREAM']) !== 0) { $contents = preg_replace("/RTSP_STREAM=.*/", "RTSP_STREAM=$rtsp_stream", $contents); $contents2 = preg_replace("/RTSP_STREAM=.*/", "RTSP_STREAM=$rtsp_stream", $contents2); $fh = fopen('/etc/birdnet/birdnet.conf', "w"); $fh2 = fopen("./scripts/thisrun.txt", "w"); fwrite($fh, $contents); fwrite($fh2, $contents2); exec('sudo systemctl restart birdnet_recording.service'); } } if(isset($_GET["overlap"])) { $overlap = $_GET["overlap"]; if(strcmp($overlap,$config['OVERLAP']) !== 0) { $contents = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents); $contents2 = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents2); } } if(isset($_GET["confidence"])) { $confidence = $_GET["confidence"]; if(strcmp($confidence,$config['CONFIDENCE']) !== 0) { $contents = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents); $contents2 = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents2); } } if(isset($_GET["sensitivity"])) { $sensitivity = $_GET["sensitivity"]; if(strcmp($sensitivity,$config['SENSITIVITY']) !== 0) { $contents = preg_replace("/SENSITIVITY=.*/", "SENSITIVITY=$sensitivity", $contents); $contents2 = preg_replace("/SENSITIVITY=.*/", "SENSITIVITY=$sensitivity", $contents2); } } if(isset($_GET["full_disk"])) { $full_disk = $_GET["full_disk"]; if(strcmp($full_disk,$config['FULL_DISK']) !== 0) { $contents = preg_replace("/FULL_DISK=.*/", "FULL_DISK=$full_disk", $contents); $contents2 = preg_replace("/FULL_DISK=.*/", "FULL_DISK=$full_disk", $contents2); } } if(isset($_GET["privacy_mode"])) { $privacy_mode = $_GET["privacy_mode"]; if(strcmp($config['PRIVACY_MODE'], "1") == 0 ) { $pmode = "on"; }elseif(strcmp($config['PRIVACY_MODE'], "") == 0) { $pmode = "off"; } if(strcmp($privacy_mode,$pmode) !== 0) { $contents = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents); $contents2 = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents2); if(strcmp($privacy_mode,"on") == 0) { exec('sudo sed -i \'s/\/usr\/local\/bin\/server.py/\/usr\/local\/bin\/privacy_server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service'); exec('sudo systemctl daemon-reload'); exec('restart_services.sh'); header('Location: /log'); } elseif(strcmp($privacy_mode,"off") == 0) { exec('sudo sed -i \'s/\/usr\/local\/bin\/privacy_server.py/\/usr\/local\/bin\/server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service'); exec('sudo systemctl daemon-reload'); exec('restart_services.sh'); header('Location: /log'); } } } if(isset($_GET["rec_card"])) { $rec_card = $_GET["rec_card"]; if(strcmp($rec_card,$config['REC_CARD']) !== 0) { $contents = preg_replace("/REC_CARD=.*/", "REC_CARD=$rec_card", $contents); $contents2 = preg_replace("/REC_CARD=.*/", "REC_CARD=$rec_card", $contents2); } } if(isset($_GET["channels"])) { $channels = $_GET["channels"]; if(strcmp($channels,$config['CHANNELS']) !== 0) { $contents = preg_replace("/CHANNELS=.*/", "CHANNELS=$channels", $contents); $contents2 = preg_replace("/CHANNELS=.*/", "CHANNELS=$channels", $contents2); } } if(isset($_GET["recording_length"])) { $recording_length = $_GET["recording_length"]; if(strcmp($recording_length,$config['RECORDING_LENGTH']) !== 0) { $contents = preg_replace("/RECORDING_LENGTH=.*/", "RECORDING_LENGTH=$recording_length", $contents); $contents2 = preg_replace("/RECORDING_LENGTH=.*/", "RECORDING_LENGTH=$recording_length", $contents2); } } if(isset($_GET["extraction_length"])) { $extraction_length = $_GET["extraction_length"]; if(strcmp($extraction_length,$config['EXTRACTION_LENGTH']) !== 0) { $contents = preg_replace("/EXTRACTION_LENGTH=.*/", "EXTRACTION_LENGTH=$extraction_length", $contents); $contents2 = preg_replace("/EXTRACTION_LENGTH=.*/", "EXTRACTION_LENGTH=$extraction_length", $contents2); } } if(isset($_GET["audiofmt"])) { $audiofmt = $_GET["audiofmt"]; if(strcmp($audiofmt,$config['AUDIOFMT']) !== 0) { $contents = preg_replace("/AUDIOFMT=.*/", "AUDIOFMT=$audiofmt", $contents); $contents2 = preg_replace("/AUDIOFMT=.*/", "AUDIOFMT=$audiofmt", $contents2); } } $fh = fopen('/etc/birdnet/birdnet.conf', "w"); $fh2 = fopen("./scripts/thisrun.txt", "w"); fwrite($fh, $contents); fwrite($fh2, $contents2); } ?>