summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/soundcloud_upload.h
blob: aff9245d66249bea6913f4b050864db88226705c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* soundcloud_upload.h ******************************************************

	Adapted for Ardour by Ben Loftis, March 2012

*****************************************************************************/

#ifndef __ardour_soundcloud_upload_h__
#define __ardour_soundcloud_upload_h__

#include <string>
#include <stdio.h>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>

#include "curl/curl.h"
#include "ardour/session_handle.h"
#include "ardour/export_handler.h"
#include "pbd/signals.h"

//--- struct to store XML file
struct MemoryStruct {
	char *memory;
	size_t size;
};


class SoundcloudUploader
{
public:
	SoundcloudUploader();
	~SoundcloudUploader();

	std::string	Get_Auth_Token(std::string username, std::string password);
	std::string Upload (std::string file_path, std::string title, std::string token, bool ispublic, bool downloadable, ARDOUR::ExportHandler *caller);
	static int progress_callback(void *caller, double dltotal, double dlnow, double ultotal, double ulnow);


private:

	void		setcUrlOptions();

	CURL *curl_handle;
	CURLM *multi_handle;
	char errorBuffer[CURL_ERROR_SIZE];	// storage for cUrl error message

	std::string title;
	ARDOUR::ExportHandler *caller;

};

#endif /* __ardour_soundcloud_upload_h__ */