add new Session::Dialog signal for generic dialog interactions with unknown GUI;...
[ardour.git] / gtk2_ardour / sfdb_freesound_mootcher.h
1 /*sfdb_freesound_mootcher.h****************************************************************************\r
2         \r
3         Adapted for Ardour by Ben Loftis, March 2008\r
4 \r
5         Mootcher Online Access to thefreesoundproject website\r
6         http://freesound.iua.upf.edu/\r
7 \r
8         GPL 2005 Jorn Lemon\r
9         mail for questions/remarks: mootcher@twistedlemon.nl\r
10         or go to the freesound website forum\r
11 \r
12 *****************************************************************************/\r
13 \r
14 #include <string>\r
15 #include <fstream>\r
16 #include <iostream>\r
17 #include <stdio.h>\r
18 #include <cstring>\r
19 #include <string>\r
20 #include <sstream>\r
21 #include <vector>\r
22 //#include <ctime>\r
23 \r
24 #include "curl/curl.h"\r
25 \r
26 \r
27 // mootcher version\r
28 #define ___VERSION___ 1.3\r
29 \r
30 //--- struct to store XML file \r
31 struct MemoryStruct {\r
32         char *memory;\r
33         size_t size;\r
34 };\r
35 \r
36 //--- for download process viewing\r
37 struct dlprocess {\r
38         double dltotalMoo;\r
39         double dlnowMoo;\r
40 };\r
41 \r
42 class Mootcher\r
43 {\r
44 public:\r
45         Mootcher(const char *saveLocation);\r
46         ~Mootcher();\r
47 \r
48         int                     doLogin(std::string login, std::string password);\r
49         std::string     getFile(std::string ID);\r
50         std::string     searchText(std::string word);\r
51 \r
52 \r
53         struct dlprocess bar;\r
54         \r
55 private:\r
56 \r
57         const char*     changeWorkingDir(const char *saveLocation);\r
58         void            createResourceLocation();\r
59 \r
60         std::string     getXmlFile(std::string ID, int &length);\r
61         void            GetXml(std::string ID, struct MemoryStruct &xml_page);\r
62         std::string     changeExtension(std::string filename);\r
63 \r
64         void            toLog(std::string input);\r
65 \r
66         void            setcUrlOptions();\r
67 \r
68     static size_t               WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);\r
69         static int                      progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);\r
70 \r
71         CURL *curl;\r
72         char errorBuffer[CURL_ERROR_SIZE];      // storage for cUrl error message\r
73 \r
74         int connection;         // is 0 if no connection\r
75         char message[128];      // storage for messages that are send to the logfile\r
76 \r
77         std::string basePath;\r
78         std::string xmlLocation;\r
79 };\r