diff --git a/scripts/add_to_exclude.php b/scripts/add_to_exclude.php new file mode 100644 index 0000000..6922eb2 --- /dev/null +++ b/scripts/add_to_exclude.php @@ -0,0 +1,14 @@ + diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh index 0381676..9ea86c8 100755 --- a/scripts/birdnet_analysis.sh +++ b/scripts/birdnet_analysis.sh @@ -29,6 +29,12 @@ fi INCLUDE_LIST="/home/pi/BirdNET-Pi/include_species_list.txt" EXCLUDE_LIST="/home/pi/BirdNET-Pi/exclude_species_list.txt" +if [ "$(du ${INCLUDE_LIST} | awk '{print $1}')" -lt 4 ];then + INCLUDE_LIST=null +fi +if [ "$(du ${EXCLUDE_LIST} | awk '{print $1}')" -lt 4 ];then + EXCLUDE_LIST=null +fi # Create an array of the audio files # Takes one argument: diff --git a/scripts/del_from_exclude.php b/scripts/del_from_exclude.php new file mode 100644 index 0000000..5fa7a48 --- /dev/null +++ b/scripts/del_from_exclude.php @@ -0,0 +1,22 @@ + diff --git a/scripts/del_from_include.php b/scripts/del_from_include.php index 5f8d441..219d88f 100644 --- a/scripts/del_from_include.php +++ b/scripts/del_from_include.php @@ -3,7 +3,7 @@ error_reporting(E_ALL); ini_set('display_errors',1); $file='/home/pi/BirdNET-Pi/include_species_list.txt'; $str=file_get_contents("$file"); -$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str); +$str = preg_replace('/^\h*\v+/m', '', $str); file_put_contents("$file", "$str"); if (isset($_POST['species'])) @@ -12,6 +12,11 @@ $content = file_get_contents("/home/pi/BirdNET-Pi/include_species_list.txt"); $newcontent = str_replace($selectedOption, "", "$content"); file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", "$newcontent"); } +$file='/home/pi/BirdNET-Pi/include_species_list.txt'; +$str=file_get_contents("$file"); +//$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str); +$str = preg_replace('/^\h*\v+/m', '', $str); +file_put_contents("$file", "$str"); header("Location: {$_SERVER['HTTP_REFERER']}"); exit; ?> diff --git a/scripts/exclude_list.php b/scripts/exclude_list.php new file mode 100644 index 0000000..99e20fc --- /dev/null +++ b/scripts/exclude_list.php @@ -0,0 +1,121 @@ + + + + and add php start and close tag +//comment these two lines when code started working fine +error_reporting(E_ALL); +ini_set('display_errors',1); + +$filename = 'labels.txt'; +$eachlines = file($filename, FILE_IGNORE_NEW_LINES); + +?> + +
+