adding image retrieval
This commit is contained in:
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# testing getting images dynamically
|
||||||
|
first_call=$(lynx -dump -listonly "https://commons.wikimedia.org/w/index.php?search=${1//_/+}&title=Special:MediaSearch&go=Go&type=image")
|
||||||
|
lynx -dump -nonumbers $(lynx -dump \
|
||||||
|
$(echo "$first_call" \
|
||||||
|
| sed '11q;d' \
|
||||||
|
| awk '{print $2}' ) \
|
||||||
|
| awk -F'. ' '/Cite/ {print $2}' \
|
||||||
|
| xargs echo -n) 2>&1 | grep -A10 'Chicago style' | grep -A10 -e '^$' | grep -B10 'CBE' | grep -B10 -e '^$'
|
||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# testing getting images dynamically
|
||||||
|
first_call=$(lynx -dump -listonly "https://commons.wikimedia.org/w/index.php?search=${1//_/+}&title=Special:MediaSearch&go=Go&type=image")
|
||||||
|
lynx -dump -listonly \
|
||||||
|
$(echo "$first_call" \
|
||||||
|
| sed '11q;d' \
|
||||||
|
| awk '{print $2}' ) \
|
||||||
|
| awk '/thumb/ {print $2}' \
|
||||||
|
| head -1 \
|
||||||
|
| xargs echo -n
|
||||||
+20
-6
@@ -119,6 +119,16 @@ a {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width:75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
font-size:large;
|
font-size:large;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
@@ -148,7 +158,7 @@ form {
|
|||||||
float: none;
|
float: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
input, label {
|
input, label, img {
|
||||||
width:100%;
|
width:100%;
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -226,19 +236,23 @@ while($rows=$stats ->fetch_assoc())
|
|||||||
while($rows = $specificstats->fetch_assoc()) {
|
while($rows = $specificstats->fetch_assoc()) {
|
||||||
$dbname = preg_replace('/ /', '_', $rows['Com_Name']);
|
$dbname = preg_replace('/ /', '_', $rows['Com_Name']);
|
||||||
$dbsciname = preg_replace('/ /', '_', $rows['Sci_Name']);
|
$dbsciname = preg_replace('/ /', '_', $rows['Sci_Name']);
|
||||||
|
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbname");
|
||||||
|
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbname");
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>";echo "<a href=\"../By_Common_Name/$dbname\"/>";echo $rows['Com_Name']; echo "</a></td>
|
<td>";echo "<a href=\"../By_Common_Name/$dbname\"/>";echo $rows['Com_Name']; echo "</a></td>
|
||||||
<td>";echo "<a href=\"../By_Scientific_Name/$dbsciname\"/>";echo $rows['Sci_Name']; echo "</a></td>
|
<td>";echo "<a href=\"../By_Scientific_Name/$dbsciname\"/>";echo $rows['Sci_Name']; echo "</a></td>
|
||||||
<td>";echo $rows['COUNT(*)'];echo "</td>
|
<td>";echo $rows['COUNT(*)'];echo "</td>
|
||||||
<td>";echo $rows['MAX(Confidence)'];echo "</td>
|
<td>";echo $rows['MAX(Confidence)'];echo "</td>
|
||||||
<td><a href=\"https://wikipedia.org/wiki/$dbname\" target=\"top\"/>Wikipedia</a>, <a href=\"https://allaboutbirds.org/guide/$dbname\" target=\"top\"/>All About Birds</a></td>
|
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>Wikipedia</a>, <a href=\"https://allaboutbirds.org/guide/$dbname\" target=\"top\"/>All About Birds</a>
|
||||||
</tr>";
|
</tr>
|
||||||
}}
|
|
||||||
?>
|
|
||||||
</table>
|
</table>
|
||||||
|
<img class=\"center\" src=\"$imagelink\">
|
||||||
|
<pre>";echo $imagecitation;echo "</pre></td>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>";
|
||||||
|
}}
|
||||||
|
?>
|
||||||
</section>
|
</section>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ while($rows=$mosttable ->fetch_assoc())
|
|||||||
<td><a href="/By_Scientific_Name/<?php echo $dbsciname;?>"/><?php echo $rows['Sci_Name'];?></a></td>
|
<td><a href="/By_Scientific_Name/<?php echo $dbsciname;?>"/><?php echo $rows['Sci_Name'];?></a></td>
|
||||||
<td><a href="/By_Common_Name/<?php echo $dbname;?>"/><?php echo $rows['Com_Name'];?></a></td>
|
<td><a href="/By_Common_Name/<?php echo $dbname;?>"/><?php echo $rows['Com_Name'];?></a></td>
|
||||||
<td><?php echo $Confidence;?></td>
|
<td><?php echo $Confidence;?></td>
|
||||||
<td><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $dbname;?>" target="top">All About Birds</a>, <a class="a2" href="https://wikipedia.org/wiki/<?php echo $dbname;?>" target="top">Wikipedia</a></td>
|
<td><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $dbname;?>" target="top">All About Birds</a>, <a class="a2" href="https://wikipedia.org/wiki/<?php echo $dbsciname;?>" target="top">Wikipedia</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user