diff --git a/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh b/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
index 343c88044..cfef4efaa 100755
--- a/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
+++ b/birdnet-pi/rootfs/etc/cont-init.d/71-newfeatures.sh
@@ -81,19 +81,19 @@ if bashio::config.true "SPECIES_CONVERTER"; then
# Remove the extracted lines from the original file
sed -i '/if(\$_GET\['\''view'\''\] == "File"){/,$d' "$HOME"/BirdNET-Pi/homepage/views.php
# Add new text
- cat "/helpers/convert_list/views.add" >> "$HOME"/BirdNET-Pi/homepage/views.php
+ cat "/helpers/views.add" >> "$HOME"/BirdNET-Pi/homepage/views.php
cat "$HOME"/BirdNET-Pi/homepage/views.php.temp >> "$HOME"/BirdNET-Pi/homepage/views.php
# Clean up: Remove the temporary file
rm "$HOME"/BirdNET-Pi/homepage/views.php.temp
fi
-
+
# Add the converter script
if [ ! -f "$HOME"/BirdNET-Pi/scripts/convert_list.php ]; then
- mv -f /helpers/convert_list/convert_list.php "$HOME"/BirdNET-Pi/scripts/convert_list.php
+ mv -f /helpers/convert_list.php "$HOME"/BirdNET-Pi/scripts/convert_list.php
chown pi:pi "$HOME"/BirdNET-Pi/scripts/convert_list.php
chmod 664 "$HOME"/BirdNET-Pi/scripts/convert_list.php
fi
-
+
# Change server
if ! grep -q "converted_entry" "$HOME"/BirdNET-Pi/scripts/server.py; then
sed -i "/INTERPRETER, M_INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST/c INTERPRETER, M_INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST, CONVERT_LIST = (None, None, None, None, None)" "$HOME"/BirdNET-Pi/scripts/server.py
diff --git a/birdnet-pi/rootfs/helpers/change_id/bird.svg b/birdnet-pi/rootfs/helpers/change_id/bird.svg
deleted file mode 100644
index 2fa6ab0dc..000000000
--- a/birdnet-pi/rootfs/helpers/change_id/bird.svg
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/birdnet-pi/rootfs/helpers/change_id/birdnet_changeidentification.sh b/birdnet-pi/rootfs/helpers/change_id/birdnet_changeidentification.sh
deleted file mode 100755
index 9257c65f3..000000000
--- a/birdnet-pi/rootfs/helpers/change_id/birdnet_changeidentification.sh
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/bin/bash
-
-# This scripts allows to change the identification of a Birdnet-pi detection
-
-#################
-# SET VARIABLES #
-#################
-
-HOME="/home/pi"
-source /etc/birdnet/birdnet.conf &>/dev/null
-
-# Get arguments
-OLDNAME="$1" #OLDNAME="Mésange_charbonnière-78-2024-05-02-birdnet-RTSP_1-18:14:08.mp3"
-NEWNAME="$2" #NEWNAME="Lapinus atricapilla_Lapinu à tête noire"
-
-# Set log level
-OUTPUT_TYPE="${3:-debug}" # Set 3rd argument to debug to have all outputs
-
-# Ask for user input if no arguments
-if [ -z "$OLDNAME" ]; then read -r -p 'OLDNAME (finishing by mp3): ' OLDNAME; fi
-if [ -z "$NEWNAME" ]; then read -r -p 'NEWNAME (sciname_commoname): ' NEWNAME; fi
-
-# Fixed values
-LABELS_FILE="$HOME/BirdNET-Pi/model/labels.txt"
-DB_FILE="$HOME/BirdNET-Pi/scripts/birds.db"
-DETECTIONS_TABLE="detections"
-
-###################
-# VALIDITY CHECKS #
-###################
-
-# Check if files exist
-if [ ! -f "$LABELS_FILE" ]; then echo "$LABELS_FILE doesn't exist, exiting" && exit 1; fi
-if [ ! -f "$DB_FILE" ]; then echo "$DB_FILE doesn't exist, exiting" && exit 1; fi
-
-# Check if inputs are valid
-if [[ "$1" != *".mp3" ]]; then
- echo "The first argument should be a filename starting with the common name of the bird and finishing by mp3!"
- echo "Instead, it is : $1"
- exit 1
-elif [[ "$2" != *"_"* ]]; then
- echo "The second argument should be in the format : \"scientific name_common name\""
- echo "Instead, it is : $2"
- exit 1
-fi
-
-# Check if $NEWNAME is found in the file $LABELS_FILE
-if ! grep -q "$NEWNAME" "$LABELS_FILE"; then
- echo "Error: $NEWNAME not found in $LABELS_FILE"
- exit 1
-fi
-
-# Check if the common name as the same as the first
-OLDNAME_space="${OLDNAME//_/ }"
-if [[ "${OLDNAME_space%%-*}" == "${NEWNAME#*_}" ]]; then
- echo "Error: $OLDNAME has the same common name as $NEWNAME"
- exit 1
-fi
-
-##################
-# EXECUTE SCRIPT #
-##################
-
-# Intro
-[[ "$OUTPUT_TYPE" == "debug" ]] && echo "Starting to modify $OLDNAME to $NEWNAME"
-
-# Get the line where the column "File_Name" matches exactly $OLDNAME
-IFS='|' read -r OLDNAME_sciname OLDNAME_comname OLDNAME_date < <(sqlite3 "$DB_FILE" "SELECT Sci_Name, Com_Name, Date FROM $DETECTIONS_TABLE WHERE File_Name = '$OLDNAME' LIMIT 1;")
-
-if [[ -z "$OLDNAME_sciname" ]]; then
- echo "Error: No line matching $OLDNAME in $DB_FILE"
- exit 1
-fi
-
-# Extract the part before the _ from $NEWNAME
-NEWNAME_comname="${NEWNAME#*_}"
-NEWNAME_sciname="${NEWNAME%%_*}"
-
-# Replace spaces with underscores
-NEWNAME_comname2="${NEWNAME_comname// /_}"
-OLDNAME_comname2="${OLDNAME_comname// /_}"
-
-# Replace OLDNAME_comname2 with NEWNAME_comname2 in OLDNAME
-NEWNAME_filename="${OLDNAME//$OLDNAME_comname2/$NEWNAME_comname2}"
-
-[[ "$OUTPUT_TYPE" == "debug" ]] && echo "This script will change the identification $OLDNAME from $OLDNAME_comname to ${NEWNAME#*_}"
-
-########################
-# EXECUTE : MOVE FILES #
-########################
-
-# Check if the file exists
-FILE_PATH="$HOME/BirdSongs/Extracted/By_Date/$OLDNAME_date/$OLDNAME_comname2/$OLDNAME"
-if [[ -f $FILE_PATH ]]; then
- # Ensure the new directory exists
- NEW_DIR="$HOME/BirdSongs/Extracted/By_Date/$OLDNAME_date/$NEWNAME_comname2"
- mkdir -p "$NEW_DIR"
-
- # Move and rename the file
- mv "$FILE_PATH" "$NEW_DIR/$NEWNAME_filename"
- mv "$FILE_PATH".png "$NEW_DIR/$NEWNAME_filename".png
-
- [[ "$OUTPUT_TYPE" == "debug" ]] && echo "Files moved!"
-else
- echo "Error: File $FILE_PATH does not exist"
-fi
-
-###################################
-# EXECUTE : UPDATE DATABASE FILES #
-###################################
-
-# Update the database
-sqlite3 "$DB_FILE" "UPDATE $DETECTIONS_TABLE SET Sci_Name = '$NEWNAME_sciname', Com_Name = '$NEWNAME_comname', File_Name = '$NEWNAME_filename' WHERE File_Name = '$OLDNAME';"
-
-[[ "$OUTPUT_TYPE" == "debug" ]] && echo "Database entry removed"
-
-[[ "$OUTPUT_TYPE" == "debug" ]] && echo "All done!"
diff --git a/birdnet-pi/rootfs/helpers/change_id/play.php b/birdnet-pi/rootfs/helpers/change_id/play.php
deleted file mode 100644
index 0c1827fe8..000000000
--- a/birdnet-pi/rootfs/helpers/change_id/play.php
+++ /dev/null
@@ -1,705 +0,0 @@
-busyTimeout(1000);
-
-if(isset($_GET['deletefile'])) {
- ensure_authenticated('You must be authenticated to delete files.');
- if (preg_match('~^.*(\.\.\/).+$~', $_GET['deletefile'])) {
- echo "Error";
- die();
- }
- $db_writable = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_READWRITE);
- $db->busyTimeout(1000);
- $statement1 = $db_writable->prepare('DELETE FROM detections WHERE File_Name = :file_name LIMIT 1');
- ensure_db_ok($statement1);
- $statement1->bindValue(':file_name', explode("/", $_GET['deletefile'])[2]);
- $file_pointer = $home."/BirdSongs/Extracted/By_Date/".$_GET['deletefile'];
- if (!exec("sudo rm $file_pointer 2>&1 && sudo rm $file_pointer.png 2>&1", $output)) {
- echo "OK";
- } else {
- echo "Error - file deletion failed : " . implode(", ", $output) . "
";
- }
- $result1 = $statement1->execute();
- if ($result1 === false || $db_writable->changes() === 0) {
- echo "Error - database line deletion failed : " . $db_writable->lastErrorMsg();
- }
- $db_writable->close();
- die();
-}
-
-if(isset($_GET['excludefile'])) {
- ensure_authenticated('You must be authenticated to change the protection of files.');
- if(!file_exists($home."/BirdNET-Pi/scripts/disk_check_exclude.txt")) {
- file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "##start\n##end\n");
- }
- if(isset($_GET['exclude_add'])) {
- $myfile = fopen($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "a") or die("Unable to open file!");
- $txt = $_GET['excludefile'];
- fwrite($myfile, $txt."\n");
- fwrite($myfile, $txt.".png\n");
- fclose($myfile);
- echo "OK";
- die();
- } else {
- $lines = file($home."/BirdNET-Pi/scripts/disk_check_exclude.txt");
- $search = $_GET['excludefile'];
-
- $result = '';
- foreach($lines as $line) {
- if(stripos($line, $search) === false && stripos($line, $search.".png") === false) {
- $result .= $line;
- }
- }
- file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", $result);
- echo "OK";
- die();
- }
-}
-
-if(isset($_GET['getlabels'])) {
- $labels = file('/home/pi/BirdNET-Pi/model/labels.txt', FILE_IGNORE_NEW_LINES);
- echo json_encode($labels);
- die();
-}
-
-if(isset($_GET['changefile']) && isset($_GET['newname'])) {
- ensure_authenticated('You must be authenticated to delete files.');
- if (preg_match('~^.*(\.\.\/).+$~', $_GET['changefile'])) {
- echo "Error";
- die();
- }
- $oldname = basename(urldecode($_GET['changefile']));
- $newname = urldecode($_GET['newname']);
- if (!exec("$home/BirdNET-Pi/scripts/birdnet_changeidentification.sh \"$oldname\" \"$newname\" log_errors 2>&1", $output)) {
- echo "OK";
- } else {
- echo "Error : " . implode(", ", $output) . "
";
- }
- die();
-}
-
-$shifted_path = $home."/BirdSongs/Extracted/By_Date/shifted/";
-
-if(isset($_GET['shiftfile'])) {
- ensure_authenticated('You cannot shift files for this installation');
-
- $filename = $_GET['shiftfile'];
- $pp = pathinfo($filename);
- $dir = $pp['dirname'];
- $fn = $pp['filename'];
- $ext = $pp['extension'];
- $pi = $home."/BirdSongs/Extracted/By_Date/";
-
- if(isset($_GET['doshift'])) {
- $freqshift_tool = $config['FREQSHIFT_TOOL'];
-
- if ($freqshift_tool == "ffmpeg") {
- $cmd = "sudo /usr/bin/nohup /usr/bin/ffmpeg -y -i ".escapeshellarg($pi.$filename)." -af \"rubberband=pitch=".$config['FREQSHIFT_LO']."/".$config['FREQSHIFT_HI']."\" ".escapeshellarg($shifted_path.$filename)."";
- shell_exec("sudo mkdir -p ".$shifted_path.$dir." && ".$cmd);
-
- } else if ($freqshift_tool == "sox") {
- //linux.die.net/man/1/sox
- $soxopt = "-q";
- $soxpitch = $config['FREQSHIFT_PITCH'];
- $cmd = "sudo /usr/bin/nohup /usr/bin/sox ".escapeshellarg($pi.$filename)." ".escapeshellarg($shifted_path.$filename)." pitch ".$soxopt." ".$soxpitch;
- shell_exec("sudo mkdir -p ".$shifted_path.$dir." && ".$cmd);
- }
- } else {
- $cmd = "sudo rm -f " . escapeshellarg($shifted_path.$filename);
- shell_exec($cmd);
- }
-
- echo "OK";
- die();
-}
-
-if(isset($_GET['bydate'])){
- $statement = $db->prepare('SELECT DISTINCT(Date) FROM detections GROUP BY Date ORDER BY Date DESC');
- ensure_db_ok($statement);
- $result = $statement->execute();
- $view = "bydate";
-
- #Specific Date
-} elseif(isset($_GET['date'])) {
- $date = $_GET['date'];
- session_start();
- $_SESSION['date'] = $date;
- if(isset($_GET['sort']) && $_GET['sort'] == "occurrences") {
- $statement = $db->prepare("SELECT DISTINCT(Com_Name) FROM detections WHERE Date == \"$date\" GROUP BY Com_Name ORDER BY COUNT(*) DESC");
- } else {
- $statement = $db->prepare("SELECT DISTINCT(Com_Name) FROM detections WHERE Date == \"$date\" ORDER BY Com_Name");
- }
- ensure_db_ok($statement);
- $result = $statement->execute();
- $view = "date";
-
- #By Species
-} elseif(isset($_GET['byspecies'])) {
- if(isset($_GET['sort']) && $_GET['sort'] == "occurrences") {
- $statement = $db->prepare('SELECT DISTINCT(Com_Name) FROM detections GROUP BY Com_Name ORDER BY COUNT(*) DESC');
- } else {
- $statement = $db->prepare('SELECT DISTINCT(Com_Name) FROM detections ORDER BY Com_Name ASC');
- }
- session_start();
- ensure_db_ok($statement);
- $result = $statement->execute();
- $view = "byspecies";
-
- #Specific Species
-} elseif(isset($_GET['species'])) {
- $species = htmlspecialchars_decode($_GET['species'], ENT_QUOTES);
- session_start();
- $_SESSION['species'] = $species;
- $statement = $db->prepare("SELECT * FROM detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
- ensure_db_ok($statement);
- $statement3 = $db->prepare("SELECT Date, Time, Sci_Name, MAX(Confidence), File_Name FROM detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
- ensure_db_ok($statement3);
- $result = $statement->execute();
- $result3 = $statement3->execute();
- $view = "species";
-} else {
- unset($_SESSION['species']);
- unset($_SESSION['date']);
- $view = "choose";
-}
-
-if (get_included_files()[0] === __FILE__) {
- echo '
-
-
| $name | -
|---|
|
-
- $confidence - - ".$imageelem." - |
-
| $date $time $confidence - - ".$imageelem." - |
-
| No recordings were found. They may have been deleted to make space for new recordings. You can prevent this from happening in the future by clicking the You can also modify this behavior globally under \"Full Disk Behavior\" here. |
| $name | -
|---|
|
-
- $confidence - - |
-
| $date $time $confidence - - |
-
| Output of command:`".$initcommand."` |
|---|
$results |