reformat with black
parent
85fc60bf16
commit
233b33321b
238
xeno-crufto
238
xeno-crufto
|
@ -89,13 +89,13 @@ parser.add_argument(
|
|||
"""
|
||||
|
||||
# Need to create array
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--also",
|
||||
# help="an array with the identified background species in the recording",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
parser.add_argument(
|
||||
"--animal-seen",
|
||||
help="was the recorded animal seen?",
|
||||
|
@ -112,13 +112,13 @@ parser.add_argument(
|
|||
choices=["yes", "no", "unknown"],
|
||||
default="",
|
||||
)
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--bird-seen",
|
||||
# help="despite the field name (which was kept to ensure backwards compatibility), this field indicates whether the recorded animal was seen",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
parser.add_argument(
|
||||
"--cnt",
|
||||
help="the country where the recording was made (example: brazil)",
|
||||
|
@ -135,14 +135,14 @@ parser.add_argument(
|
|||
)
|
||||
parser.add_argument(
|
||||
"--dvc",
|
||||
help="recording device used (example: \"Panasonic RR-US300\")",
|
||||
help='recording device used (example: "Panasonic RR-US300")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--en",
|
||||
help="the English name of the species (example: \"Great Tinamou\")",
|
||||
help='the English name of the species (example: "Great Tinamou")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
|
@ -156,14 +156,14 @@ parser.add_argument(
|
|||
)
|
||||
parser.add_argument(
|
||||
"--file-name",
|
||||
help="the original file name of the audio file (example: \"XC483178-Tinamus tao_Rio Azul_1032.mp3\")",
|
||||
help='the original file name of the audio file (example: "XC483178-Tinamus tao_Rio Azul_1032.mp3")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--gen",
|
||||
help="the generic name of the species (example: \"Rhea\")",
|
||||
help='the generic name of the species (example: "Rhea")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
|
@ -190,20 +190,20 @@ parser.add_argument(
|
|||
required=False,
|
||||
default="",
|
||||
)
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--length",
|
||||
# help="the length of the recording in minutes (example: 1:49)",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
#parser.add_argument(
|
||||
# )
|
||||
# parser.add_argument(
|
||||
# "--lic",
|
||||
# help="the URL describing the license of this recording (example //creativecommons.org/licenses/by-sa/4.0/)",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
parser.add_argument(
|
||||
"--lng",
|
||||
help="the longitude of the recording in decimal coordinates (example: -67.7537)",
|
||||
|
@ -213,32 +213,32 @@ parser.add_argument(
|
|||
)
|
||||
parser.add_argument(
|
||||
"--loc",
|
||||
help="the name of the locality (example \"Araponga, Minas Gerais\")",
|
||||
help='the name of the locality (example "Araponga, Minas Gerais")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--method",
|
||||
help="the recording method (example: \"field recording\")",
|
||||
help='the recording method (example: "field recording")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--mic",
|
||||
help="microphone used (example: \"Telinga + AT4022\")",
|
||||
help='microphone used (example: "Telinga + AT4022")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
)
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--osci",
|
||||
# help="an object with the urls to the three versions of oscillograms",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
parser.add_argument(
|
||||
"--playback-used",
|
||||
help="was playback used to lure the animal?",
|
||||
|
@ -249,14 +249,14 @@ parser.add_argument(
|
|||
)
|
||||
parser.add_argument(
|
||||
"--q",
|
||||
help="the current quality rating for the recording (Letters A to E. Prepend > or < for better or worse than. Example: \">C\" for A and B.)",
|
||||
help='the current quality rating for the recording (Letters A to E. Prepend > or < for better or worse than. Example: ">C" for A and B.)',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--rec",
|
||||
help="the name of the recordist (example: \"Jeff Moe\")",
|
||||
help='the name of the recordist (example: "Jeff Moe")',
|
||||
type=str,
|
||||
required=False,
|
||||
default="",
|
||||
|
@ -290,13 +290,13 @@ parser.add_argument(
|
|||
required=False,
|
||||
default="",
|
||||
)
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--sono",
|
||||
# help="an object with the urls to the four versions of sonograms",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
parser.add_argument(
|
||||
"--sp",
|
||||
help="the specific name (epithet) of the species (example: obsoletus)",
|
||||
|
@ -316,7 +316,7 @@ parser.add_argument(
|
|||
help="the life stage of the animal",
|
||||
type=str,
|
||||
required=False,
|
||||
choices=["adult", "juvenile", "nesting", "nymph", "subadult", "unknown"],
|
||||
choices=["adult", "juvenile", "nesting", "nymph", "subadult", "unknown"],
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -326,19 +326,43 @@ parser.add_argument(
|
|||
required=False,
|
||||
default="",
|
||||
)
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--time",
|
||||
# help="the time of day that the recording was made (example: 17:35)",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
parser.add_argument(
|
||||
"--type",
|
||||
help="the sound type of the recording",
|
||||
type=str,
|
||||
required=False,
|
||||
choices=["aberrant", "alarm call", "begging call", "call", "calling song", "courtship song", "dawn song", "distress call", "distrubance song", "drumming", "duet", "echolocation", "female song", "flight call", "flight song", "imitation", "nocturnal flight call", "rivalry song", "searching song", "social call", "song", "subsong", "unknown"],
|
||||
choices=[
|
||||
"aberrant",
|
||||
"alarm call",
|
||||
"begging call",
|
||||
"call",
|
||||
"calling song",
|
||||
"courtship song",
|
||||
"dawn song",
|
||||
"distress call",
|
||||
"distrubance song",
|
||||
"drumming",
|
||||
"duet",
|
||||
"echolocation",
|
||||
"female song",
|
||||
"flight call",
|
||||
"flight song",
|
||||
"imitation",
|
||||
"nocturnal flight call",
|
||||
"rivalry song",
|
||||
"searching song",
|
||||
"social call",
|
||||
"song",
|
||||
"subsong",
|
||||
"unknown",
|
||||
],
|
||||
default="",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -348,13 +372,13 @@ parser.add_argument(
|
|||
required=False,
|
||||
default="",
|
||||
)
|
||||
#parser.add_argument(
|
||||
# parser.add_argument(
|
||||
# "--url",
|
||||
# help="the URL specifying the details of this recording (example: //xeno-canto.org/755078)",
|
||||
# type=str,
|
||||
# required=False,
|
||||
# default="",
|
||||
#)
|
||||
# )
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
@ -363,10 +387,10 @@ DRY_RUN = args.dry_run
|
|||
QUERY = args.query
|
||||
|
||||
# API fields
|
||||
#ALSO = args.also
|
||||
# ALSO = args.also
|
||||
ANIMAL_SEEN = args.animal_seen
|
||||
AUTO = args.auto
|
||||
#BIRD_SEEN = args.bird_seen
|
||||
# BIRD_SEEN = args.bird_seen
|
||||
CNT = args.cnt
|
||||
DATE = args.date
|
||||
DVC = args.dvc
|
||||
|
@ -377,13 +401,13 @@ GEN = args.gen
|
|||
GROUP = args.group
|
||||
ID = args.id
|
||||
LAT = args.lat
|
||||
#LENGTH = args.length
|
||||
#LIC = args.lic
|
||||
# LENGTH = args.length
|
||||
# LIC = args.lic
|
||||
LNG = args.lng
|
||||
LOC = args.loc
|
||||
METHOD = args.method
|
||||
MIC = args.mic
|
||||
#OSCI = args.osci
|
||||
# OSCI = args.osci
|
||||
PLAYBACK_USED = args.playback_used
|
||||
Q = args.q
|
||||
REC = args.rec
|
||||
|
@ -391,15 +415,15 @@ REGNR = args.regnr
|
|||
RMK = args.rmk
|
||||
SEX = args.sex
|
||||
SMP = args.smp
|
||||
#SONO = args.sono
|
||||
# SONO = args.sono
|
||||
SP = args.sp
|
||||
SSP = args.ssp
|
||||
STAGE = args.stage
|
||||
TEMPERATURE = args.temperature
|
||||
#TIME = args.time
|
||||
# TIME = args.time
|
||||
TYPE = args.type
|
||||
UPLOADED = args.uploaded
|
||||
#URL = args.url
|
||||
# URL = args.url
|
||||
|
||||
|
||||
def print_json(jsn):
|
||||
|
@ -419,106 +443,106 @@ if QUERY:
|
|||
# "Cymbilaimus lineatus"
|
||||
# ],
|
||||
#'''
|
||||
#if ALSO:
|
||||
# if ALSO:
|
||||
# QUERYURL = QUERYURL + "also:" + ALSO + ","
|
||||
'''
|
||||
"""
|
||||
"animal-seen": "no",
|
||||
"animal-seen": "unknown",
|
||||
"animal-seen": "yes",
|
||||
'''
|
||||
"""
|
||||
# Note, the API returns for field name "seen", but not "animal-seen"
|
||||
if ANIMAL_SEEN:
|
||||
QUERYURL = QUERYURL + "seen:" + urllib.parse.quote('"' + ANIMAL_SEEN + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"auto": "no",
|
||||
'''
|
||||
"""
|
||||
if AUTO:
|
||||
QUERYURL = QUERYURL + "auto:" + urllib.parse.quote('"' + AUTO + '"' + " ")
|
||||
#'''
|
||||
# "bird-seen": "yes",
|
||||
#The field animal-seen replaces the field bird-seen.
|
||||
# The field animal-seen replaces the field bird-seen.
|
||||
#'''
|
||||
#if BIRD_SEEN:
|
||||
# if BIRD_SEEN:
|
||||
# QUERYURL = QUERYURL + "bird-seen:" + BIRD_SEEN + ","
|
||||
'''
|
||||
"""
|
||||
"cnt": "Brazil",
|
||||
'''
|
||||
"""
|
||||
if CNT:
|
||||
QUERYURL = QUERYURL + "cnt:" + urllib.parse.quote('"' + CNT + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"date": "2022-09-18",
|
||||
'''
|
||||
"""
|
||||
if DATE:
|
||||
QUERYURL = QUERYURL + "date:" + urllib.parse.quote('"' + DATE + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"dvc": "Panasonic RR-US300",
|
||||
'''
|
||||
"""
|
||||
if DVC:
|
||||
QUERYURL = QUERYURL + "dvc:" + urllib.parse.quote('"' + DVC + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"en": "Great Tinamou",
|
||||
'''
|
||||
"""
|
||||
if EN:
|
||||
QUERYURL = QUERYURL + "en:" + urllib.parse.quote('"' + EN + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"file": "https://xeno-canto.org/770944/download",
|
||||
'''
|
||||
"""
|
||||
if FILE:
|
||||
QUERYURL = QUERYURL + "file:" + urllib.parse.quote('"' + FILE + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"file-name": "XC483178-Tinamus tao_Rio Azul_1032.mp3",
|
||||
'''
|
||||
"""
|
||||
if FILE_NAME:
|
||||
QUERYURL = QUERYURL + "file-name:" + urllib.parse.quote('"' + FILE_NAME + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"gen": "Rhea",
|
||||
'''
|
||||
"""
|
||||
if GEN:
|
||||
QUERYURL = QUERYURL + "gen:" + urllib.parse.quote('"' + GEN + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"group": "birds",
|
||||
'''
|
||||
"""
|
||||
if GROUP:
|
||||
QUERYURL = QUERYURL + "group:" + urllib.parse.quote('"' + GROUP + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"id": "830675",
|
||||
'''
|
||||
"""
|
||||
if ID:
|
||||
QUERYURL = QUERYURL + "id:" + urllib.parse.quote('"' + ID + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"lat": "-26.7144",
|
||||
'''
|
||||
"""
|
||||
if LAT:
|
||||
QUERYURL = QUERYURL + "lat:" + urllib.parse.quote('"' + LAT + '"' + " ")
|
||||
#'''
|
||||
# "length": "1:49",
|
||||
#'''
|
||||
#if LENGTH:
|
||||
# if LENGTH:
|
||||
# QUERYURL = QUERYURL + "length:" + urllib.parse.quote('"' + LENGTH + '"' + " ")
|
||||
#'''
|
||||
# "lic": "//creativecommons.org/licenses/by-sa/4.0/",
|
||||
#'''
|
||||
# https://xeno-canto.org/explore?query=lic:%22by-sa%22%20
|
||||
#if LIC:
|
||||
# if LIC:
|
||||
# QUERYURL = QUERYURL + "lic:" + urllib.parse.quote('"' + LIC + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"lng": "-67.7537",
|
||||
'''
|
||||
"""
|
||||
if LNG:
|
||||
QUERYURL = QUERYURL + "lng:" + urllib.parse.quote('"' + LNG + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"loc": "Araponga, Minas Gerais",
|
||||
'''
|
||||
"""
|
||||
if LOC:
|
||||
QUERYURL = QUERYURL + "loc:" + urllib.parse.quote('"' + LOC + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"method": "field recording",
|
||||
'''
|
||||
"""
|
||||
if METHOD:
|
||||
QUERYURL = QUERYURL + "method:" + urllib.parse.quote('"' + METHOD + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"mic": "Telinga + AT4022",
|
||||
'''
|
||||
"""
|
||||
if MIC:
|
||||
QUERYURL = QUERYURL + "mic:" + urllib.parse.quote('"' + MIC + '"' + " ")
|
||||
#'''
|
||||
|
@ -528,44 +552,48 @@ if MIC:
|
|||
# "small": "//xeno-canto.org/sounds/uploaded/DGVLLRYDXS/wave/XC214239-small.png"
|
||||
# },
|
||||
#'''
|
||||
#if OSCI:
|
||||
# if OSCI:
|
||||
# QUERYURL = QUERYURL + "osci:" + urllib.parse.quote('"' + OSCI + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"playback-used": "no",
|
||||
'''
|
||||
"""
|
||||
if PLAYBACK_USED:
|
||||
QUERYURL = QUERYURL + "playback-used:" + urllib.parse.quote('"' + PLAYBACK_USED + '"' + " ")
|
||||
'''
|
||||
QUERYURL = (
|
||||
QUERYURL
|
||||
+ "playback-used:"
|
||||
+ urllib.parse.quote('"' + PLAYBACK_USED + '"' + " ")
|
||||
)
|
||||
"""
|
||||
"q": "A",
|
||||
'''
|
||||
"""
|
||||
if Q:
|
||||
QUERYURL = QUERYURL + "q:" + urllib.parse.quote('"' + Q + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"rec": "Fernando Igor de Godoy",
|
||||
'''
|
||||
"""
|
||||
if REC:
|
||||
QUERYURL = QUERYURL + "rec:" + urllib.parse.quote('"' + REC + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"regnr": "",
|
||||
'''
|
||||
"""
|
||||
if REGNR:
|
||||
QUERYURL = QUERYURL + "regnr:" + urllib.parse.quote('"' + REGNR + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"rmk": "White sand forest.",
|
||||
'''
|
||||
"""
|
||||
if RMK:
|
||||
QUERYURL = QUERYURL + "rmk:" + urllib.parse.quote('"' + RMK + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"sex": "female",
|
||||
"sex": "female, male",
|
||||
"sex": "male",
|
||||
"sex": "uncertain",
|
||||
'''
|
||||
"""
|
||||
if SEX:
|
||||
QUERYURL = QUERYURL + "sex:" + urllib.parse.quote('"' + SEX + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"smp": "48000",
|
||||
'''
|
||||
"""
|
||||
if SMP:
|
||||
QUERYURL = QUERYURL + "smp:" + urllib.parse.quote('"' + SMP + '"' + " ")
|
||||
#'''
|
||||
|
@ -576,51 +604,53 @@ if SMP:
|
|||
# "small": "//xeno-canto.org/sounds/uploaded/TGBFXDVERJ/ffts/XC171181-small.png"
|
||||
# },
|
||||
#'''
|
||||
#if SONO:
|
||||
# if SONO:
|
||||
# QUERYURL = QUERYURL + "sono:" + urllib.parse.quote('"' + SONO + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"sp": "obsoletus",
|
||||
'''
|
||||
"""
|
||||
if SP:
|
||||
QUERYURL = QUERYURL + "sp:" + urllib.parse.quote('"' + SP + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"ssp": "americana",
|
||||
'''
|
||||
"""
|
||||
if SSP:
|
||||
QUERYURL = QUERYURL + "ssp:" + urllib.parse.quote('"' + SSP + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"stage": "adult",
|
||||
"stage": "adult, uncertain",
|
||||
"stage": "juvenile",
|
||||
"stage": "uncertain",
|
||||
'''
|
||||
"""
|
||||
if STAGE:
|
||||
QUERYURL = QUERYURL + "stage:" + urllib.parse.quote('"' + STAGE + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"temp": "",
|
||||
'''
|
||||
"""
|
||||
if TEMPERATURE:
|
||||
QUERYURL = QUERYURL + "temperature:" + urllib.parse.quote('"' + TEMPERATURE + '"' + " ")
|
||||
QUERYURL = (
|
||||
QUERYURL + "temperature:" + urllib.parse.quote('"' + TEMPERATURE + '"' + " ")
|
||||
)
|
||||
#'''
|
||||
# "time": "17:35",
|
||||
#'''
|
||||
#if TIME:
|
||||
# if TIME:
|
||||
# QUERYURL = QUERYURL + "time:" + urllib.parse.quote('"' + TIME + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"type": "song, long and short song",
|
||||
'''
|
||||
"""
|
||||
if TYPE:
|
||||
QUERYURL = QUERYURL + "type:" + urllib.parse.quote('"' + TYPE + '"' + " ")
|
||||
'''
|
||||
"""
|
||||
"uploaded": "2022-03-02",
|
||||
'''
|
||||
"""
|
||||
if UPLOADED:
|
||||
QUERYURL = QUERYURL + "uploaded:" + UPLOADED + ","
|
||||
QUERYURL = QUERYURL + "uploaded:" + urllib.parse.quote('"' + UPLOADED + '"' + " ")
|
||||
#'''
|
||||
# "url": "//xeno-canto.org/755078"
|
||||
#'''
|
||||
#if URL:
|
||||
# if URL:
|
||||
# QUERYURL = QUERYURL + "url:" + URL + ","
|
||||
# QUERYURL = QUERYURL + "url:" + urllib.parse.quote('"' + URL + '"' + " ")
|
||||
|
||||
|
|
Loading…
Reference in New Issue