Merge pull request #937 from croisez/main

Added config variable for livestream reconnection delay, for freqshift purpose
This commit is contained in:
ehpersonal38
2023-05-30 12:28:45 -04:00
committed by GitHub
4 changed files with 27 additions and 1 deletions
+12
View File
@@ -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) {
@@ -615,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 (in ms): </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:
+3
View File
@@ -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
+9 -1
View File
@@ -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
)
}
}
+3
View File
@@ -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