Added config variable for livestream reconnection delay, for freqshift purpose
This commit is contained in:
@@ -168,6 +168,14 @@ if(isset($_GET['submit'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET["freqshift_reconnect_delay"]) && is_numeric($_GET['freqshift_reconnect_delay'])) {
|
||||
$freqshift_reconnect_delay = $_GET["freqshift_reconnect_delay"];
|
||||
if(strcmp($freqshift_hi,$config['FREQSHIFT_RECONNECT_DELAY']) !== 0) {
|
||||
$contents = preg_replace("/FREQSHIFT_RECONNECT_DELAY=.*/", "FREQSHIFT_RECONNECT_DELAY=$freqshift_reconnect_delay", $contents);
|
||||
$contents2 = preg_replace("/FREQSHIFT_RECONNECT_DELAY=.*/", "FREQSHIFT_RECONNECT_DELAY=$freqshift_reconnect_delay", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET["full_disk"])) {
|
||||
$full_disk = $_GET["full_disk"];
|
||||
if(strcmp($full_disk,$config['FULL_DISK']) !== 0) {
|
||||
@@ -530,6 +538,7 @@ foreach($formats as $format){
|
||||
<table class="settingstable"><tr><td>
|
||||
<h2>BirdNET-Pi Password</h2>
|
||||
<p>This password will protect your "Tools" page and "Live Audio" stream.</p>
|
||||
<p>Do NOT use special characters. Accepted characters: [A-Z0-9a-z]</p>
|
||||
<label for="caddy_pwd">Password: </label>
|
||||
<input style="width:40ch" name="caddy_pwd" id="caddy_pwd" type="password" pattern="[A-Za-z0-9]+" title="Password must be alphanumeric (A-Z, 0-9)" value="<?php print($newconfig['CADDY_PWD']);?>" /><span id="showpassword" onmouseover="document.getElementById('caddy_pwd').type='text';" onmouseout="document.getElementById('caddy_pwd').type='password';">show</span><br>
|
||||
</td></tr></table><br>
|
||||
@@ -614,6 +623,10 @@ foreach($formats as $format){
|
||||
<label for="freqshift_lo">Target [Hz]: </label>
|
||||
<input name="freqshift_lo" type="number" min="0" max="20000" step="1" value="<?php print($newconfig['FREQSHIFT_LO']);?>" required/>
|
||||
</p>
|
||||
<p style="margin-left: 40px">
|
||||
<label for="freqshift_reconnect_delay">Livestream reconnection delay: </label>
|
||||
<input name="freqshift_reconnect_delay" type="number" min="1000" max="10000" step="100" value="<?php print($newconfig['FREQSHIFT_RECONNECT_DELAY']);?>" required/>
|
||||
</p>
|
||||
|
||||
<p style="margin-left: 40px">
|
||||
Using sox:
|
||||
|
||||
@@ -169,6 +169,9 @@ FREQSHIFT_HI=6000
|
||||
## FREQSHIFT_LO
|
||||
FREQSHIFT_LO=3000
|
||||
|
||||
## FREQSHIFT_RECONNECT_DELAY
|
||||
FREQSHIFT_RECONNECT_DELAY=4000
|
||||
|
||||
## If the tool is sox, you have to define the pitch shift (amount of 100ths of semintone)
|
||||
## FREQSHIFT_PITCH
|
||||
FREQSHIFT_PITCH=-1500
|
||||
|
||||
@@ -8,6 +8,12 @@ if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
|
||||
if(!empty($config['FREQSHIFT_RECONNECT_DELAY']) && is_numeric($config['FREQSHIFT_RECONNECT_DELAY'])){
|
||||
$FREQSHIFT_RECONNECT_DELAY = ($config['FREQSHIFT_RECONNECT_DELAY']);
|
||||
}else{
|
||||
$FREQSHIFT_RECONNECT_DELAY = 4000;
|
||||
}
|
||||
|
||||
if(isset($_GET['ajax_csv'])) {
|
||||
$RECS_DIR = $config["RECS_DIR"];
|
||||
|
||||
@@ -323,6 +329,8 @@ function toggleFreqshift(state) {
|
||||
console.log("freqshift deactivated")
|
||||
}
|
||||
|
||||
freqShiftReconnectDelay = <?php echo $FREQSHIFT_RECONNECT_DELAY; ?>;
|
||||
|
||||
var livestream_freqshift_spinner = document.getElementById('livestream_freqshift_spinner');
|
||||
livestream_freqshift_spinner.style.display = "inline";
|
||||
// Create the XMLHttpRequest object.
|
||||
@@ -349,7 +357,7 @@ function toggleFreqshift(state) {
|
||||
|
||||
livestream_freqshift_spinner.style.display = "none";
|
||||
},
|
||||
2000
|
||||
freqShiftReconnectDelay
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,9 @@ fi
|
||||
if ! grep ACTIVATE_FREQSHIFT_IN_LIVESTREAM /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
sudo -u$USER echo "ACTIVATE_FREQSHIFT_IN_LIVESTREAM=\"false\"" >> /etc/birdnet/birdnet.conf
|
||||
fi
|
||||
if ! grep FREQSHIFT_RECONNECT_DELAY /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
sudo -u$USER echo "FREQSHIFT_RECONNECT_DELAY=4000" >> /etc/birdnet/birdnet.conf
|
||||
fi
|
||||
if ! grep HEARTBEAT_URL /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
sudo -u$USER echo "HEARTBEAT_URL=" >> /etc/birdnet/birdnet.conf
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user