From 8f158832988f3d4a3e220be114c15999c8c18a54 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 28 Jan 2023 12:08:50 -0500 Subject: [PATCH] Update server.py --- scripts/server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/server.py b/scripts/server.py index e62c578..6aa5b86 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -321,7 +321,7 @@ def writeResultsToFile(detections, min_conf, path): for d in detections: for entry in detections[d]: if entry[1] >= min_conf and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0) and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0) and (entry[0] in PREDICTED_SPECIES_LIST or len(PREDICTED_SPECIES_LIST) == 0) ): - rfile.write(d + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + '\n') + rfile.write(d + ';' + entry[0].replace('_', ';').split("/")[0] + ';' + str(entry[1]) + '\n') rcnt += 1 print('DONE! WROTE', rcnt, 'RESULTS.') return @@ -444,14 +444,14 @@ def handle_client(conn, addr): if entry[1] >= min_conf and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0) and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0) and (entry[0] in PREDICTED_SPECIES_LIST or len(PREDICTED_SPECIES_LIST) == 0) ): # Write to text file. - rfile.write(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' + rfile.write(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';').split("/")[0] + ';' + str(entry[1]) + ";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' + str(args.sensitivity) + ';' + str(args.overlap) + '\n') # Write to database Date = str(current_date) Time = str(current_time) - species = entry[0] + species = entry[0].split("/")[0] Sci_Name, Com_Name = species.split('_') score = entry[1] Confidence = str(round(score * 100)) @@ -553,7 +553,7 @@ def handle_client(conn, addr): 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_commonName = "\"commonName\": \"" + entry[0].split('_')[1].split("/")[0] + "\"," post_scientificName = "\"scientificName\": \"" + entry[0].split('_')[0] + "\"," if model == "BirdNET_GLOBAL_3K_V2.2_Model_FP16":