summaryrefslogtreecommitdiff
path: root/gtk2_ardour/sfdb_freesound_mootcher.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-04-11 14:06:50 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-04-11 14:06:50 +0000
commitcb413146428ce5db5e281d70f2b3b7df27c1aaab (patch)
tree4961e9dcb107f2ca1f0a4298faf5135ba8611d92 /gtk2_ardour/sfdb_freesound_mootcher.h
parent9aa8af5a28abbb86c9ae86c6991838eb6828d0a9 (diff)
merge 3.0 from 2.0-ongoing@3243
git-svn-id: svn://localhost/ardour2/branches/3.0@3248 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/sfdb_freesound_mootcher.h')
-rw-r--r--gtk2_ardour/sfdb_freesound_mootcher.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/gtk2_ardour/sfdb_freesound_mootcher.h b/gtk2_ardour/sfdb_freesound_mootcher.h
new file mode 100644
index 0000000000..3cfbd414d4
--- /dev/null
+++ b/gtk2_ardour/sfdb_freesound_mootcher.h
@@ -0,0 +1,78 @@
+/*sfdb_freesound_mootcher.h****************************************************************************
+
+ Adapted for Ardour by Ben Loftis, March 2008
+
+ Mootcher Online Access to thefreesoundproject website
+ http://freesound.iua.upf.edu/
+
+ GPL 2005 Jorn Lemon
+ mail for questions/remarks: mootcher@twistedlemon.nl
+ or go to the freesound website forum
+
+*****************************************************************************/
+
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <stdio.h>
+#include <cstring>
+#include <string>
+#include <sstream>
+#include <vector>
+//#include <ctime>
+
+#include "curl/curl.h"
+
+
+// mootcher version
+#define ___VERSION___ 1.3
+
+//--- struct to store XML file
+struct MemoryStruct {
+ char *memory;
+ size_t size;
+};
+
+//--- for download process viewing
+struct dlprocess {
+ double dltotalMoo;
+ double dlnowMoo;
+};
+
+class Mootcher
+{
+public:
+ Mootcher(const char *saveLocation);
+ ~Mootcher();
+
+ int doLogin(std::string login, std::string password);
+ std::string getFile(std::string ID);
+ std::string searchText(std::string word);
+
+
+ struct dlprocess bar;
+
+private:
+
+ const char* changeWorkingDir(const char *saveLocation);
+
+ std::string getXmlFile(std::string ID, int &length);
+ void GetXml(std::string ID, struct MemoryStruct &xml_page);
+ std::string changeExtension(std::string filename);
+
+ void toLog(std::string input);
+
+ void setcUrlOptions();
+
+ static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);
+ static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
+
+ CURL *curl;
+ char errorBuffer[CURL_ERROR_SIZE]; // storage for cUrl error message
+
+ int connection; // is 0 if no connection
+ char message[128]; // storage for messages that are send to the logfile
+
+ std::string basePath;
+ std::string xmlLocation;
+};