Readable output for sndid
parent
f5c03c04cd
commit
c518ebd655
37
sndid.py
37
sndid.py
|
@ -92,6 +92,16 @@ parser.add_argument(
|
||||||
default="0.50",
|
default="0.50",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-l",
|
||||||
|
"--list",
|
||||||
|
help="Output as human readable list not terse (default True)",
|
||||||
|
action=argparse.BooleanOptionalAction,
|
||||||
|
type=bool,
|
||||||
|
required=False,
|
||||||
|
default=True,
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
INFILE = args.input
|
INFILE = args.input
|
||||||
LAT = args.latitude
|
LAT = args.latitude
|
||||||
|
@ -100,6 +110,7 @@ YEAR = args.year
|
||||||
MONTH = args.month
|
MONTH = args.month
|
||||||
DAY = args.day
|
DAY = args.day
|
||||||
CONFIDENCE = args.confidence
|
CONFIDENCE = args.confidence
|
||||||
|
LIST = args.list
|
||||||
|
|
||||||
f = io.StringIO()
|
f = io.StringIO()
|
||||||
with redirect_stdout(f), redirect_stderr(f):
|
with redirect_stdout(f), redirect_stderr(f):
|
||||||
|
@ -118,4 +129,28 @@ f = io.StringIO()
|
||||||
with redirect_stdout(f), redirect_stderr(f):
|
with redirect_stdout(f), redirect_stderr(f):
|
||||||
recording.analyze()
|
recording.analyze()
|
||||||
|
|
||||||
print(recording.detections)
|
if LIST:
|
||||||
|
i = 0
|
||||||
|
species_sort = ""
|
||||||
|
for i in range(0, len(recording.detections)):
|
||||||
|
species_sort = species_sort + (
|
||||||
|
recording.detections[i]["common_name"]
|
||||||
|
+ ", "
|
||||||
|
+ recording.detections[i]["scientific_name"]
|
||||||
|
+ ", "
|
||||||
|
+ str(recording.detections[i]["start_time"])
|
||||||
|
+ ", "
|
||||||
|
+ str(recording.detections[i]["end_time"])
|
||||||
|
+ ", "
|
||||||
|
+ str(recording.detections[i]["confidence"])
|
||||||
|
+ "\n"
|
||||||
|
)
|
||||||
|
species_out = sorted(species_sort.split("\n"))
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
for i in range(1, len(species_out)):
|
||||||
|
print(species_out[i])
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(recording.detections)
|
||||||
|
|
Loading…
Reference in New Issue