Split "Recordings" species list into 3 columns to take up less vertical space
This commit is contained in:
+109
-46
@@ -109,27 +109,27 @@ if(isset($_GET['shiftfile'])) {
|
|||||||
$pi = $home."/BirdSongs/Extracted/By_Date/";
|
$pi = $home."/BirdSongs/Extracted/By_Date/";
|
||||||
|
|
||||||
if(isset($_GET['doshift'])) {
|
if(isset($_GET['doshift'])) {
|
||||||
$freqshift_tool = $config['FREQSHIFT_TOOL'];
|
$freqshift_tool = $config['FREQSHIFT_TOOL'];
|
||||||
|
|
||||||
if ($freqshift_tool == "ffmpeg") {
|
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."\"";
|
$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");
|
shell_exec("mkdir -p ".$shifted_path.$dir." && echo \"".$cmd."\" > /tmp/shift.sh && chmod +x /tmp/shift.sh");
|
||||||
|
|
||||||
} else if ($freqshift_tool == "sox") {
|
} else if ($freqshift_tool == "sox") {
|
||||||
//linux.die.net/man/1/sox
|
//linux.die.net/man/1/sox
|
||||||
$soxopt = "-q";
|
$soxopt = "-q";
|
||||||
$soxpitch = $config['FREQSHIFT_PITCH'];
|
$soxpitch = $config['FREQSHIFT_PITCH'];
|
||||||
$cmd = "/usr/bin/nohup /usr/bin/sox \"".$pi.$filename."\" \"".$shifted_path.$filename."\" pitch ".$soxopt." ".$soxpitch;
|
$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("mkdir -p ".$shifted_path.$dir." && echo \"".$cmd."\" > /tmp/shift.sh && chmod +x /tmp/shift.sh");
|
||||||
}
|
}
|
||||||
|
|
||||||
shell_exec("/tmp/shift.sh");
|
shell_exec("/tmp/shift.sh");
|
||||||
shell_exec("rm -f /tmp/shift.sh");
|
shell_exec("rm -f /tmp/shift.sh");
|
||||||
} else {
|
} else {
|
||||||
$cmd = "rm -f " . $shifted_path.$filename;
|
$cmd = "rm -f " . $shifted_path.$filename;
|
||||||
shell_exec("echo \"".$cmd."\" > /tmp/unshift.sh && chmod +x /tmp/unshift.sh");
|
shell_exec("echo \"".$cmd."\" > /tmp/unshift.sh && chmod +x /tmp/unshift.sh");
|
||||||
shell_exec("/tmp/unshift.sh");
|
shell_exec("/tmp/unshift.sh");
|
||||||
shell_exec("rm -f /tmp/unshift.sh");
|
shell_exec("rm -f /tmp/unshift.sh");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "OK";
|
echo "OK";
|
||||||
@@ -259,21 +259,21 @@ function toggleShiftFreq(filename, shiftAction, elem) {
|
|||||||
elem.setAttribute("title", "This file has been shifted down in frequency.");
|
elem.setAttribute("title", "This file has been shifted down in frequency.");
|
||||||
elem.setAttribute("onclick", elem.getAttribute("onclick").replace("shift","unshift"));
|
elem.setAttribute("onclick", elem.getAttribute("onclick").replace("shift","unshift"));
|
||||||
console.log("shifted freqs of " + filename);
|
console.log("shifted freqs of " + filename);
|
||||||
video=elem.parentNode.getElementsByTagName("video")[0];
|
video=elem.parentNode.getElementsByTagName("video")[0];
|
||||||
video.setAttribute("title", video.getAttribute("title").replace("/By_Date/","/By_Date/shifted/"));
|
video.setAttribute("title", video.getAttribute("title").replace("/By_Date/","/By_Date/shifted/"));
|
||||||
source = video.getElementsByTagName("source")[0];
|
source = video.getElementsByTagName("source")[0];
|
||||||
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/","/By_Date/shifted/"));
|
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/","/By_Date/shifted/"));
|
||||||
video.load();
|
video.load();
|
||||||
} else {
|
} else {
|
||||||
elem.setAttribute("src","images/shift.svg");
|
elem.setAttribute("src","images/shift.svg");
|
||||||
elem.setAttribute("title", "This file is not shifted in frequency.");
|
elem.setAttribute("title", "This file is not shifted in frequency.");
|
||||||
elem.setAttribute("onclick", elem.getAttribute("onclick").replace("unshift","shift"));
|
elem.setAttribute("onclick", elem.getAttribute("onclick").replace("unshift","shift"));
|
||||||
console.log("unshifted freqs of " + filename);
|
console.log("unshifted freqs of " + filename);
|
||||||
video=elem.parentNode.getElementsByTagName("video")[0];
|
video=elem.parentNode.getElementsByTagName("video")[0];
|
||||||
video.setAttribute("title", video.getAttribute("title").replace("/By_Date/shifted/","/By_Date/"));
|
video.setAttribute("title", video.getAttribute("title").replace("/By_Date/shifted/","/By_Date/"));
|
||||||
source = video.getElementsByTagName("source")[0];
|
source = video.getElementsByTagName("source")[0];
|
||||||
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/shifted/","/By_Date/"));
|
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/shifted/","/By_Date/"));
|
||||||
video.load();
|
video.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,22 +325,76 @@ if(!isset($_GET['species']) && !isset($_GET['filename'])){
|
|||||||
|
|
||||||
#By Species
|
#By Species
|
||||||
} elseif($view == "byspecies") {
|
} elseif($view == "byspecies") {
|
||||||
while($results=$result->fetchArray(SQLITE3_ASSOC)){
|
$birds = array();
|
||||||
|
while($results=$result->fetchArray(SQLITE3_ASSOC))
|
||||||
|
{
|
||||||
$name = $results['Com_Name'];
|
$name = $results['Com_Name'];
|
||||||
|
$birds[] = $name;
|
||||||
echo "<td>
|
|
||||||
<button action=\"submit\" name=\"species\" value=\"$name\">$name</button></td></tr>";}
|
|
||||||
|
|
||||||
#Specific Date
|
|
||||||
} elseif($view == "date") {
|
|
||||||
while($results=$result->fetchArray(SQLITE3_ASSOC)){
|
|
||||||
$name = $results['Com_Name'];
|
|
||||||
if(realpath($home."/BirdSongs/Extracted/By_Date/".$date."/".str_replace(" ", "_",$name)) !== false){
|
|
||||||
echo "<td>
|
|
||||||
<button action=\"submit\" name=\"species\" value=\"$name\">$name</button></td></tr>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($birds) > 45) {
|
||||||
|
$num_cols = 3;
|
||||||
|
} else {
|
||||||
|
$num_cols = 1;
|
||||||
|
}
|
||||||
|
$num_rows = ceil(count($birds) / $num_cols);
|
||||||
|
|
||||||
|
for ($row = 0; $row < $num_rows; $row++) {
|
||||||
|
echo "<tr>";
|
||||||
|
|
||||||
|
for ($col = 0; $col < $num_cols; $col++) {
|
||||||
|
$index = $row + $col * $num_rows;
|
||||||
|
|
||||||
|
if ($index < count($birds)) {
|
||||||
|
?>
|
||||||
|
<td class="spec">
|
||||||
|
<button type="submit" name="species" value="<?php echo $birds[$index];?>"><?php echo $birds[$index];?></button>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo "<td></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
} elseif($view == "date") {
|
||||||
|
$birds = array();
|
||||||
|
while($results=$result->fetchArray(SQLITE3_ASSOC))
|
||||||
|
{
|
||||||
|
$name = $results['Com_Name'];
|
||||||
|
if(realpath($home."/BirdSongs/Extracted/By_Date/".$date."/".str_replace(" ", "_",$name)) !== false){
|
||||||
|
$birds[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($birds) > 45) {
|
||||||
|
$num_cols = 3;
|
||||||
|
} else {
|
||||||
|
$num_cols = 1;
|
||||||
|
}
|
||||||
|
$num_rows = ceil(count($birds) / $num_cols);
|
||||||
|
|
||||||
|
for ($row = 0; $row < $num_rows; $row++) {
|
||||||
|
echo "<tr>";
|
||||||
|
|
||||||
|
for ($col = 0; $col < $num_cols; $col++) {
|
||||||
|
$index = $row + $col * $num_rows;
|
||||||
|
|
||||||
|
if ($index < count($birds)) {
|
||||||
|
?>
|
||||||
|
<td class="spec">
|
||||||
|
<button type="submit" name="species" value="<?php echo $birds[$index];?>"><?php echo $birds[$index];?></button>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo "<td></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
#Choose
|
#Choose
|
||||||
} else {
|
} else {
|
||||||
echo "<td>
|
echo "<td>
|
||||||
@@ -452,7 +506,7 @@ echo "<table>
|
|||||||
$shiftImageIcon = "images/unshift.svg";
|
$shiftImageIcon = "images/unshift.svg";
|
||||||
$shiftTitle = "This file has been shifted down in frequency.";
|
$shiftTitle = "This file has been shifted down in frequency.";
|
||||||
$shiftAction = "unshift";
|
$shiftAction = "unshift";
|
||||||
$filename = $filename_shifted;
|
$filename = $filename_shifted;
|
||||||
} else {
|
} else {
|
||||||
$shiftImageIcon = "images/shift.svg";
|
$shiftImageIcon = "images/shift.svg";
|
||||||
$shiftTitle = "This file is not shifted in frequency.";
|
$shiftTitle = "This file is not shifted in frequency.";
|
||||||
@@ -460,7 +514,7 @@ echo "<table>
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td class=\"relative\">
|
<td class=\"relative\">
|
||||||
|
|
||||||
<img style='cursor:pointer;right:90px' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\")' class=\"copyimage\" width=25 title='Delete Detection'>
|
<img style='cursor:pointer;right:90px' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\")' class=\"copyimage\" width=25 title='Delete Detection'>
|
||||||
<img style='cursor:pointer;right:45px' onclick='toggleLock(\"".$filename_formatted."\",\"".$type."\", this)' class=\"copyimage\" width=25 title=\"".$title."\" src=\"".$imageicon."\">
|
<img style='cursor:pointer;right:45px' onclick='toggleLock(\"".$filename_formatted."\",\"".$type."\", this)' class=\"copyimage\" width=25 title=\"".$title."\" src=\"".$imageicon."\">
|
||||||
@@ -471,7 +525,7 @@ echo "<table>
|
|||||||
</tr>";
|
</tr>";
|
||||||
} else {
|
} else {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td class=\"relative\">$date $time<br>$confidence
|
<td class=\"relative\">$date $time<br>$confidence
|
||||||
<img style='cursor:pointer' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\")' class=\"copyimage\" width=25 title='Delete Detection'><br>
|
<img style='cursor:pointer' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\")' class=\"copyimage\" width=25 title='Delete Detection'><br>
|
||||||
".$imageelem."
|
".$imageelem."
|
||||||
</td>
|
</td>
|
||||||
@@ -527,7 +581,7 @@ echo "<table>
|
|||||||
$shiftImageIcon = "images/unshift.svg";
|
$shiftImageIcon = "images/unshift.svg";
|
||||||
$shiftTitle = "This file has been shifted down in frequency.";
|
$shiftTitle = "This file has been shifted down in frequency.";
|
||||||
$shiftAction = "unshift";
|
$shiftAction = "unshift";
|
||||||
$filename = $filename_shifted;
|
$filename = $filename_shifted;
|
||||||
} else {
|
} else {
|
||||||
$shiftImageIcon = "images/shift.svg";
|
$shiftImageIcon = "images/shift.svg";
|
||||||
$shiftTitle = "This file is not shifted in frequency.";
|
$shiftTitle = "This file is not shifted in frequency.";
|
||||||
@@ -535,7 +589,7 @@ echo "<table>
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td class=\"relative\">
|
<td class=\"relative\">
|
||||||
|
|
||||||
<img style='cursor:pointer;right:90px' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\", true)' class=\"copyimage\" width=25 title='Delete Detection'>
|
<img style='cursor:pointer;right:90px' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\", true)' class=\"copyimage\" width=25 title='Delete Detection'>
|
||||||
<img style='cursor:pointer;right:45px' onclick='toggleLock(\"".$filename_formatted."\",\"".$type."\", this)' class=\"copyimage\" width=25 title=\"".$title."\" src=\"".$imageicon."\">
|
<img style='cursor:pointer;right:45px' onclick='toggleLock(\"".$filename_formatted."\",\"".$type."\", this)' class=\"copyimage\" width=25 title=\"".$title."\" src=\"".$imageicon."\">
|
||||||
@@ -545,7 +599,7 @@ echo "<table>
|
|||||||
</tr>";
|
</tr>";
|
||||||
} else {
|
} else {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td class=\"relative\">$date $time<br>$confidence
|
<td class=\"relative\">$date $time<br>$confidence
|
||||||
<img style='cursor:pointer' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\", true)' class=\"copyimage\" width=25 title='Delete Detection'><br>
|
<img style='cursor:pointer' src='images/delete.svg' onclick='deleteDetection(\"".$filename_formatted."\", true)' class=\"copyimage\" width=25 title='Delete Detection'><br>
|
||||||
<video onplay='setLiveStreamVolume(0)' onended='setLiveStreamVolume(1)' onpause='setLiveStreamVolume(1)' controls poster=\"$filename_png\" preload=\"none\" title=\"$filename\"><source src=\"$filename\"></video></td>
|
<video onplay='setLiveStreamVolume(0)' onended='setLiveStreamVolume(1)' onpause='setLiveStreamVolume(1)' controls poster=\"$filename_png\" preload=\"none\" title=\"$filename\"><source src=\"$filename\"></video></td>
|
||||||
</tr>";
|
</tr>";
|
||||||
@@ -553,4 +607,13 @@ echo "<table>
|
|||||||
|
|
||||||
}echo "</table>";}?>
|
}echo "</table>";}?>
|
||||||
</div>
|
</div>
|
||||||
|
<style>
|
||||||
|
td.spec {
|
||||||
|
width: calc(100% / <?php echo $num_cols;?>);
|
||||||
|
}
|
||||||
|
tr:first-child td.spec {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+52
-19
@@ -87,26 +87,59 @@ if(!file_exists($home."/BirdNET-Pi/scripts/disk_check_exclude.txt") || strpos(fi
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table style="padding-top:10px">
|
||||||
<?php
|
<?php
|
||||||
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
$birds = array();
|
||||||
{
|
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
{
|
||||||
$comname = preg_replace('/\'/', '', $comname);
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
$filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
|
$comname = preg_replace('/\'/', '', $comname);
|
||||||
?>
|
$filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
|
||||||
<tr>
|
$birds[] = $results['Com_Name'];
|
||||||
<form action="" method="GET">
|
}
|
||||||
<td><input type="hidden" name="sort" value="<?php if(isset($_GET['sort'])){echo $_GET['sort'];}?>">
|
|
||||||
<input type="hidden" name="view" value="Species Stats">
|
if(count($birds) > 45) {
|
||||||
<button type="submit" name="species" value="<?php echo $results['Com_Name'];?>"><?php echo $results['Com_Name'];?></button>
|
$num_cols = 3;
|
||||||
</td>
|
} else {
|
||||||
<?php
|
$num_cols = 1;
|
||||||
}
|
}
|
||||||
?>
|
$num_rows = ceil(count($birds) / $num_cols);
|
||||||
</form>
|
|
||||||
</tr>
|
for ($row = 0; $row < $num_rows; $row++) {
|
||||||
|
echo "<tr>";
|
||||||
|
|
||||||
|
for ($col = 0; $col < $num_cols; $col++) {
|
||||||
|
$index = $row + $col * $num_rows;
|
||||||
|
|
||||||
|
if ($index < count($birds)) {
|
||||||
|
?>
|
||||||
|
<td>
|
||||||
|
<form action="" method="GET">
|
||||||
|
<input type="hidden" name="sort" value="<?php if(isset($_GET['sort'])){echo $_GET['sort'];}?>">
|
||||||
|
<input type="hidden" name="view" value="Species Stats">
|
||||||
|
<button type="submit" name="species" value="<?php echo $birds[$index];?>"><?php echo $birds[$index];?></button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo "<td></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
<style>
|
||||||
|
td {
|
||||||
|
padding: 0px;
|
||||||
|
width: calc(100% / <?php echo $num_cols;?>);
|
||||||
|
}
|
||||||
|
tr:first-child td {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<dialog id="attribution-dialog">
|
<dialog id="attribution-dialog">
|
||||||
<h1 id="modalHeading"></h1>
|
<h1 id="modalHeading"></h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user