summaryrefslogtreecommitdiff
path: root/gtk2_ardour/sfdb_freesound_mootcher.cc
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2013-03-15 19:59:19 +0000
committerColin Fletcher <colin.m.fletcher@googlemail.com>2013-03-17 12:33:59 +0000
commit2233e91086c01eeaf4d023db4e305944bc4565e6 (patch)
tree34f7a9254a946d853eb8844a79276d801915d1cf /gtk2_ardour/sfdb_freesound_mootcher.cc
parent8cbb9727e959a744057de387a293aecdce09a62c (diff)
Freesound fixes for #5853, and a few other small improvements
Add a 'More' button to load the next page of results without clearing the already-found list. Don't allow cancellation of searches, and don't update progress bar around searches, since we only get one page at a time now. Show number of pages of results remaining to download in the tooltip of the 'More' button. Use a new Mootcher object for each request, to avoid bad things happening when clicking in the Freesound search results list while a search or file download is already in progress. Make the 'Stop' button insensitive except when it will actually stop the download of a sound file. Only retrieve one page worth of data per search, rather than looping to get all pages. Don't show an error in the log window if the user cancelled download. Request 100 items per page, rather than the default 30. Fix DOS line endings.
Diffstat (limited to 'gtk2_ardour/sfdb_freesound_mootcher.cc')
-rw-r--r--gtk2_ardour/sfdb_freesound_mootcher.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk2_ardour/sfdb_freesound_mootcher.cc b/gtk2_ardour/sfdb_freesound_mootcher.cc
index ed1e2abfeb..e46fb12391 100644
--- a/gtk2_ardour/sfdb_freesound_mootcher.cc
+++ b/gtk2_ardour/sfdb_freesound_mootcher.cc
@@ -226,6 +226,7 @@ std::string Mootcher::searchText(std::string query, int page, std::string filter
params += "&s=" + sortMethodString(sort);
params += "&fields=id,original_filename,duration,filesize,samplerate,license,serve";
+ params += "&sounds_per_page=100";
return doRequest("/sounds/search", params);
}
@@ -318,12 +319,12 @@ std::string Mootcher::getAudioFile(std::string originalFileName, std::string ID,
return "";
}
- //if already canceling a previous download, bail out here ( this can happen b/c getAudioFile gets called by various UI update funcs )
+ // if already cancelling a previous download, bail out here ( this can happen b/c getAudioFile gets called by various UI update funcs )
if ( caller->freesound_download_cancel ) {
return "";
}
- //now download the actual file
+ // now download the actual file
FILE* theFile;
theFile = g_fopen( audioFileName.c_str(), "wb" );
@@ -359,7 +360,10 @@ std::string Mootcher::getAudioFile(std::string originalFileName, std::string ID,
caller->freesound_progress_bar.set_text("");
if( res != 0 ) {
- error << string_compose (_("curl error %1 (%2)"), res, curl_easy_strerror(res)) << endmsg;
+ /* it's not an error if the user pressed the stop button */
+ if (res != CURLE_ABORTED_BY_CALLBACK) {
+ error << string_compose (_("curl error %1 (%2)"), res, curl_easy_strerror(res)) << endmsg;
+ }
remove( audioFileName.c_str() );
return "";
} else {