I like this so far
This commit is contained in:
@@ -3344,7 +3344,7 @@ function fm_show_nav_path($path)
|
||||
<nav class="navbar navbar-expand-lg <?php echo $getTheme; ?> mb-4 main-nav <?php echo $isStickyNavBar ?>">
|
||||
<a class="navbar-brand" href="../../">BirdNET-Pi Homepage </a>
|
||||
<a class="navbar-brand" href="../"><?php echo lng('Tools'); ?></a>
|
||||
<a class="navbar-brand" href="http://birdnetpi.local:8888" target="_"><?php echo lng('WebTerminal'); ?></a>
|
||||
<a class="navbar-brand" href="https://webterminal.pmcgui.xyz" target="_"><?php echo lng('WebTerminal'); ?></a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/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 \
|
||||
set -x
|
||||
first_call=$(lynx -accept-all-cookies -dump -listonly "https://commons.wikimedia.org/w/index.php?search=${1//_/+}&title=Special:MediaSearch&go=Go&type=image")
|
||||
lynx -dump -listonly -accept-all-cookies\
|
||||
$(echo "$first_call" \
|
||||
| sed '11q;d' \
|
||||
| awk '{print $2}' ) \
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ a {
|
||||
</div>
|
||||
<div class="column second">
|
||||
<<<<<<< Updated upstream
|
||||
<form action="http://birdnetpi.local:8080" target="top">
|
||||
<form action="https://birdnetlog.pmcgui.xyz" target="top">
|
||||
=======
|
||||
<form action="http://192.168.0.100:8888" target="top">
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
@@ -44,6 +44,7 @@ if($statement4 == False) {
|
||||
$result4 = $statement4->execute();
|
||||
$mostrecent = $result4->fetchArray(SQLITE3_ASSOC);
|
||||
$comname = preg_replace('/ /', '_', $mostrecent['Com_Name']);
|
||||
$sciname = preg_replace('/ /', '_', $mostrecent['Sci_Name']);
|
||||
$comname = preg_replace('/\'/', '', $comname);
|
||||
$filename = "/By_Date/".$mostrecent['Date']."/".$comname."/".$mostrecent['File_Name'];
|
||||
|
||||
@@ -79,7 +80,7 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
||||
<tr>
|
||||
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
||||
<form action="" method="POST">
|
||||
<td><input type="hidden" name="view" value="Extractions"><button type="submit" name="date" value="<?php echo date('Y-m-d');?>"><?php echo $todaycount['COUNT(*)'];?></button></td>
|
||||
<td><input type="hidden" name="view" value="Recordings"><button type="submit" name="date" value="<?php echo date('Y-m-d');?>"><?php echo $todaycount['COUNT(*)'];?></button></td>
|
||||
</form>
|
||||
<td><?php echo $hourcount['COUNT(*)'];?></td>
|
||||
<form action="" method="POST">
|
||||
@@ -100,7 +101,7 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $mostrecent['Date']."<br>".$mostrecent['Time'];?></td>
|
||||
<td><a href="https://wikipedia.org/wiki/<?php echo $scilink;?>" target="top"/><?php echo $mostrecent['Sci_Name'];?></a></td>
|
||||
<td><a href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="_blank"/><?php echo $mostrecent['Sci_Name'];?></a></td>
|
||||
<form action="" method="POST">
|
||||
<td>
|
||||
<input type="hidden" name="view" value="Species Stats">
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))
|
||||
<tr>
|
||||
<form action="" method="POST">
|
||||
<td>
|
||||
<input type="hidden" name="view" value="Extractions">
|
||||
<input type="hidden" name="view" value="Recordings">
|
||||
<?php
|
||||
if($view == "bydate"){
|
||||
$date = $results['Date'];
|
||||
|
||||
+38
-37
@@ -367,44 +367,45 @@ def handle_client(conn, addr):
|
||||
print(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + ';' + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' + str(args.sensitivity) +';' + str(args.overlap) + Com_Name.replace(" ", "_") + '-' + str(score) + '-' + str(current_date) + '-birdnet-' + str(current_time) + audiofmt + '\n')
|
||||
|
||||
if birdweather_id != "99999":
|
||||
try:
|
||||
|
||||
if soundscape_uploaded is False:
|
||||
# POST soundscape to server
|
||||
soundscape_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/soundscapes" + "?timestamp=" + current_iso8601
|
||||
|
||||
with open(args.i, 'rb') as f:
|
||||
wav_data = f.read()
|
||||
response = requests.post(url=soundscape_url, data=wav_data, headers={'Content-Type': 'application/octet-stream'})
|
||||
print("Soundscape POST Response Status - ", response.status_code)
|
||||
sdata = response.json()
|
||||
soundscape_id = sdata['soundscape']['id']
|
||||
soundscape_uploaded = True
|
||||
|
||||
# POST detection to server
|
||||
detection_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/detections"
|
||||
start_time = d.split(';')[0]
|
||||
end_time = d.split(';')[1]
|
||||
post_begin = "{ "
|
||||
now_p_start = now + datetime.timedelta(seconds=float(start_time))
|
||||
current_iso8601 = now_p_start.astimezone(get_localzone()).isoformat()
|
||||
post_timestamp = "\"timestamp\": \"" + current_iso8601 + "\","
|
||||
post_lat = "\"lat\": " + str(args.lat) + ","
|
||||
post_lon = "\"lon\": " + str(args.lon) + ","
|
||||
post_soundscape_id = "\"soundscapeId\": " + str(soundscape_id) + ","
|
||||
post_soundscape_start_time = "\"soundscapeStartTime\": " + start_time + ","
|
||||
post_soundscape_end_time = "\"soundscapeEndTime\": " + end_time + ","
|
||||
post_commonName = "\"commonName\": \"" + entry[0].split('_')[1] + "\","
|
||||
post_scientificName = "\"scientificName\": \"" + entry[0].split('_')[0] + "\","
|
||||
post_algorithm = "\"algorithm\": " + "\"alpha\"" + ","
|
||||
post_confidence = "\"confidence\": " + str(entry[1])
|
||||
post_end = " }"
|
||||
|
||||
post_json = post_begin + post_timestamp + post_lat + post_lon + post_soundscape_id + post_soundscape_start_time + post_soundscape_end_time + post_commonName + post_scientificName + post_algorithm + post_confidence + post_end
|
||||
print(post_json)
|
||||
response = requests.post(detection_url, json=json.loads(post_json))
|
||||
print("Detection POST Response Status - ", response.status_code)
|
||||
|
||||
|
||||
if soundscape_uploaded is False:
|
||||
# POST soundscape to server
|
||||
soundscape_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/soundscapes" + "?timestamp=" + current_iso8601
|
||||
|
||||
with open(args.i, 'rb') as f:
|
||||
wav_data = f.read()
|
||||
response = requests.post(url=soundscape_url, data=wav_data, headers={'Content-Type': 'application/octet-stream'})
|
||||
print("Soundscape POST Response Status - ", response.status_code)
|
||||
sdata = response.json()
|
||||
soundscape_id = sdata['soundscape']['id']
|
||||
soundscape_uploaded = True
|
||||
|
||||
# POST detection to server
|
||||
detection_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/detections"
|
||||
start_time = d.split(';')[0]
|
||||
end_time = d.split(';')[1]
|
||||
post_begin = "{ "
|
||||
now_p_start = now + datetime.timedelta(seconds=float(start_time))
|
||||
current_iso8601 = now_p_start.astimezone(get_localzone()).isoformat()
|
||||
post_timestamp = "\"timestamp\": \"" + current_iso8601 + "\","
|
||||
post_lat = "\"lat\": " + str(args.lat) + ","
|
||||
post_lon = "\"lon\": " + str(args.lon) + ","
|
||||
post_soundscape_id = "\"soundscapeId\": " + str(soundscape_id) + ","
|
||||
post_soundscape_start_time = "\"soundscapeStartTime\": " + start_time + ","
|
||||
post_soundscape_end_time = "\"soundscapeEndTime\": " + end_time + ","
|
||||
post_commonName = "\"commonName\": \"" + entry[0].split('_')[1] + "\","
|
||||
post_scientificName = "\"scientificName\": \"" + entry[0].split('_')[0] + "\","
|
||||
post_algorithm = "\"algorithm\": " + "\"alpha\"" + ","
|
||||
post_confidence = "\"confidence\": " + str(entry[1])
|
||||
post_end = " }"
|
||||
|
||||
post_json = post_begin + post_timestamp + post_lat + post_lon + post_soundscape_id + post_soundscape_start_time + post_soundscape_end_time + post_commonName + post_scientificName + post_algorithm + post_confidence + post_end
|
||||
print(post_json)
|
||||
response = requests.post(detection_url, json=json.loads(post_json))
|
||||
print("Detection POST Response Status - ", response.status_code)
|
||||
except:
|
||||
print("Cannot POST right now")
|
||||
conn.send(myReturn.encode(FORMAT))
|
||||
|
||||
#time.sleep(3)
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
<?php
|
||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
||||
}
|
||||
$refresh = $config['RECORDING_LENGTH'];
|
||||
$time = time();
|
||||
echo "<img src=\"/spectrogram.png?nocache=$time\">";
|
||||
header("Refresh: $refresh;");
|
||||
?>
|
||||
|
||||
+16
-11
@@ -98,26 +98,31 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){
|
||||
$dbsciname = preg_replace('/ /', '_', $sciname);
|
||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||
$comname = preg_replace('/\'/', '', $comname);
|
||||
$linkname = preg_replace('/_/', '+', $dbsciname);
|
||||
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
||||
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbsciname");
|
||||
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbsciname");
|
||||
echo str_pad("<tr>
|
||||
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>$sciname</a></td>
|
||||
<td>$count</td>
|
||||
<td>$maxconf</td>
|
||||
<td>$date $time <audio controls><source src=\"$filename\"></audio></td>
|
||||
<td>$date $time<br><audio controls><source src=\"$filename\"></audio></td>
|
||||
<td><a href=\"https://allaboutbirds.org/guide/$comname\" target=\"top\"/>All About Birds</a></td>
|
||||
</tr>
|
||||
</table>", '4096');
|
||||
ob_flush();
|
||||
flush();
|
||||
echo str_pad("<img class=\"center\" src=\"$imagelink\">
|
||||
<pre>$imagecitation</pre></td>
|
||||
</div>
|
||||
</div>
|
||||
</div>", '4096');
|
||||
</table>
|
||||
<p>Loading Images from https://commons.wikimedia.org/w/index.php?search=$linkname&title=Special:MediaSearch&go=Go&type=image</p>", '6096');
|
||||
|
||||
ob_flush();
|
||||
flush();
|
||||
$imagelink = "https://commons.wikimedia.org/w/index.php?search=$linkname&title=Special:MediaSearch&go=Go&type=image";
|
||||
$homepage = file_get_contents($imagelink);
|
||||
preg_match_all("{<img\\s*(.*?)src=('.*?'|\".*?\"|[^\\s]+)(.*?)\\s*/?>}ims", $homepage, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $val) {
|
||||
$pos = strpos($val[2],"/");
|
||||
$link = substr($val[2],1,-1);
|
||||
if($pos == 1)
|
||||
echo "http://domain.com" . $link;
|
||||
elseif(strpos($link, "upload") == true)
|
||||
echo "<img src=\"$link\">";
|
||||
}
|
||||
}}
|
||||
?>
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
||||
<tr>
|
||||
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
||||
<form action="" method="POST">
|
||||
<td><input type="hidden" name="view" value="Extractions"><button type="submit" name="date" value="<?php echo date('Y-m-d');?>"><?php echo $todaycount['COUNT(*)'];?></button></td>
|
||||
<td><input type="hidden" name="view" value="Recordings"><button type="submit" name="date" value="<?php echo date('Y-m-d');?>"><?php echo $todaycount['COUNT(*)'];?></button></td>
|
||||
</form>
|
||||
<td><?php echo $hourcount['COUNT(*)'];?></td>
|
||||
<form action="" method="POST">
|
||||
|
||||
Reference in New Issue
Block a user