summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-08-16 16:24:33 +0100
committerCarl Hetherington <cth@carlh.net>2016-08-16 16:24:33 +0100
commit03c5a8155043613c01e0e151735a7fcf8ab84415 (patch)
tree671045ad4731e1782e92be9109f48da8b5726081 /src
parent47e78514ffa98c991ddd38d077836f4a558fbec0 (diff)
Tidy up a few details with custom filenames.
Diffstat (limited to 'src')
-rw-r--r--src/lib/cinema_kdms.cc6
-rw-r--r--src/lib/config.cc4
-rw-r--r--src/lib/screen_kdm.cc2
-rw-r--r--src/lib/util.cc6
-rw-r--r--src/wx/config_dialog.cc14
-rw-r--r--src/wx/kdm_output_panel.cc2
-rw-r--r--src/wx/name_format_editor.cc7
-rw-r--r--src/wx/name_format_editor.h3
8 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc
index c05dd6138..6a0349b31 100644
--- a/src/lib/cinema_kdms.cc
+++ b/src/lib/cinema_kdms.cc
@@ -64,7 +64,7 @@ CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat nam
}
name_values['s'] = i.screen->name;
- string const name = name_format.get(name_values) + ".xml";
+ string const name = name_format.get(name_values, ".xml");
if (zip_add (zip, name.c_str(), source) == -1) {
throw runtime_error ("failed to add KDM to ZIP archive");
}
@@ -128,7 +128,7 @@ CinemaKDMs::write_zip_files (
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
boost::filesystem::path path = directory;
name_values['c'] = i.cinema->name;
- path /= name_format.get(name_values) + ".zip";
+ path /= name_format.get(name_values, ".zip");
i.make_zip_file (path, name_format, name_values);
}
}
@@ -189,7 +189,7 @@ CinemaKDMs::email (
email.add_bcc (config->kdm_bcc ());
}
- email.add_attachment (zip_file, name_format.get(name_values) + ".zip", "application/zip");
+ email.add_attachment (zip_file, name_format.get(name_values, ".zip"), "application/zip");
Config* c = Config::instance ();
diff --git a/src/lib/config.cc b/src/lib/config.cc
index b5e4b4d00..5df45ea08 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -111,8 +111,8 @@ Config::set_defaults ()
_cinemas_file = path ("cinemas.xml");
_show_hints_before_make_dcp = true;
_kdm_filename_format = dcp::NameFormat ("KDM %f %c %s");
- _dcp_metadata_filename_format = dcp::NameFormat ("%t_%i");
- _dcp_asset_filename_format = dcp::NameFormat ("%t_%i");
+ _dcp_metadata_filename_format = dcp::NameFormat ("%t");
+ _dcp_asset_filename_format = dcp::NameFormat ("%t");
_allowed_dcp_frame_rates.clear ();
_allowed_dcp_frame_rates.push_back (24);
diff --git a/src/lib/screen_kdm.cc b/src/lib/screen_kdm.cc
index 129e64aee..182d03bb0 100644
--- a/src/lib/screen_kdm.cc
+++ b/src/lib/screen_kdm.cc
@@ -41,7 +41,7 @@ ScreenKDM::write_files (list<ScreenKDM> screen_kdms, boost::filesystem::path dir
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
name_values['c'] = i.screen->cinema->name;
name_values['s'] = i.screen->name;
- boost::filesystem::path out = directory / (name_format.get(name_values) + ".xml");
+ boost::filesystem::path out = directory / (name_format.get(name_values, ".xml"));
i.kdm.as_xml (out);
}
}
diff --git a/src/lib/util.cc b/src/lib/util.cc
index d20fd7dc7..704d4aa9d 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -619,13 +619,12 @@ video_asset_filename (shared_ptr<dcp::PictureAsset> asset, int reel_index, int r
{
dcp::NameFormat::Map values;
values['t'] = "j2c";
- values['i'] = asset->id();
values['r'] = raw_convert<string> (reel_index + 1);
values['n'] = raw_convert<string> (reel_count);
if (summary) {
values['c'] = summary.get();
}
- return Config::instance()->dcp_asset_filename_format().get(values) + ".mxf";
+ return Config::instance()->dcp_asset_filename_format().get(values, "_" + asset->id() + ".mxf");
}
string
@@ -633,13 +632,12 @@ audio_asset_filename (shared_ptr<dcp::SoundAsset> asset, int reel_index, int ree
{
dcp::NameFormat::Map values;
values['t'] = "pcm";
- values['i'] = asset->id();
values['r'] = raw_convert<string> (reel_index + 1);
values['n'] = raw_convert<string> (reel_count);
if (summary) {
values['c'] = summary.get();
}
- return Config::instance()->dcp_asset_filename_format().get(values) + ".mxf";
+ return Config::instance()->dcp_asset_filename_format().get(values, "_" + asset->id() + ".mxf");
}
float
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index cb9f4669b..c18cf3c92 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -1440,13 +1440,11 @@ private:
add_top_aligned_label_to_sizer (table, _panel, _("DCP metadata filename format"));
dcp::NameFormat::Map titles;
titles['t'] = "type (cpl/pkl)";
- titles['i'] = "unique ID";
- titles['c'] = "content filename";
dcp::NameFormat::Map examples;
examples['t'] = "cpl";
- examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64";
- examples['c'] = "myfile.mp4";
- _dcp_metadata_filename_format = new NameFormatEditor (_panel, Config::instance()->dcp_metadata_filename_format(), titles, examples);
+ _dcp_metadata_filename_format = new NameFormatEditor (
+ _panel, Config::instance()->dcp_metadata_filename_format(), titles, examples, "_eb1c112c-ca3c-4ae6-9263-c6714ff05d64.xml"
+ );
table->Add (_dcp_metadata_filename_format->panel(), 1, wxEXPAND | wxALL);
}
@@ -1454,17 +1452,17 @@ private:
add_top_aligned_label_to_sizer (table, _panel, _("DCP asset filename format"));
dcp::NameFormat::Map titles;
titles['t'] = "type (j2c/pcm/sub)";
- titles['i'] = "unique ID";
titles['r'] = "reel number";
titles['n'] = "number of reels";
titles['c'] = "content filename";
dcp::NameFormat::Map examples;
examples['t'] = "j2c";
- examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64";
examples['r'] = "1";
examples['n'] = "4";
examples['c'] = "myfile.mp4";
- _dcp_asset_filename_format = new NameFormatEditor (_panel, Config::instance()->dcp_asset_filename_format(), titles, examples);
+ _dcp_asset_filename_format = new NameFormatEditor (
+ _panel, Config::instance()->dcp_asset_filename_format(), titles, examples, "_eb1c112c-ca3c-4ae6-9263-c6714ff05d64.mxf"
+ );
table->Add (_dcp_asset_filename_format->panel(), 1, wxEXPAND | wxALL);
}
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc
index 537cf6652..4130e4938 100644
--- a/src/wx/kdm_output_panel.cc
+++ b/src/wx/kdm_output_panel.cc
@@ -68,7 +68,7 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
ex['s'] = "Screen 1";
ex['b'] = "2012/03/15 12:30";
ex['e'] = "2012/03/22 02:30";
- _filename_format = new NameFormatEditor (this, Config::instance()->kdm_filename_format(), titles, ex);
+ _filename_format = new NameFormatEditor (this, Config::instance()->kdm_filename_format(), titles, ex, ".xml");
table->Add (_filename_format->panel(), 1, wxEXPAND);
_write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
diff --git a/src/wx/name_format_editor.cc b/src/wx/name_format_editor.cc
index 7d0915896..160a554c0 100644
--- a/src/wx/name_format_editor.cc
+++ b/src/wx/name_format_editor.cc
@@ -21,13 +21,16 @@
#include "name_format_editor.h"
#include "wx_util.h"
-NameFormatEditor::NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples)
+using std::string;
+
+NameFormatEditor::NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples, string suffix)
: _panel (new wxPanel (parent))
, _example (new wxStaticText (_panel, wxID_ANY, ""))
, _sizer (new wxBoxSizer (wxVERTICAL))
, _specification (new wxTextCtrl (_panel, wxID_ANY, ""))
, _name (name)
, _examples (examples)
+ , _suffix (suffix)
{
_sizer->Add (_specification, 0, wxEXPAND, DCPOMATIC_SIZER_Y_GAP);
_sizer->Add (_example, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
@@ -61,7 +64,7 @@ NameFormatEditor::update_example ()
{
_name.set_specification (wx_to_std (_specification->GetValue ()));
- wxString example = wxString::Format (_("e.g. %s"), _name.get (_examples));
+ wxString example = wxString::Format (_("e.g. %s"), _name.get (_examples, _suffix));
wxString wrapped;
for (size_t i = 0; i < example.Length(); ++i) {
if (i > 0 && (i % 40) == 0) {
diff --git a/src/wx/name_format_editor.h b/src/wx/name_format_editor.h
index 204de76d3..2ae3f5e93 100644
--- a/src/wx/name_format_editor.h
+++ b/src/wx/name_format_editor.h
@@ -30,7 +30,7 @@
class NameFormatEditor
{
public:
- NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples);
+ NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples, std::string suffix);
wxPanel* panel () const {
return _panel;
@@ -54,6 +54,7 @@ private:
dcp::NameFormat _name;
dcp::NameFormat::Map _examples;
+ std::string _suffix;
};
#endif