vampnet-choir / scripts /utils /xeno-canto-dl.py
hugo flores garcia
recovering from a gittastrophe
41b9d24
raw
history blame
5.52 kB
from xenopy import Query
SPECIES = [
"American Robin",
"Northern Cardinal",
"Mourning Dove",
"American Crow",
"Baltimore Oriole",
"Blue Jay",
"Eastern Bluebird",
"House Finch",
"American Goldfinch",
"House Sparrow",
"Song Sparrow",
"Tufted Titmouse",
"White-breasted Nuthatch",
"European Starling",
"American Redstart",
"Red-winged Blackbird",
"Brown-headed Cowbird",
"Common Grackle",
"Boat-tailed Grackle",
"Common Yellowthroat",
"Northern Mockingbird",
"Carolina Wren",
"Eastern Meadowlark",
"Chipping Sparrow",
"Tree Swallow",
"Barn Swallow",
"Cliff Swallow",
"Pine Siskin",
"Indigo Bunting",
"Eastern Towhee",
"Carolina Chickadee",
"Great Crested Flycatcher",
"Eastern Wood-Pewee",
"Ovenbird",
"Northern Flicker",
"Red-eyed Vireo",
"American Woodcock",
"Eastern Phoebe",
"Downy Woodpecker",
"Scarlet Tanager",
"Yellow Warbler",
"White-eyed Vireo",
"Common Loon",
"White-throated Sparrow",
"Yellow-throated Vireo",
"Great Blue Heron",
"Belted Kingfisher",
"Pied-billed Grebe",
"Wild Turkey",
"Wood Thrush",
"Rose-breasted Grosbeak",
"Field Sparrow",
"Hooded Warbler",
"Northern Parula",
"Chestnut-sided Warbler",
"Blue-winged Warbler",
"Red-bellied Woodpecker",
"Yellow-billed Cuckoo",
"Gray Catbird",
"Northern Saw-whet Owl",
"Osprey",
"Common Nighthawk",
"Broad-winged Hawk",
"Black-throated Green Warbler",
"Great Horned Owl",
"Common Raven",
"Barred Owl",
"Canada Warbler",
"Magnolia Warbler",
"Black-and-white Warbler",
"Eastern Kingbird",
"Swainson's Thrush",
"Worm-eating Warbler",
"Prairie Warbler",
"Baltimore Oriole",
"Black-throated Blue Warbler",
"Louisiana Waterthrush",
"Blackburnian Warbler",
"Black-capped Chickadee",
"Cerulean Warbler",
"Red-shouldered Hawk",
"Cooper's Hawk",
"Yellow-throated Warbler",
"Blue-headed Vireo",
"Blackpoll Warbler",
"Ruffed Grouse",
"Kentucky Warbler",
"Hermit Thrush",
"Cedar Waxwing",
"Eastern Screech-Owl",
"Northern Goshawk",
"Green Heron",
"Red-tailed Hawk",
"Black Vulture",
"Hairy Woodpecker",
"Golden-crowned Kinglet",
"Ruby-crowned Kinglet",
"Bicknell's Thrush",
"Blue-gray Gnatcatcher",
"Veery",
"Pileated Woodpecker",
"Purple Finch",
"White-crowned Sparrow",
"Snow Bunting",
"Pine Grosbeak",
"American Tree Sparrow",
"Dark-eyed Junco",
"Snowy Owl",
"White-winged Crossbill",
"Red Crossbill",
"Common Redpoll",
"Northern Shrike",
"Northern Harrier",
"Rough-legged Hawk",
"Long-eared Owl",
"Evening Grosbeak",
"Northern Pintail",
"American Black Duck",
"Mallard",
"Canvasback",
"Redhead",
"Ring-necked Duck",
"Greater Scaup",
"Lesser Scaup",
"Bufflehead",
"Common Goldeneye",
"Hooded Merganser",
"Common Merganser",
"Red-breasted Merganser",
"Ruddy Duck",
"Wood Duck",
"Gadwall",
"American Wigeon",
"Northern Shoveler",
"Green-winged Teal",
"Blue-winged Teal",
"Cinnamon Teal",
"Ringed Teal",
"Cape Teal",
"Northern Fulmar",
"Yellow-billed Loon",
"Red-throated Loon",
"Arctic Loon",
"Pacific Loon",
"Horned Grebe",
"Red-necked Grebe",
"Eared Grebe",
"Western Grebe",
"Clark's Grebe",
"Double-crested Cormorant",
"Pelagic Cormorant",
"Great Cormorant",
"American White Pelican",
"Brown Pelican",
"Brandt's Cormorant",
"Least Bittern",
"Great Egret",
"Snowy Egret",
"Little Blue Heron",
"Tricolored Heron",
"Reddish Egret",
"Black-crowned Night-Heron",
"Yellow-crowned Night-Heron",
"White Ibis",
"Glossy Ibis",
"Roseate Spoonbill",
"Wood Stork",
"Black-bellied Whistling-Duck",
"Fulvous Whistling-Duck",
"Greater White-fronted Goose",
"Snow Goose",
"Ross's Goose",
"Canada Goose",
"Brant",
"Mute Swan",
"Tundra Swan",
"Whooper Swan",
"Sandhill Crane",
"Black-necked Stilt",
"American Avocet",
"Northern Jacana",
"Greater Yellowlegs",
"Lesser Yellowlegs",
"Willet",
"Spotted Sandpiper",
"Upland Sandpiper",
"Whimbrel",
"Long-billed Curlew",
"Marbled Godwit",
"Ruddy Turnstone",
"Red Knot",
"Sanderling",
"Semipalmated Sandpiper",
"Western Sandpiper",
"Least Sandpiper",
"White-rumped Sandpiper",
"Baird's Sandpiper",
"Pectoral Sandpiper",
"Dunlin",
"Buff-breasted Sandpiper",
"Short-billed Dowitcher",
"Long-billed Dowitcher",
"Common Snipe",
"American Woodcock",
"Wilson's Phalarope",
"Red-necked Phalarope",
"Red Phalarope"
]
from pathlib import Path
def remove_spaces(s):
return s.replace(" ", "")
for species in SPECIES:
if Path("/media/CHONK/hugo/xeno-canto-full/" + remove_spaces(species)).exists():
continue
try:
q = Query(
name=species, q="A", length="10-30",
)
# retrieve metadata
metafiles = q.retrieve_meta(verbose=True)
# retrieve recordings
q.retrieve_recordings(multiprocess=True, nproc=10, attempts=10, outdir="/media/CHONK/hugo/xeno-canto-full/")
except:
print("Failed to download " + species)
continue