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:
Colin Fletcher 2013-10-07 14:44:35 +01:00
parent 15b4ebbb07
commit a3465ff5d3
16 changed files with 335 additions and 62 deletions

View file

@ -151,6 +151,7 @@ ExportDialog::init_gui ()
file_format_selector->set_homogeneous (false);
file_format_selector->pack_start (*preset_align, false, false, 0);
file_format_selector->pack_start (*file_notebook, false, false, 0);
file_format_selector->pack_start (*soundcloud_selector, false, false, 0);
export_notebook.append_page (*file_format_selector, _("File format"));
export_notebook.append_page (*timespan_selector, _("Time Span"));
@ -168,6 +169,7 @@ ExportDialog::init_components ()
preset_selector.reset (new ExportPresetSelector ());
timespan_selector.reset (new ExportTimespanSelectorMultiple (_session, profile_manager));
channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new ExportFileNotebook ());
}
@ -257,10 +259,33 @@ ExportDialog::show_conflicting_files ()
dialog.run();
}
void
ExportDialog::soundcloud_upload_progress(double total, double now, std::string title)
{
soundcloud_selector->do_progress_callback(total, now, title);
}
void
ExportDialog::do_export ()
{
profile_manager->prepare_for_export ();
handler->upload_username = soundcloud_selector->username();
handler->upload_password = soundcloud_selector->password();
handler->upload_public = soundcloud_selector->upload_public();
handler->upload_open = soundcloud_selector->upload_open();
handler->SoundcloudProgress.connect_same_thread(
*this,
boost::bind(&ExportDialog::soundcloud_upload_progress, this, _1, _2, _3)
);
#if 0
handler->SoundcloudProgress.connect(
*this, invalidator (*this),
boost::bind(&ExportDialog::soundcloud_upload_progress, this, _1, _2, _3),
gui_context()
);
#endif
handler->do_export ();
show_progress ();
}
@ -370,6 +395,7 @@ ExportRangeDialog::init_components ()
preset_selector.reset (new ExportPresetSelector ());
timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, range_id));
channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new ExportFileNotebook ());
}
@ -383,6 +409,7 @@ ExportSelectionDialog::init_components ()
preset_selector.reset (new ExportPresetSelector ());
timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, X_("selection")));
channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new ExportFileNotebook ());
}
@ -407,6 +434,7 @@ ExportRegionDialog::init_components ()
preset_selector.reset (new ExportPresetSelector ());
timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, loc_id));
channel_selector.reset (new RegionExportChannelSelector (_session, profile_manager, region, track));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new ExportFileNotebook ());
}
@ -422,5 +450,6 @@ StemExportDialog::init_components ()
preset_selector.reset (new ExportPresetSelector ());
timespan_selector.reset (new ExportTimespanSelectorMultiple (_session, profile_manager));
channel_selector.reset (new TrackExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new ExportFileNotebook ());
}