Added recording list (download link and shortcut to Larynx

This commit is contained in:
Samuel Ortion 2021-04-08 12:44:50 +02:00
parent 7b16503314
commit 341a3e4c73
9 changed files with 117 additions and 22 deletions

View File

@ -4,23 +4,7 @@ ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
$root = realpath($_SERVER["DOCUMENT_ROOT"]); $root = realpath($_SERVER["DOCUMENT_ROOT"]);
// require "$root/database/credentials.php";
// // Connect the database
// try {
// $db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
// $user,
// $password,
// array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
// ));
// } catch (Exception $e) {
// die("Error : ".$e->getMessage());
// }
// $req = $db->prepare('SELECT id, recordist_name, file_name, license, species, sound_type, date, time FROM `records` WHERE species="unknown" ORDER BY `entry_timestamp` ASC LIMIT 1');
// $req->execute();
// $result = $req->fetchAll();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -39,6 +23,9 @@ include("$root/analytics/matomo.php");
<section> <section>
<h3>Explore</h3> <h3>Explore</h3>
<ul> <ul>
<a href="list">
<li>List Uploaded Recording</li>
</a>
<a href="search"> <a href="search">
<li>Advanced Search</li> <li>Advanced Search</li>
</a> </a>

View File

@ -0,0 +1,84 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
$version = "1.0";
require "$root/database/credentials.php";
// Connect the database
try {
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
$user,
$password,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
} catch (Exception $e) {
die("Error : ".$e->getMessage());
}
$req = $db->prepare('SELECT * FROM records ORDER BY date');
$req->execute();
$result = $req->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<?php include("$root/analytics/matomo.php");?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>
<section>
<h2>Explore</h2>
<h3>Recording List</h3>
<table id="list">
<thead>
<tr>
<th>Datetime</th>
<th>Species</th>
<th>File Name</th>
<th>Author</th>
<th>License</th>
<th>Audio</th>
</tr>
</thead>
<tbody>
<?php
foreach($result as $row) {
$author_id = $row['author_id'];
$req = $db->prepare('SELECT * FROM authors WHERE id=:id');
$req->execute(array(
"id"=>$author_id
));
if ($data = $req->fetch()) {
$username = $data['username'];
}
?>
<tr>
<td><?=$row['date']?> <?=$row['time']?></td>
<td><em><?=$row['species']?></em></td>
<td>
<a href="/explore/spectrograms/?record=<?=$row['id']?>"><?=$row['file_name']?></a>
<a href="/storage/records/<?=$row['file_name']?>" title="Download file"><i class="fa fa-download"></i></a>
<a href="/larynx/?record=<?=$row['id']?>"><img src="/media/icons/wave.svg" alt="spectro analysis" title="Open with Larynx"></a>
</td>
<td><?=$username?></td>
<td><?=$row['license']?></td>
<td><audio src="/storage/records/<?=$row['file_name']?>" controls></audio></td>
</tr>
<?php
}
?>
</tbody>
</table>
</section>
<?php include("$root/footer.php");?>
</body>
<script src="/scripts/script.js"></script>
</html>

View File

@ -84,13 +84,14 @@ if ($_SESSION['error_msg'] == "") {
$sql .= ' date<='.$_SESSION['query']['date-before']; $sql .= ' date<='.$_SESSION['query']['date-before'];
} }
if (isset($_SESSION['query']['keywords'])) { if (isset($_SESSION['query']['keywords'])) {
$sql .= " remarks ";
$and = False; $and = False;
foreach ($_SESSION['query']['keywords'] as $keyword) { foreach ($_SESSION['query']['keywords'] as $keyword) {
if ($keyword != ""){ if ($keyword != ""){
if ($and) { if ($and) {
$sql .= " AND "; $sql .= " AND ";
} }
$sql .= "LIKE %$keyword%"; $sql .= " LIKE '%$keyword%' ";
} }
$and = True; $and = True;
} }

View File

@ -58,10 +58,10 @@ include("$root/analytics/matomo.php");
<?php <?php
} }
?> ?>
<!-- <div id="waveform"></div> <div id="waveform"></div>
<div id="wave-spectrogram"></div> --> <div id="wave-spectrogram"></div>
<canvas class="spectrogram"></canvas> <!-- <canvas class="spectrogram"></canvas> -->
<canvas class="waveform"></canvas> <!-- <canvas class="waveform"></canvas> -->
<br> <br>
<audio src="<?="/storage/records/".$data['file_name']?>" id="audio"></audio> <audio src="<?="/storage/records/".$data['file_name']?>" id="audio"></audio>

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><g transform="translate(0.000000,511.000000) scale(0.100000,-0.100000)"><path d="M3947.3,4837.4c-587.6-67-1255.6-310.1-1747.5-637.4C1237,3558.8,613,2578.8,433,1420.8c-44-285.2-44-861.3,0-1146.5c32.5-204.8,134-637.4,157-658.4c11.5-11.5,49.8,28.7,336.9,346.5L1076.2,125l-32.5,170.3c-40.2,214.4-44,828.8-9.6,1050.8c258.4,1604,1550.4,2792.6,3148.6,2897.9c1718.8,114.8,3232.9-1052.7,3577.4-2758.2c38.3-185.7,44-275.6,44-637.4s-5.7-451.7-44-637.4C7647.1-347.8,7411.7-855,7065.3-1285.7c-1165.7-1447-3246.3-1697.8-4735.4-568.5c-187.6,143.6-484.3,438.3-610.6,606.8c-49.8,68.9-97.6,124.4-105.3,124.4c-5.7,0-101.5-97.6-210.5-216.3c-231.6-252.7-231.6-206.7-3.8-470.9c313.9-367.5,752.2-702.5,1217.3-936c359.8-178,702.5-290.9,1129.3-369.4c225.9-42.1,865.2-57.4,1114-28.7c633.5,74.6,1244.1,296.7,1766.7,645c118.7,78.5,220.1,141.7,225.9,141.7c7.7,0,74.6-63.2,151.2-137.8l139.7-139.7l379,379l377.1,377.1l-145.5,145.5L7608.9-1590l143.6,214.4c78.5,118.7,197.1,325.4,264.1,461.3c888.1,1822.2,287.1,4006.2-1412.6,5124c-493.8,325.4-1087.2,543.6-1686.3,620.2C4676.5,4860.4,4188.4,4864.2,3947.3,4837.4z"/><path d="M9209,3009.5c-373.2-281.4-683.3-514.9-691-522.5c-15.3-15.3,132.1-453.6,151.2-446c7.6,3.8,289,210.5,622.1,459.4l606.8,453.6l1.9,283.3c0,155-3.8,281.4-7.7,281.4C9888.5,3518.6,9580.4,3289,9209,3009.5z"/><path d="M4959.8,3313.8c-26.8-17.2-59.3-45.9-70.8-65.1c-13.4-19.1-243.1-851.8-511.1-1849C4108,402.6,3882.2-435.8,3874.5-460.7c-13.4-36.3-88.1,97.6-451.7,803.9c-241.2,467-463.2,876.6-491.9,907.3c-47.9,47.9-70.8,57.4-151.2,57.4c-88,0-101.4-5.7-189.5-95.7c-53.6-51.7-633.6-689.1-1292-1416.4L100-1524.9v-335v-335l74.6,76.6c40.2,42.1,627.8,689.1,1303.5,1435.5C2155.7,65.7,2714.6,678.2,2720.4,682c7.7,1.9,235.4-426.8,509.1-955.1c271.8-526.4,511.1-980,530.2-1004.9c21-24.9,68.9-55.5,111-67c61.3-19.1,84.2-17.2,145.5,13.4c40.2,21.1,88.1,63.2,105.3,93.8c17.2,32.5,248.8,869,516.8,1860.5c333,1238.4,490,1793.5,501.5,1774.3c9.6-17.2,214.4-482.3,455.5-1035.5C5834.5,808.3,6047,339.4,6064.2,320.2c44-47.9,149.3-74.6,216.3-55.5c30.6,7.7,296.7,197.1,593.4,419.2c516.8,388.6,537.8,407.7,537.8,468.9c0,90-55.5,400-76.6,421.1c-7.7,7.7-233.5-149.3-509.1-359.8c-273.7-204.8-501.5-367.5-509.2-359.8c-7.6,7.7-233.5,520.6-501.5,1137c-595.3,1366.6-555.1,1282.4-622.1,1322.6C5124.4,3354,5024.9,3354,4959.8,3313.8z"/><path d="M7737.1-2481.9l-373.2-373.2l851.8-851.8c957-957,934.1-939.8,1177.1-924.5c164.6,11.5,264.1,59.3,371.3,179.9c95.7,109.1,145.5,258.4,130.1,394.3c-24.9,202.9-40.2,220.1-928.3,1112.1c-459.4,459.4-840.3,836.4-846,836.4S7941.9-2277.1,7737.1-2481.9z"/></g></g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="waveform-path" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" class="svg-inline--fa fa-waveform-path fa-w-20 fa-2x"><path fill="currentColor" d="M628 268h-52.09l-20.44-92.48a20 20 0 0 0-38.94-.07L484.75 315.7l-33-234.53a20 20 0 0 0-39.65.45l-29.5 250-42.79-314.35a20 20 0 0 0-39.62 0l-42.81 314.37-29.5-250a20 20 0 0 0-39.66-.44l-33 234.53-31.75-140.28a20 20 0 0 0-38.94.05L64.09 268H12a12 12 0 0 0-12 12v16a12 12 0 0 0 12 12h68a19.87 19.87 0 0 0 19.47-15.5l4.66-19.94 36.4 160c2.22 9.69 9.78 15.44 20.25 15.44h.22a19.94 19.94 0 0 0 18.75-17.16l26.5-189.36 29.85 252.91a20 20 0 0 0 39.68.34L320 170.36l44.19 324.37a20 20 0 0 0 39.69-.34l29.84-252.91 26.5 189.33A20 20 0 0 0 479.13 448c9.93.53 18.06-5.63 20.34-15.44l36.41-160 4.65 19.92A19.88 19.88 0 0 0 560 308h68a12 12 0 0 0 12-12v-16a12 12 0 0 0-12-12z" class=""></path></svg>

After

Width:  |  Height:  |  Size: 922 B

View File

@ -13,6 +13,9 @@
<a href="/upload"> <a href="/upload">
<li>upload</li> <li>upload</li>
</a> </a>
<a href="/larynx">
<li>larynx</li>
</a>
<a href="/forum"> <a href="/forum">
<li>forum</li> <li>forum</li>
</a> </a>

View File

@ -10,7 +10,6 @@ body {
header { header {
text-align: right; text-align: right;
padding: 0; padding: 0;
margin-top: 1em;
} }
header a { header a {
@ -381,3 +380,16 @@ table#replies td {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
table {
max-width: 100vw;
}
table#list {
position: absolute;
left: 0;
}
table img {
height: 1em;
}