Few files are getting download than actual numbers

62 views
Skip to first unread message

Harish-Chandra Dubey

unread,
Jun 20, 2018, 8:14:51 PM6/20/18
to Freesound API
Dear Users, 

I am new to FreeSound API. I tried to download the audio for a search term. There are over 100 files with that search term, but I am not able to download all. Only few, approx. 20 are getting downloaded. I am trying to download preview_versions. What could be the glitch here. Thanks!

Code snippet is below:


results2 = client.text_search(query="crying baby",fields="id,name,previews")
print("Num results:", results2.count)
for sound in results2:
    sound.retrieve_preview("FreeSound_data/Crying-baby/",sound.name)
#    sound.retrieve_preview("FreeSound_data/Crying-baby/",sound.name+".mp3")

#    print(sound.id)
    print(sound.name)

Frederic Font Corbera

unread,
Jun 21, 2018, 4:25:26 AM6/21/18
to freeso...@googlegroups.com
Hi,

The query response is paginated (as explained here: https://freesound.org/docs/api/resources_apiv2.html#response-sound-list).
Did you iterate through the different pages? I see you're using the python client, you have examples on how to iterate pages in the python client examples file: https://github.com/MTG/freesound-python/blob/244f5d294fc02724fc10fc1f7900361188df3293/examples.py#L83-L100

Cheers,

frederic


---
Frederic Font
Music Technology Group
Universitat Pompeu Fabra

Freesound | www.freesound.org
Audio Commons | www.audiocommons.org



--

---
You received this message because you are subscribed to the Google Groups "Freesound API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freesound-ap...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harish-Chandra Dubey

unread,
Jun 21, 2018, 3:03:58 PM6/21/18
to freeso...@googlegroups.com
Thank you. That was my mistake. The data downloaded was from first page only. Iterating over pages lead to download of all data.




-Best,
Harish

Reply all
Reply to author
Forward
0 new messages