#include "ardour/export_handler.h"
+#include <glib/gstdio.h>
#include <glibmm.h>
#include <glibmm/convert.h>
#include "pbd/convert.h"
#include "ardour/audiofile_tagger.h"
+#include "ardour/debug.h"
#include "ardour/export_graph_builder.h"
#include "ardour/export_timespan.h"
#include "ardour/export_channel_configuration.h"
#include "ardour/export_format_specification.h"
#include "ardour/export_filename.h"
#include "ardour/soundcloud_upload.h"
+#include "ardour/system_exec.h"
#include "pbd/openuri.h"
#include "pbd/basename.h"
-#include "pbd/system_exec.h"
#include "ardour/session_metadata.h"
#include "i18n.h"
subs.insert (std::pair<char, std::string> ('f', filename));
subs.insert (std::pair<char, std::string> ('d', Glib::path_get_dirname(filename)));
subs.insert (std::pair<char, std::string> ('b', PBD::basename_nosuffix(filename)));
- subs.insert (std::pair<char, std::string> ('u', upload_username));
- subs.insert (std::pair<char, std::string> ('p', upload_password));
+ subs.insert (std::pair<char, std::string> ('u', soundcloud_username));
+ subs.insert (std::pair<char, std::string> ('p', soundcloud_password));
std::cerr << "running command: " << fmt->command() << "..." << std::endl;
- SystemExec *se = new SystemExec(fmt->command(), subs);
+ ARDOUR::SystemExec *se = new ARDOUR::SystemExec(fmt->command(), subs);
se->ReadStdout.connect_same_thread(command_connection, boost::bind(&ExportHandler::command_output, this, _1, _2));
if (se->start (2) == 0) {
// successfully started
while (se->is_running ()) {
// wait for system exec to terminate
// std::cerr << "waiting..." << std::endl;
- usleep (1000);
+ Glib::usleep (1000);
}
}
std::cerr << "done! deleting..." << std::endl;
delete (se);
}
- if (fmt->upload()) {
+ if (fmt->soundcloud_upload()) {
SoundcloudUploader *soundcloud_uploader = new SoundcloudUploader;
- std::string token = soundcloud_uploader->Get_Auth_Token(upload_username, upload_password);
- std::cerr
- << "uploading "
- << filename << std::endl
- << "username = " << upload_username
- << ", password = " << upload_password
- << " - token = " << token << " ..."
- << std::endl;
+ std::string token = soundcloud_uploader->Get_Auth_Token(soundcloud_username, soundcloud_password);
+ DEBUG_TRACE (DEBUG::Soundcloud, string_compose(
+ "uploading %1 - username=%2, password=%3, token=%4",
+ filename, soundcloud_username, soundcloud_password, token) );
std::string path = soundcloud_uploader->Upload (
filename,
PBD::basename_nosuffix(filename), // title
token,
- upload_public,
+ soundcloud_make_public,
+ soundcloud_downloadable,
this);
if (path.length() != 0) {
- if (upload_open) {
- std::cerr << "opening " << path << " ..." << std::endl;
- open_uri(path.c_str()); // open the soundcloud website to the new file
+ info << string_compose ( _("File %1 uploaded to %2"), filename, path) << endmsg;
+ if (soundcloud_open_page) {
+ DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("opening %1", path) );
+ open_uri(path.c_str()); // open the soundcloud website to the new file
}
} else {
error << _("upload to Soundcloud failed. Perhaps your email or password are incorrect?\n") << endmsg;
} catch (std::exception& e) {
error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg;
- ::unlink (filepath.c_str());
+ ::g_unlink (filepath.c_str());
} catch (Glib::Exception& e) {
error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg;
- ::unlink (filepath.c_str());
+ ::g_unlink (filepath.c_str());
}
}