po name changes, again?
[ardour2.git] / gtk2_ardour / sfdb_freesound_mootcher.h
blob3cfbd414d4cf4faa5de1ea9cbfcfedfb80e07503
1 /*sfdb_freesound_mootcher.h****************************************************************************
3 Adapted for Ardour by Ben Loftis, March 2008
5 Mootcher Online Access to thefreesoundproject website
6 http://freesound.iua.upf.edu/
8 GPL 2005 Jorn Lemon
9 mail for questions/remarks: mootcher@twistedlemon.nl
10 or go to the freesound website forum
12 *****************************************************************************/
14 #include <string>
15 #include <fstream>
16 #include <iostream>
17 #include <stdio.h>
18 #include <cstring>
19 #include <string>
20 #include <sstream>
21 #include <vector>
22 //#include <ctime>
24 #include "curl/curl.h"
27 // mootcher version
28 #define ___VERSION___ 1.3
30 //--- struct to store XML file
31 struct MemoryStruct {
32 char *memory;
33 size_t size;
36 //--- for download process viewing
37 struct dlprocess {
38 double dltotalMoo;
39 double dlnowMoo;
42 class Mootcher
44 public:
45 Mootcher(const char *saveLocation);
46 ~Mootcher();
48 int doLogin(std::string login, std::string password);
49 std::string getFile(std::string ID);
50 std::string searchText(std::string word);
53 struct dlprocess bar;
55 private:
57 const char* changeWorkingDir(const char *saveLocation);
59 std::string getXmlFile(std::string ID, int &length);
60 void GetXml(std::string ID, struct MemoryStruct &xml_page);
61 std::string changeExtension(std::string filename);
63 void toLog(std::string input);
65 void setcUrlOptions();
67 static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);
68 static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
70 CURL *curl;
71 char errorBuffer[CURL_ERROR_SIZE]; // storage for cUrl error message
73 int connection; // is 0 if no connection
74 char message[128]; // storage for messages that are send to the logfile
76 std::string basePath;
77 std::string xmlLocation;