- if (theFile) {\r
- \r
- // create the download url\r
- audioURL += "?api_key=" + api_key;\r
- \r
- setcUrlOptions();\r
- curl_easy_setopt(curl, CURLOPT_URL, audioURL.c_str() );\r
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, audioFileWrite);\r
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, theFile);\r
-\r
- std::cerr << "downloading " << audioFileName << " from " << audioURL << "..." << std::endl;\r
-\r
- curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0); // turn on the progress bar\r
- curl_easy_setopt (curl, CURLOPT_PROGRESSFUNCTION, progress_callback);\r
- curl_easy_setopt (curl, CURLOPT_PROGRESSDATA, progress_bar);\r
-\r
- CURLcode res = curl_easy_perform(curl);\r
- fclose(theFile);\r
-\r
- curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 1); // turn off the progress bar\r
- progress_bar->set_fraction(0.0);\r
-\r
- if( res != 0 ) {\r
- std::cerr << "curl error " << res << " (" << curl_easy_strerror(res) << ")" << std::endl;\r
- remove( audioFileName.c_str() ); \r
- return "";\r
- } else {\r
- std::cerr << "done!" << std::endl;\r
- // now download the tags &c.\r
- getSoundResourceFile(ID);\r
- }\r
- }\r
+ setcUrlOptions();\r
+ curl_easy_setopt(curl, CURLOPT_URL, audioURL.c_str() );\r
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, audioFileWrite);\r
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, theFile);\r
+\r
+ /* hack to get rid of the barber-pole stripes */\r
+ caller->freesound_progress_bar.hide();\r
+ caller->freesound_progress_bar.show();\r
+\r
+ std::string prog;\r
+ prog = string_compose (_("%1"), originalFileName);\r
+ caller->freesound_progress_bar.set_text(prog);\r
+\r
+ curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0); // turn on the progress bar\r
+ curl_easy_setopt (curl, CURLOPT_PROGRESSFUNCTION, progress_callback);\r
+ curl_easy_setopt (curl, CURLOPT_PROGRESSDATA, caller);\r
+\r
+ CURLcode res = curl_easy_perform(curl);\r
+ fclose(theFile);\r
+\r
+ curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 1); // turn off the progress bar\r
+ caller->freesound_progress_bar.set_fraction(0.0);\r
+ caller->freesound_progress_bar.set_text("");\r
+ \r
+ if( res != 0 ) {\r
+ error << string_compose (_("curl error %1 (%2)"), res, curl_easy_strerror(res)) << endmsg;\r
+ remove( audioFileName.c_str() ); \r
+ return "";\r
+ } else {\r
+ // now download the tags &c.\r
+ getSoundResourceFile(ID);\r