mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 07:06:23 +01:00
Working Soundcloud export
Adds an 'upload' property to ExportFormatSpecification, to indicate that files exported with that format specfication should be uploaded to Soundcloud, and makes it editable in the export format dialogue. Adds fields for the Soundcloud username & password to the file format selection page, as well as an option to make the uploaded files public and open them in the system browser. Possible improvements not yet implemented: - make upload happen in its own thread - cosmetic tidying up of dialogue control layout - remember username & password
This commit is contained in:
parent
15b4ebbb07
commit
a3465ff5d3
16 changed files with 335 additions and 62 deletions
|
|
@ -31,6 +31,9 @@
|
|||
#include "ardour/export_status.h"
|
||||
#include "ardour/export_format_specification.h"
|
||||
#include "ardour/export_filename.h"
|
||||
#include "ardour/soundcloud_upload.h"
|
||||
#include "pbd/openuri.h"
|
||||
#include "pbd/basename.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -280,22 +283,50 @@ ExportHandler::finish_timespan ()
|
|||
while (config_map.begin() != timespan_bounds.second) {
|
||||
|
||||
ExportFormatSpecPtr fmt = config_map.begin()->second.format;
|
||||
std::string filepath = config_map.begin()->second.filename->get_path(fmt);
|
||||
|
||||
if (fmt->with_cue()) {
|
||||
export_cd_marker_file (current_timespan, fmt, config_map.begin()->second.filename->get_path(fmt), CDMarkerCUE);
|
||||
export_cd_marker_file (current_timespan, fmt, filepath, CDMarkerCUE);
|
||||
}
|
||||
|
||||
if (fmt->with_toc()) {
|
||||
export_cd_marker_file (current_timespan, fmt, config_map.begin()->second.filename->get_path(fmt), CDMarkerTOC);
|
||||
export_cd_marker_file (current_timespan, fmt, filepath, CDMarkerTOC);
|
||||
}
|
||||
|
||||
if (fmt->upload()) {
|
||||
SoundcloudUploader *soundcloud_uploader = new SoundcloudUploader;
|
||||
std::string token = soundcloud_uploader->Get_Auth_Token(upload_username, upload_password);
|
||||
std::cerr
|
||||
<< "uploading "
|
||||
<< filepath << std::endl
|
||||
<< "username = " << upload_username
|
||||
<< ", password = " << upload_password
|
||||
<< " - token = " << token << " ..."
|
||||
<< std::endl;
|
||||
std::string path = soundcloud_uploader->Upload (
|
||||
filepath,
|
||||
PBD::basename_nosuffix(filepath), // title
|
||||
token,
|
||||
upload_public,
|
||||
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
|
||||
}
|
||||
} else {
|
||||
error << _("upload to Soundcloud failed. Perhaps your email or password are incorrect?\n") << endmsg;
|
||||
}
|
||||
delete soundcloud_uploader;
|
||||
}
|
||||
config_map.erase (config_map.begin());
|
||||
}
|
||||
|
||||
start_timespan ();
|
||||
}
|
||||
|
||||
/*** CD Marker sutff ***/
|
||||
/*** CD Marker stuff ***/
|
||||
|
||||
struct LocationSortByStart {
|
||||
bool operator() (Location *a, Location *b) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue