summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2013-10-07 20:28:13 +0100
committerColin Fletcher <colin.m.fletcher@googlemail.com>2013-10-07 20:28:13 +0100
commit2a93f7a25e63c796745c4a34ebc13239382ba2df (patch)
tree9ebc4a503ee4adf8cef24fedc9cdd1fe738fb261 /libs
parent8b9a1fae6a580b526b3fc784581e6d0c8031b6db (diff)
Rudimentary post-processing of exported files.
Export format contains a string to be passed to system() after expanding %1, %2, & %3 via string_compose() to the full path & filename, containing directory, and basename respectively. No error-checking or any niceties like that - real programmers will of course always type the command correctly, and know to watch Ardour's standard output for the results...
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/export_format_manager.h1
-rw-r--r--libs/ardour/ardour/export_format_specification.h3
-rw-r--r--libs/ardour/export_format_manager.cc8
-rw-r--r--libs/ardour/export_format_specification.cc13
-rw-r--r--libs/ardour/export_handler.cc10
5 files changed, 35 insertions, 0 deletions
diff --git a/libs/ardour/ardour/export_format_manager.h b/libs/ardour/ardour/export_format_manager.h
index 4b4e43ae9c..9fce8282a1 100644
--- a/libs/ardour/ardour/export_format_manager.h
+++ b/libs/ardour/ardour/export_format_manager.h
@@ -101,6 +101,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList
void select_with_cue (bool);
void select_with_toc (bool);
void select_upload (bool);
+ void set_command (std::string);
void select_src_quality (ExportFormatBase::SRCQuality value);
void select_trim_beginning (bool value);
void select_silence_beginning (AnyTime const & time);
diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h
index cb99afdfa2..768fbb3bb3 100644
--- a/libs/ardour/ardour/export_format_specification.h
+++ b/libs/ardour/ardour/export_format_specification.h
@@ -96,6 +96,7 @@ class ExportFormatSpecification : public ExportFormatBase {
void set_with_cue (bool yn) { _with_cue = yn; }
void set_with_toc (bool yn) { _with_toc = yn; }
void set_upload (bool yn) { _upload = yn; }
+ void set_command (std::string command) { _command = command; }
void set_silence_beginning (AnyTime const & value) { _silence_beginning = value; }
void set_silence_end (AnyTime const & value) { _silence_end = value; }
@@ -126,6 +127,7 @@ class ExportFormatSpecification : public ExportFormatBase {
bool with_toc() const { return _with_toc; }
bool with_cue() const { return _with_cue; }
bool upload() const { return _upload; }
+ std::string command() const { return _command; }
bool tag () const { return _tag && supports_tagging; }
@@ -176,6 +178,7 @@ class ExportFormatSpecification : public ExportFormatBase {
bool _with_toc;
bool _with_cue;
bool _upload;
+ std::string _command;
/* serialization helpers */
diff --git a/libs/ardour/export_format_manager.cc b/libs/ardour/export_format_manager.cc
index c8bd0c0aa9..3ee940ffb6 100644
--- a/libs/ardour/export_format_manager.cc
+++ b/libs/ardour/export_format_manager.cc
@@ -300,6 +300,14 @@ ExportFormatManager::select_upload (bool value)
check_for_description_change ();
}
+void
+ExportFormatManager::set_command (std::string command)
+{
+ current_selection->set_command (command);
+ check_for_description_change ();
+}
+
+void
ExportFormatManager::select_trim_beginning (bool value)
{
current_selection->set_trim_beginning (value);
diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc
index 588a156d4a..8b921519f7 100644
--- a/libs/ardour/export_format_specification.cc
+++ b/libs/ardour/export_format_specification.cc
@@ -171,6 +171,7 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s)
, _with_toc (false)
, _with_cue (false)
, _upload (false)
+ , _command ("")
{
format_ids.insert (F_None);
endiannesses.insert (E_FileDefault);
@@ -246,6 +247,7 @@ ExportFormatSpecification::get_state ()
root->add_property ("with-cue", _with_cue ? "true" : "false");
root->add_property ("with-toc", _with_toc ? "true" : "false");
root->add_property ("upload", _upload ? "true" : "false");
+ root->add_property ("command", _command);
node = root->add_child ("Encoding");
node->add_property ("id", enum_2_string (format_id()));
@@ -329,6 +331,12 @@ ExportFormatSpecification::set_state (const XMLNode & root)
_upload = false;
}
+ if ((prop = root.property ("command"))) {
+ _command = prop->value();
+ } else {
+ _command = "";
+ }
+
/* Encoding and SRC */
if ((child = root.child ("Encoding"))) {
@@ -601,6 +609,11 @@ ExportFormatSpecification::description (bool include_name)
if (_upload) {
components.push_back ("Upload");
}
+
+ if (!_command.empty()) {
+ components.push_back ("+");
+ }
+
string desc;
if (include_name) {
desc = _name + ": ";
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc
index 7ca6cb8c53..042edaf788 100644
--- a/libs/ardour/export_handler.cc
+++ b/libs/ardour/export_handler.cc
@@ -293,6 +293,16 @@ ExportHandler::finish_timespan ()
export_cd_marker_file (current_timespan, fmt, filepath, CDMarkerTOC);
}
+ if (!fmt->command().empty()) {
+ std::string command = string_compose(fmt->command(),
+ filepath,
+ Glib::path_get_dirname(filepath),
+ PBD::basename_nosuffix(filepath)
+ );
+ std::cerr << "running command: " << command << "..." << std::endl;
+ system(command.c_str());
+ }
+
if (fmt->upload()) {
SoundcloudUploader *soundcloud_uploader = new SoundcloudUploader;
std::string token = soundcloud_uploader->Get_Auth_Token(upload_username, upload_password);