X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fsfdb_freesound_mootcher.cc;h=5f1711d3c8c67a679a61bb0787310bf4ba09618a;hb=89d6f40e33933b12a40079e391a96856bfa79e2a;hp=6c62939493cd54f30973638672f350d89a52a854;hpb=cb413146428ce5db5e281d70f2b3b7df27c1aaab;p=ardour.git diff --git a/gtk2_ardour/sfdb_freesound_mootcher.cc b/gtk2_ardour/sfdb_freesound_mootcher.cc index 6c62939493..5f1711d3c8 100644 --- a/gtk2_ardour/sfdb_freesound_mootcher.cc +++ b/gtk2_ardour/sfdb_freesound_mootcher.cc @@ -39,12 +39,12 @@ *************************************************************************************/ #include "sfdb_freesound_mootcher.h" -#include +#include "pbd/xml++.h" #include #include -#include +#include "ardour/audio_library.h" #define TRUE 1 @@ -164,7 +164,7 @@ int Mootcher::doLogin(std::string login, std::string password) curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1); // the url to get - std::string login_url = "http://freesound.iua.upf.edu/forum/login.php"; + std::string login_url = "http://www.freesound.org/forum/login.php"; curl_easy_setopt(curl, CURLOPT_URL, login_url.c_str() ); // perform online request @@ -221,6 +221,28 @@ std::string Mootcher::searchText(std::string word) postMessage += tempPointer; sprintf( tempPointer, "&searchtags=1"); postMessage += tempPointer; + + // Ref: http://www.freesound.org/forum/viewtopic.php?p=19081 + // const ORDER_DEFAULT = 0; + // const ORDER_DOWNLOADS_DESC = 1; + // const ORDER_DOWNLOADS_ASC = 2; + // const ORDER_USERNAME_DESC = 3; + // const ORDER_USERNAME_ASC = 4; + // const ORDER_DATE_DESC = 5; + // const ORDER_DATE_ASC = 6; + // const ORDER_DURATION_DESC = 7; + // const ORDER_DURATION_ASC = 8; + // const ORDER_FILEFORMAT_DESC = 9; + // const ORDER_FILEFORMAT_ASC = 10; + sprintf( tempPointer, "&order=1"); + postMessage += tempPointer; + sprintf( tempPointer, "&start=0"); + postMessage += tempPointer; + sprintf( tempPointer, "&limit=10"); + postMessage += tempPointer; + // The limit of 10 samples is arbitrary, but seems + // reasonable in light of the fact that all of the returned + // samples get downloaded, and downloads are s-l-o-w. if(curl) { @@ -234,7 +256,7 @@ std::string Mootcher::searchText(std::string word) curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1); // the url to get - std::string search_url = "http://freesound.iua.upf.edu/searchTextXML.php"; + std::string search_url = "http://www.freesound.org/searchTextXML.php"; curl_easy_setopt(curl, CURLOPT_URL, search_url.c_str()); // perform the online search @@ -300,7 +322,7 @@ void Mootcher::GetXml(std::string ID, struct MemoryStruct &xml_page) curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&xml_page); // URL to get - std::string getxml_url = "http://freesound.iua.upf.edu/samplesViewSingleXML.php?id="; + std::string getxml_url = "http://www.freesound.org/samplesViewSingleXML.php?id="; getxml_url += ID; curl_easy_setopt(curl, CURLOPT_URL, getxml_url.c_str() ); @@ -383,7 +405,7 @@ std::string Mootcher::getXmlFile(std::string ID, int &length) if (tags) { XMLNodeList children = tags->children(); XMLNodeConstIterator niter; - vector strings; + std::vector strings; for (niter = children.begin(); niter != children.end(); ++niter) { XMLNode *node = *niter; if( strcmp( node->name().c_str(), "tag") == 0 ) { @@ -391,7 +413,7 @@ std::string Mootcher::getXmlFile(std::string ID, int &length) if (text) strings.push_back(text->content()); } } - ARDOUR::Library->set_tags (string("//")+filename, strings); + ARDOUR::Library->set_tags (std::string("//")+filename, strings); ARDOUR::Library->save_changes (); } } @@ -460,7 +482,7 @@ std::string Mootcher::getFile(std::string ID) // create the download url, this url will also update the download statics on the site std::string audioURL; - audioURL += "http://freesound.iua.upf.edu/samplesDownload.php?id="; + audioURL += "http://www.freesound.org/samplesDownload.php?id="; audioURL += ID; setcUrlOptions();