Prepare for optional timespan name during export.
authorRobin Gareus <robin@gareus.org>
Thu, 11 Feb 2016 19:51:19 +0000 (20:51 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 11 Feb 2016 19:58:05 +0000 (20:58 +0100)
libs/ardour/export_filename.cc
libs/ardour/export_handler.cc

index 077106a4b0a8e0afe73d9bf31d25336300fcf91d..8186982384e130f80907bfe733370fff57b2b692 100644 (file)
@@ -169,6 +169,18 @@ ExportFilename::get_path (ExportFormatSpecPtr format) const
 {
        string path;
        bool filename_empty = true;
+       bool with_timespan = include_timespan;
+
+       if (!include_session
+                       && !include_label
+                       && !include_revision
+                       && !include_timespan
+                       && !include_channel_config
+                       && !include_channel
+                       && !include_date
+                       && !include_format_name) {
+               with_timespan = true;
+       }
 
        if (include_session) {
                path += filename_empty ? "" : "_";
@@ -189,7 +201,7 @@ ExportFilename::get_path (ExportFormatSpecPtr format) const
                filename_empty = false;
        }
 
-       if (include_timespan && timespan) {
+       if (with_timespan && timespan) {
                path += filename_empty ? "" : "_";
                path += timespan->name();
                filename_empty = false;
@@ -226,6 +238,10 @@ ExportFilename::get_path (ExportFormatSpecPtr format) const
                filename_empty = false;
        }
 
+       if (path.empty ()) {
+               path = "export";
+       }
+
        path += ".";
        path += format->extension ();
 
index 6b59afec89c8736285e47eb84b6ca9ea504b671f..42de0fa0c6f623f7ffc46a63620469270b53b248 100644 (file)
@@ -148,6 +148,14 @@ ExportHandler::do_export ()
        }
        export_status->total_timespans = timespan_set.size();
 
+       if (export_status->total_timespans > 1) {
+               // always include timespan if there's more than one.
+               for (ConfigMap::iterator it = config_map.begin(); it != config_map.end(); ++it) {
+                       FileSpec & spec = it->second;
+                       spec.filename->include_timespan = true;
+               }
+       }
+
        /* Start export */
 
        Glib::Threads::Mutex::Lock l (export_status->lock());