prepare('DELETE FROM detections WHERE File_Name = "'.explode("/",$_GET['deletefile'])[2].'" LIMIT 1'); if($statement1 == False){ echo "Error"; header("refresh: 0;"); } else { $file_pointer = $home."/BirdSongs/Extracted/By_Date/".$_GET['deletefile']; if (!exec("sudo rm $file_pointer && sudo rm $file_pointer.png")) { echo "OK"; } else { echo "Error"; } } $result1 = $statement1->execute(); die(); } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You must be authenticated to change the protection of files.'; exit; } } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You must be authenticated to change the protection of files.'; exit; } } if(isset($_GET['excludefile'])) { if(isset($_SERVER['PHP_AUTH_USER'])) { $submittedpwd = $_SERVER['PHP_AUTH_PW']; $submitteduser = $_SERVER['PHP_AUTH_USER']; if($submittedpwd == $config['CADDY_PWD'] && $submitteduser == 'birdnet'){ 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(); } } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You must be authenticated to change the protection of files.'; exit; } } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You must be authenticated to change the protection of files.'; exit; } } $shifted_path = $home."/BirdSongs/Extracted/By_Date/shifted/"; if(isset($_GET['shiftfile'])) { $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 = "/usr/bin/nohup /usr/bin/ffmpeg -y -i \"".$pi.$filename."\" -af \"rubberband=pitch=".$config['FREQSHIFT_LO']."/".$config['FREQSHIFT_HI']."\" \"".$shifted_path.$filename."\""; shell_exec("mkdir -p ".$shifted_path.$dir." && echo \"".$cmd."\" > /tmp/shift.sh && chmod +x /tmp/shift.sh"); } else if ($freqshift_tool == "sox") { //linux.die.net/man/1/sox $soxopt = "-q"; $soxpitch = $config['FREQSHIFT_PITCH']; $cmd = "/usr/bin/nohup /usr/bin/sox \"".$pi.$filename."\" \"".$shifted_path.$filename."\" pitch ".$soxopt." ".$soxpitch; shell_exec("mkdir -p ".$shifted_path.$dir." && echo \"".$cmd."\" > /tmp/shift.sh && chmod +x /tmp/shift.sh"); } shell_exec("/tmp/shift.sh"); shell_exec("rm -f /tmp/shift.sh"); } else { $cmd = "rm -f " . $shifted_path.$filename; shell_exec("echo \"".$cmd."\" > /tmp/unshift.sh && chmod +x /tmp/unshift.sh"); shell_exec("/tmp/unshift.sh"); shell_exec("rm -f /tmp/unshift.sh"); } echo "OK"; die(); } if(isset($_GET['bydate'])){ $statement = $db->prepare('SELECT DISTINCT(Date) FROM detections GROUP BY Date ORDER BY Date DESC'); if($statement == False){ echo "Database is busy"; header("refresh: 0;"); } $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"); } if($statement == False){ echo "Database is busy"; header("refresh: 0;"); } $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(); if($statement == False){ echo "Database is busy"; header("refresh: 0;"); } $result = $statement->execute(); $view = "byspecies"; #Specific Species } elseif(isset($_GET['species'])) { $species = $_GET['species']; session_start(); $_SESSION['species'] = $species; $statement = $db->prepare("SELECT * FROM detections WHERE Com_Name == \"$species\" ORDER BY Com_Name"); $statement3 = $db->prepare("SELECT Date, Time, Sci_Name, MAX(Confidence), File_Name FROM detections WHERE Com_Name == \"$species\" ORDER BY Com_Name"); if($statement == False || $statement3 == False){ echo "Database is busy"; header("refresh: 0;"); } $result = $statement->execute(); $result3 = $statement3->execute(); $view = "species"; } else { session_start(); session_unset(); $view = "choose"; } ?>
| "; } } echo " |
| "; } } echo " |
| "; } 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 |