Merge remote-tracking branch 'origin/master' into export-dialog
authorColin Fletcher <colin.m.fletcher@googlemail.com>
Wed, 8 Jan 2014 15:14:35 +0000 (15:14 +0000)
committerColin Fletcher <colin.m.fletcher@googlemail.com>
Wed, 8 Jan 2014 15:50:34 +0000 (15:50 +0000)
Fix conflicts in:
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_dialog.h
libs/ardour/export_handler.cc

1  2 
gtk2_ardour/ardour_ui.cc
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_dialog.h
gtk2_ardour/export_format_dialog.cc
gtk2_ardour/wscript
libs/ardour/export_handler.cc
libs/ardour/wscript

Simple merge
index ae4e8b7f777a1313e86f74b4f41a6e802a9647c8,145874778687826b7d46322724530ce6c3c9d913..dfba7550aca57c28e8086f191ec8fe359baf1267
@@@ -269,25 -303,14 +269,30 @@@ ExportDialog::soundcloud_upload_progres
  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)
-       );
+       try {
+               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()
-       );
++              handler->SoundcloudProgress.connect(
++                              *this, invalidator (*this),
++                              boost::bind(&ExportDialog::soundcloud_upload_progress, this, _1, _2, _3),
++                              gui_context()
++                              );
 +#endif
-       handler->do_export ();
-       show_progress ();
+               handler->do_export ();
+               show_progress ();
+       } catch(std::exception & e) {
+               error << string_compose (_("Export initialization failed: %1"), e.what()) << endmsg;
+               notify_errors(true);
+       }
  }
  
  void
index 0cc288f172abc4318b9949276e0bcc1a715bcfb5,756a3e7b53a4fda2f5b0288262157b7e894d445c..315780750e6c9813c066502dcdcd5f68465d2b2d
@@@ -93,7 -93,9 +93,7 @@@ class ExportDialog : public ArdourDialo
  
        void init ();
  
-       void notify_errors ();
 -      void expanded_changed();
 -
+       void notify_errors (bool force = false);
        void close_dialog ();
  
        void sync_with_manager ();
Simple merge
Simple merge
index f2fb895b91238e342d01c76c9b0255e73f95ec0b,93f43f33a63ac65269566f0bbf1945285e0d95d3..01f5c989d39b09d2f5df28e1b8deb1cf12cab034
  #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 "pbd/system_exec.h"
+ #include "ardour/session_metadata.h"
  
  #include "i18n.h"
  
@@@ -291,80 -282,20 +293,84 @@@ 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);
+               std::string filename = config_map.begin()->second.filename->get_path(fmt);
  
                if (fmt->with_cue()) {
-                       export_cd_marker_file (current_timespan, fmt, filepath, CDMarkerCUE);
-               } 
+                       export_cd_marker_file (current_timespan, fmt, filename, CDMarkerCUE);
+               }
  
                if (fmt->with_toc()) {
-                       export_cd_marker_file (current_timespan, fmt, filepath, CDMarkerTOC);
+                       export_cd_marker_file (current_timespan, fmt, filename, CDMarkerTOC);
+               }
+               if (fmt->tag()) {
+                       AudiofileTagger::tag_file(filename, *SessionMetadata::Metadata());
                }
  
-                               { 'f', filepath },
-                               { 'd', Glib::path_get_dirname(filepath) },
-                               { 'b', PBD::basename_nosuffix(filepath) },
 +              if (!fmt->command().empty()) {
 +
 +#if 0                 // would be nicer with C++11 initialiser...
 +                      std::map<char, std::string> subs {
-                       subs.insert (std::pair<char, std::string> ('f', filepath));
-                       subs.insert (std::pair<char, std::string> ('d', Glib::path_get_dirname(filepath)));
-                       subs.insert (std::pair<char, std::string> ('b', PBD::basename_nosuffix(filepath)));
++                              { 'f', filename },
++                              { 'd', Glib::path_get_dirname(filename) },
++                              { 'b', PBD::basename_nosuffix(filename) },
 +                              { 'u', upload_username },
 +                              { 'p', upload_password}
 +                      };
 +#endif
 +
 +                      PBD::ScopedConnection command_connection;
 +                      std::map<char, std::string> subs;
-                               << filepath << std::endl
++                      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));
 +
 +
 +                      std::cerr << "running command: " << fmt->command() << "..." << std::endl;
 +                      SystemExec *se = new 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
 +                              std::cerr << "started!" << std::endl;
 +                              while (se->is_running ()) {
 +                                      // wait for system exec to terminate
 +                                      // std::cerr << "waiting..." << std::endl;
 +                                      usleep (1000);
 +                              }
 +                      }
 +                      std::cerr << "done! deleting..." << std::endl;
 +                      delete (se);
 +              }
 +
 +              if (fmt->upload()) {
 +                      SoundcloudUploader *soundcloud_uploader = new SoundcloudUploader;
 +                      std::string token = soundcloud_uploader->Get_Auth_Token(upload_username, upload_password);
 +                      std::cerr
 +                              << "uploading "
-                                       filepath,
-                                       PBD::basename_nosuffix(filepath), // title
++                              << filename << std::endl
 +                              << "username = " << upload_username
 +                              << ", password = " << upload_password
 +                              << " - token = " << token << " ..."
 +                              << std::endl;
 +                      std::string path = soundcloud_uploader->Upload (
++                                      filename,
++                                      PBD::basename_nosuffix(filename), // 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());
        }
  
Simple merge