Skip to content

Commit

Permalink
Merge branch 'Nachtzuster:main' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Jun 25, 2024
2 parents b4f7bbc + ed68f06 commit 65575bd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Currently listening in these countries . . . that I know of . . .
- Colombia
- Estonia
- Tasmania
- Luxembourgh
- Luxembourg
- Crete
- Rwanda
- Oman
Expand Down
2 changes: 1 addition & 1 deletion scripts/advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ function collectrtspUrls() {
<br><br>
<input type="hidden" name="view" value="Advanced">
<div class="float">
<button type="submit" id="advancedformsubmit" onclick="if(document.getElementById('advancedform').checkValidity()){this.innerHTML = 'Updating... please wait.';this.classList.add('disabled')}" name="submit" value="advanced">
<button type="submit" id="advancedformsubmit" onclick="collectrtspUrls(); if(document.getElementById('advancedform').checkValidity()){this.innerHTML = 'Updating... please wait.';this.classList.add('disabled')}" name="submit" value="advanced">
<?php
if(isset($_GET['submit'])){
echo '<script>alert("Settings successfully updated");</script>';
Expand Down
14 changes: 14 additions & 0 deletions scripts/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ function get_com_en_name($sci_name) {
return $engname;
}

function get_sci_name($com_name) {
if (!isset($_labels)) {
$_labels = file(get_home() . "/BirdNET-Pi/model/labels.txt");
}
$sciname = null;
foreach ($_labels as $label) {
if (strpos($label, $com_name) !== false) {
$sciname = trim(explode("_", $label)[0]);
break;
}
}
return $sciname;
}

define('DB', './scripts/flickr.db');

class Flickr {
Expand Down
11 changes: 9 additions & 2 deletions scripts/play.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,12 @@ function changeDetection(filename,copylink=false) {
$num_rows++;
}
$result2->reset(); // reset the pointer to the beginning of the result set
$sciname = get_sci_name($name);
$info_url = get_info_url($sciname);
$url = $info_url['URL'];
echo "<table>
<tr>
<th>$name</th>
<th><a href=\"$url\" target=\"top\">$name</a></th>
</tr>";
$iter=0;
while($results=$result2->fetchArray(SQLITE3_ASSOC))
Expand Down Expand Up @@ -641,9 +644,13 @@ function changeDetection(filename,copylink=false) {
$statement2 = $db->prepare("SELECT * FROM detections where File_name == \"$name\" ORDER BY Date DESC, Time DESC");
ensure_db_ok($statement2);
$result2 = $statement2->execute();
$comname = str_replace("_", " ", strtok($name, '-'));
$sciname = get_sci_name($comname);
$info_url = get_info_url($sciname);
$url = $info_url['URL'];
echo "<table>
<tr>
<th>$name</th>
<th><a href=\"$url\" target=\"top\">$name</a></th>
</tr>";
while($results=$result2->fetchArray(SQLITE3_ASSOC))
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/spectrogram.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
};

// if user agent includes iPhone or Mac use legacy mode
if(((window.navigator.userAgent.includes("iPhone") || window.navigator.userAgent.includes("Mac")) && !window.navigator.userAgent.includes("Chrome")) || legacy == true) {
if(window.navigator.userAgent.includes("iPhone") || legacy == true) {
document.getElementById("spectrogramimage").style.display="";
document.body.querySelector('canvas').remove();
document.getElementById('player').remove();
Expand Down

0 comments on commit 65575bd

Please sign in to comment.