Add and use a DEBUG flag for Soundcloud uploads.
Replace output to stdout/stderr from Soundcloud upload functions with DEBUG_TRACE (DEBUG::Soundcloud, ...).
This commit is contained in:
parent
ec6631d75c
commit
aa318a2fc3
@ -67,6 +67,7 @@ namespace PBD {
|
|||||||
LIBARDOUR_API extern uint64_t WiimoteControl;
|
LIBARDOUR_API extern uint64_t WiimoteControl;
|
||||||
LIBARDOUR_API extern uint64_t Ports;
|
LIBARDOUR_API extern uint64_t Ports;
|
||||||
LIBARDOUR_API extern uint64_t AudioEngine;
|
LIBARDOUR_API extern uint64_t AudioEngine;
|
||||||
|
LIBARDOUR_API extern uint64_t Soundcloud;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,5 +63,6 @@ uint64_t PBD::DEBUG::Automation = PBD::new_debug_bit ("automation");
|
|||||||
uint64_t PBD::DEBUG::WiimoteControl = PBD::new_debug_bit ("wiimotecontrol");
|
uint64_t PBD::DEBUG::WiimoteControl = PBD::new_debug_bit ("wiimotecontrol");
|
||||||
uint64_t PBD::DEBUG::Ports = PBD::new_debug_bit ("Ports");
|
uint64_t PBD::DEBUG::Ports = PBD::new_debug_bit ("Ports");
|
||||||
uint64_t PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine");
|
uint64_t PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine");
|
||||||
|
uint64_t PBD::DEBUG::Soundcloud = PBD::new_debug_bit ("Soundcloud");
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "pbd/convert.h"
|
#include "pbd/convert.h"
|
||||||
|
|
||||||
#include "ardour/audiofile_tagger.h"
|
#include "ardour/audiofile_tagger.h"
|
||||||
|
#include "ardour/debug.h"
|
||||||
#include "ardour/export_graph_builder.h"
|
#include "ardour/export_graph_builder.h"
|
||||||
#include "ardour/export_timespan.h"
|
#include "ardour/export_timespan.h"
|
||||||
#include "ardour/export_channel_configuration.h"
|
#include "ardour/export_channel_configuration.h"
|
||||||
@ -348,13 +349,9 @@ ExportHandler::finish_timespan ()
|
|||||||
if (fmt->soundcloud_upload()) {
|
if (fmt->soundcloud_upload()) {
|
||||||
SoundcloudUploader *soundcloud_uploader = new SoundcloudUploader;
|
SoundcloudUploader *soundcloud_uploader = new SoundcloudUploader;
|
||||||
std::string token = soundcloud_uploader->Get_Auth_Token(soundcloud_username, soundcloud_password);
|
std::string token = soundcloud_uploader->Get_Auth_Token(soundcloud_username, soundcloud_password);
|
||||||
std::cerr
|
DEBUG_TRACE (DEBUG::Soundcloud, string_compose(
|
||||||
<< "uploading "
|
"uploading %1 - username=%2, password=%3, token=%4",
|
||||||
<< filename << std::endl
|
filename, soundcloud_username, soundcloud_password, token) );
|
||||||
<< "username = " << soundcloud_username
|
|
||||||
<< ", password = " << soundcloud_password
|
|
||||||
<< " - token = " << token << " ..."
|
|
||||||
<< std::endl;
|
|
||||||
std::string path = soundcloud_uploader->Upload (
|
std::string path = soundcloud_uploader->Upload (
|
||||||
filename,
|
filename,
|
||||||
PBD::basename_nosuffix(filename), // title
|
PBD::basename_nosuffix(filename), // title
|
||||||
@ -366,7 +363,7 @@ ExportHandler::finish_timespan ()
|
|||||||
if (path.length() != 0) {
|
if (path.length() != 0) {
|
||||||
info << string_compose ( _("File %1 uploaded to %2"), filename, path) << endmsg;
|
info << string_compose ( _("File %1 uploaded to %2"), filename, path) << endmsg;
|
||||||
if (soundcloud_open_page) {
|
if (soundcloud_open_page) {
|
||||||
std::cerr << "opening " << path << " ..." << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("opening %1", path) );
|
||||||
open_uri(path.c_str()); // open the soundcloud website to the new file
|
open_uri(path.c_str()); // open the soundcloud website to the new file
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
|
#include "ardour/debug.h"
|
||||||
#include "ardour/soundcloud_upload.h"
|
#include "ardour/soundcloud_upload.h"
|
||||||
|
|
||||||
#include "pbd/xml++.h"
|
#include "pbd/xml++.h"
|
||||||
@ -120,7 +121,7 @@ SoundcloudUploader::Get_Auth_Token( std::string username, std::string password )
|
|||||||
// perform online request
|
// perform online request
|
||||||
CURLcode res = curl_easy_perform(curl_handle);
|
CURLcode res = curl_easy_perform(curl_handle);
|
||||||
if( res != 0 ) {
|
if( res != 0 ) {
|
||||||
std::cerr << "curl error " << res << " (" << curl_easy_strerror(res) << ")" << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("curl error %1 (%2)", res, curl_easy_strerror(res) ) );
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ int
|
|||||||
SoundcloudUploader::progress_callback(void *caller, double dltotal, double dlnow, double ultotal, double ulnow)
|
SoundcloudUploader::progress_callback(void *caller, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||||
{
|
{
|
||||||
SoundcloudUploader *scu = (SoundcloudUploader *) caller;
|
SoundcloudUploader *scu = (SoundcloudUploader *) caller;
|
||||||
std::cerr << scu->title << ": uploaded " << ulnow << " of " << ultotal << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("%1: uploaded %2 of %3", scu->title, ulnow, ultotal) );
|
||||||
scu->caller->SoundcloudProgress(ultotal, ulnow, scu->title); /* EMIT SIGNAL */
|
scu->caller->SoundcloudProgress(ultotal, ulnow, scu->title); /* EMIT SIGNAL */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -297,26 +298,26 @@ SoundcloudUploader::Upload(std::string file_path, std::string title, std::string
|
|||||||
|
|
||||||
if(xml_page.memory){
|
if(xml_page.memory){
|
||||||
|
|
||||||
std::cout << xml_page.memory << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, xml_page.memory);
|
||||||
|
|
||||||
XMLTree doc;
|
XMLTree doc;
|
||||||
doc.read_buffer( xml_page.memory );
|
doc.read_buffer( xml_page.memory );
|
||||||
XMLNode *root = doc.root();
|
XMLNode *root = doc.root();
|
||||||
|
|
||||||
if (!root) {
|
if (!root) {
|
||||||
std::cout << "no root XML node!" << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, "no root XML node!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *url_node = root->child("permalink-url");
|
XMLNode *url_node = root->child("permalink-url");
|
||||||
if (!url_node) {
|
if (!url_node) {
|
||||||
std::cout << "no child node \"permalink-url\" found!" << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, "no child node \"permalink-url\" found!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode *text_node = url_node->child("text");
|
XMLNode *text_node = url_node->child("text");
|
||||||
if (!text_node) {
|
if (!text_node) {
|
||||||
std::cout << "no text node found!" << std::endl;
|
DEBUG_TRACE (DEBUG::Soundcloud, "no text node found!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user