X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsoundcloud_upload.cc;h=291e4d2fe6951cefb9a9442dec9d173b64b3a16a;hb=11b02e90ac9b084cd25741b7a6bdc91c59749c16;hp=c7bd4605df018536254f8d5b6138ce53f461eff0;hpb=4dc63966f0872efe768dad61eb9b8785d06b92d1;p=ardour.git diff --git a/libs/ardour/soundcloud_upload.cc b/libs/ardour/soundcloud_upload.cc index c7bd4605df..291e4d2fe6 100644 --- a/libs/ardour/soundcloud_upload.cc +++ b/libs/ardour/soundcloud_upload.cc @@ -29,13 +29,13 @@ #include #include #include -#include +#include "pbd/gstdio_compat.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace PBD; -size_t +static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) { register int realsize = (int)(size * nmemb); @@ -52,6 +52,8 @@ WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) } SoundcloudUploader::SoundcloudUploader() +: errorBuffer() +, caller(0) { curl_handle = curl_easy_init(); multi_handle = curl_multi_init(); @@ -118,7 +120,7 @@ SoundcloudUploader::Get_Auth_Token( std::string username, std::string password ) // perform online request CURLcode res = curl_easy_perform(curl_handle); if (res != 0) { - DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("curl error %1 (%2)", res, curl_easy_strerror(res) ) ); + DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("curl error %1 (%2)\n", res, curl_easy_strerror(res) ) ); return ""; } @@ -146,7 +148,7 @@ int SoundcloudUploader::progress_callback(void *caller, double dltotal, double dlnow, double ultotal, double ulnow) { SoundcloudUploader *scu = (SoundcloudUploader *) caller; - DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("%1: uploaded %2 of %3", scu->title, ulnow, ultotal) ); + DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("%1: uploaded %2 of %3\n", scu->title, ulnow, ultotal) ); scu->caller->SoundcloudProgress(ultotal, ulnow, scu->title); /* EMIT SIGNAL */ return 0; } @@ -302,19 +304,19 @@ SoundcloudUploader::Upload(std::string file_path, std::string title, std::string XMLNode *root = doc.root(); if (!root) { - DEBUG_TRACE (DEBUG::Soundcloud, "no root XML node!"); + DEBUG_TRACE (DEBUG::Soundcloud, "no root XML node!\n"); return ""; } XMLNode *url_node = root->child("permalink-url"); if (!url_node) { - DEBUG_TRACE (DEBUG::Soundcloud, "no child node \"permalink-url\" found!"); + DEBUG_TRACE (DEBUG::Soundcloud, "no child node \"permalink-url\" found!\n"); return ""; } XMLNode *text_node = url_node->child("text"); if (!text_node) { - DEBUG_TRACE (DEBUG::Soundcloud, "no text node found!"); + DEBUG_TRACE (DEBUG::Soundcloud, "no text node found!\n"); return ""; } @@ -336,15 +338,13 @@ SoundcloudUploader:: ~SoundcloudUploader() void SoundcloudUploader::setcUrlOptions() { - // basic init for curl - curl_global_init(CURL_GLOBAL_ALL); // some servers don't like requests that are made without a user-agent field, so we provide one curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); // setup curl error buffer curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, errorBuffer); // Allow redirection curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); - + // Allow connections to time out (without using signals) curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 30);