Update analyze.py
Default (no station_id specified) won't POST to BirdWeather API.
This commit is contained in:
+7
-4
@@ -192,7 +192,7 @@ def main():
|
||||
|
||||
# Parse passed arguments
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--s', type=int, default=99, help='BirdWeather station id.')
|
||||
parser.add_argument('--s', type=int, default=99999, help='BirdWeather station id.')
|
||||
parser.add_argument('--i', help='Path to input file.')
|
||||
parser.add_argument('--o', default='result.csv', help='Path to output file. Defaults to result.csv.')
|
||||
parser.add_argument('--lat', type=float, default=-1, help='Recording location latitude. Set -1 to ignore.')
|
||||
@@ -221,8 +221,8 @@ def main():
|
||||
# Read audio data
|
||||
audioData = readAudioData(args.i, args.overlap)
|
||||
|
||||
# Get Date/Time from filename in case Pi gets behind
|
||||
#now = datetime.now()
|
||||
|
||||
full_file_name = args.i
|
||||
file_name = Path(full_file_name).stem
|
||||
file_date = file_name.split('-birdnet-')[0]
|
||||
@@ -238,10 +238,11 @@ def main():
|
||||
current_iso8601 = now.isoformat()
|
||||
|
||||
week_number = int(now.strftime("%V"))
|
||||
# Process audio data and get detections
|
||||
#week = max(1, min(args.week, 48))
|
||||
week = max(1, min(week_number, 48))
|
||||
|
||||
sensitivity = max(0.5, min(1.0 - (args.sensitivity - 1.0), 1.5))
|
||||
|
||||
# Process audio data and get detections
|
||||
detections = analyzeAudioData(audioData, args.lat, args.lon, week, sensitivity, args.overlap, interpreter)
|
||||
|
||||
# Write detections to output file
|
||||
@@ -298,6 +299,8 @@ def main():
|
||||
|
||||
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) + '\n')
|
||||
|
||||
if station_id != 99999:
|
||||
|
||||
if soundscape_uploaded is False:
|
||||
# POST soundscape to server
|
||||
post_url = "https://app.birdweather.com/api/v1/soundscapes" + "?timestamp=" + current_iso8601
|
||||
|
||||
Reference in New Issue
Block a user