Merge branch 'BirdNET-pi-main' into More-Misc-Fixes-and-Enhancements_mcguire
This commit is contained in:
@@ -52,6 +52,8 @@ if(isset($_GET['submit'])) {
|
||||
|
||||
if(isset($_GET["birdnetpi_url"])) {
|
||||
$birdnetpi_url = $_GET["birdnetpi_url"];
|
||||
// remove trailing slash to prevent conf from becoming broken
|
||||
$birdnetpi_url = rtrim($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);
|
||||
|
||||
+38
-36
@@ -481,45 +481,47 @@ h1 {
|
||||
|
||||
<script>
|
||||
var rtsp_stream_select = document.getElementById("rtsp_stream_select");
|
||||
//When the dropdown selection is changed set the new value is settings, then restart the livestream service so it broadcasts newly selected RTSP stream
|
||||
rtsp_stream_select.onchange = function() {
|
||||
if (this.value !== 'undefined'){
|
||||
// Get the audio player element
|
||||
var audio_player = document.querySelector('audio#player');
|
||||
var central_controls_element = document.getElementsByClassName('centered')[0];
|
||||
if (typeof (rtsp_stream_select) !== 'undefined' && rtsp_stream_select !== null) {
|
||||
//When the dropdown selection is changed set the new value is settings, then restart the livestream service so it broadcasts newly selected RTSP stream
|
||||
rtsp_stream_select.onchange = function () {
|
||||
if (this.value !== 'undefined') {
|
||||
// Get the audio player element
|
||||
var audio_player = document.querySelector('audio#player');
|
||||
var central_controls_element = document.getElementsByClassName('centered')[0];
|
||||
|
||||
//Create the loading header again as a placeholder while we're waiting to reload the stream
|
||||
var h1_loading = document.createElement("H1");
|
||||
var h1_loading_text = document.createTextNode("Loading...");
|
||||
h1_loading.setAttribute("id","loading-h1");
|
||||
h1_loading.setAttribute("style","font-size:48px; font-weight: bolder; color: #FFF");
|
||||
h1_loading.appendChild(h1_loading_text);
|
||||
//Create the loading header again as a placeholder while we're waiting to reload the stream
|
||||
var h1_loading = document.createElement("H1");
|
||||
var h1_loading_text = document.createTextNode("Loading...");
|
||||
h1_loading.setAttribute("id", "loading-h1");
|
||||
h1_loading.setAttribute("style", "font-size:48px; font-weight: bolder; color: #FFF");
|
||||
h1_loading.appendChild(h1_loading_text);
|
||||
|
||||
// Create the XMLHttpRequest object.
|
||||
const xhr = new XMLHttpRequest();
|
||||
// Initialize the request
|
||||
xhr.open("GET", './views.php?rtsp_stream_to_livestream='+ this.value +'&view=Advanced&submit=advanced');
|
||||
// Send the request
|
||||
xhr.send();
|
||||
// Fired once the request completes successfully
|
||||
xhr.onload = function(e) {
|
||||
// Check if the request was a success
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
// Restart the audio player in case it stopped working while the livestream service was restarted
|
||||
if(audio_player !== 'undefined'){
|
||||
central_controls_element.appendChild(h1_loading);
|
||||
//Wait 5 seconds before restarting the stream
|
||||
setTimeout(function () {
|
||||
audio_player.pause();
|
||||
audio_player.setAttribute('src', '/stream');
|
||||
audio_player.load();
|
||||
audio_player.play();
|
||||
// Create the XMLHttpRequest object.
|
||||
const xhr = new XMLHttpRequest();
|
||||
// Initialize the request
|
||||
xhr.open("GET", './views.php?rtsp_stream_to_livestream=' + this.value + '&view=Advanced&submit=advanced');
|
||||
// Send the request
|
||||
xhr.send();
|
||||
// Fired once the request completes successfully
|
||||
xhr.onload = function (e) {
|
||||
// Check if the request was a success
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
// Restart the audio player in case it stopped working while the livestream service was restarted
|
||||
if (audio_player !== 'undefined') {
|
||||
central_controls_element.appendChild(h1_loading);
|
||||
//Wait 5 seconds before restarting the stream
|
||||
setTimeout(function () {
|
||||
audio_player.pause();
|
||||
audio_player.setAttribute('src', '/stream');
|
||||
audio_player.load();
|
||||
audio_player.play();
|
||||
|
||||
document.getElementById('loading-h1').remove()
|
||||
},
|
||||
10000
|
||||
)
|
||||
}
|
||||
document.getElementById('loading-h1').remove()
|
||||
},
|
||||
10000
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ my_dir=$HOME/BirdNET-Pi/scripts
|
||||
# Sets proper permissions and ownership
|
||||
#sudo -E chown -R $USER:$USER $HOME/*
|
||||
#sudo chmod -R g+wr $HOME/*
|
||||
find $HOME/* -not -user $USER -execdir sudo -E chown $USER:$USER {} \+
|
||||
find $HOME/* -not -user $USER -execdir sudo chmod g+wr {} \+
|
||||
find $HOME/Bird* -not -user $USER -execdir sudo -E chown $USER:$USER {} \+
|
||||
find $HOME/Bird* -not -user $USER -execdir sudo chmod g+wr {} \+
|
||||
chmod 666 ~/BirdNET-Pi/scripts/*.txt
|
||||
chmod 666 ~/BirdNET-Pi/*.txt
|
||||
find $HOME/BirdNET-Pi -path "$HOME/BirdNET-Pi/birdnet" -prune -o -type f ! -perm /o=w -exec chmod a+w {} \;
|
||||
@@ -130,8 +130,7 @@ if ! grep '\-\-browser.gatherUsageStats false' $HOME/BirdNET-Pi/templates/birdne
|
||||
fi
|
||||
|
||||
# Make IceCast2 a little more secure
|
||||
sudo sed -i 's|<!-- <bind-address>.*|<bind-address>127.0.0.1</bind-address>|;s|<!-- <shoutcast-mount>.*|<shoutcast-mount>/stream</shoutcast-mount>|' /etc/icecast2/icecast.xml
|
||||
sudo systemctl restart icecast2
|
||||
sudo sed -i.bak -e 's|<!-- <bind-address>.*|<bind-address>127.0.0.1</bind-address>|;s|<!-- <shoutcast-mount>.*|<shoutcast-mount>/stream</shoutcast-mount>|' /etc/icecast2/icecast.xml && if [ -s /etc/icecast2/icecast.xml.bak ] && ! sudo diff /etc/icecast2/icecast.xml /etc/icecast2/icecast.xml.bak > /dev/null; then sudo systemctl restart icecast2; fi
|
||||
|
||||
if ! grep FREQSHIFT_TOOL /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
sudo -u$USER echo "FREQSHIFT_TOOL=sox" >> /etc/birdnet/birdnet.conf
|
||||
@@ -162,7 +161,7 @@ CREATE INDEX IF NOT EXISTS "detections_Com_Name" ON "detections" ("Com_Name");
|
||||
CREATE INDEX IF NOT EXISTS "detections_Date_Time" ON "detections" ("Date" DESC, "Time" DESC);
|
||||
EOF
|
||||
|
||||
apprise_version=$($HOME/BirdNET-Pi/birdnet/bin/pip3 show apprise 2>/dev/null | grep Version | awk '{print $2}')
|
||||
apprise_version=$($HOME/BirdNET-Pi/birdnet/bin/python3 -c "import apprise; print(apprise.__version__)")
|
||||
streamlit_version=$($HOME/BirdNET-Pi/birdnet/bin/pip3 show streamlit 2>/dev/null | grep Version | awk '{print $2}')
|
||||
|
||||
[[ $apprise_version != "1.2.1" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1
|
||||
|
||||
Reference in New Issue
Block a user