summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-07-29 16:21:40 +0100
committerCarl Hetherington <cth@carlh.net>2016-07-29 16:21:40 +0100
commitfbe2784c136fa1550815babfce89589f66b35a29 (patch)
tree2099493253d82c71e7a1f2036bcbcbf980ab9f95 /src/lib
parentfe9d2a290682021cd12a00bf21fa4db3012e2049 (diff)
Simplification of name format stuff.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cinema_kdms.cc20
-rw-r--r--src/lib/kdm_name_format.cc15
-rw-r--r--src/lib/screen_kdm.cc4
-rw-r--r--src/lib/send_kdm_email_job.cc2
-rw-r--r--src/lib/util.cc8
5 files changed, 27 insertions, 22 deletions
diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc
index cbfad4bb3..c50578734 100644
--- a/src/lib/cinema_kdms.cc
+++ b/src/lib/cinema_kdms.cc
@@ -53,7 +53,7 @@ CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, KDMNameFormat name_
list<shared_ptr<string> > kdm_strings;
- name_values["cinema"] = cinema->name;
+ name_values['c'] = cinema->name;
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
shared_ptr<string> kdm (new string (i.kdm.as_xml ()));
@@ -64,7 +64,7 @@ CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, KDMNameFormat name_
throw runtime_error ("could not create ZIP source");
}
- name_values["screen"] = i.screen->name;
+ name_values['s'] = i.screen->name;
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");
@@ -124,11 +124,11 @@ CinemaKDMs::write_zip_files (
)
{
/* No specific screen */
- name_values["screen"] = "";
+ name_values['s'] = "";
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
boost::filesystem::path path = directory;
- name_values["cinema"] = i.cinema->name;
+ name_values['c'] = i.cinema->name;
path /= name_format.get(name_values) + ".zip";
i.make_zip_file (path, name_format, name_values);
}
@@ -153,11 +153,11 @@ CinemaKDMs::email (
}
/* No specific screen */
- name_values["screen"] = "";
+ name_values['s'] = "";
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
- name_values["cinema"] = i.cinema->name;
+ name_values['c'] = i.cinema->name;
boost::filesystem::path zip_file = boost::filesystem::temp_directory_path ();
zip_file /= boost::filesystem::unique_path().string() + ".zip";
@@ -165,14 +165,14 @@ CinemaKDMs::email (
string subject = config->kdm_subject();
boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
- boost::algorithm::replace_all (subject, "$START_TIME", name_values["from"]);
- boost::algorithm::replace_all (subject, "$END_TIME", name_values["to"]);
+ boost::algorithm::replace_all (subject, "$START_TIME", name_values['f']);
+ boost::algorithm::replace_all (subject, "$END_TIME", name_values['t']);
boost::algorithm::replace_all (subject, "$CINEMA_NAME", i.cinema->name);
string body = config->kdm_email().c_str();
boost::algorithm::replace_all (body, "$CPL_NAME", cpl_name);
- boost::algorithm::replace_all (body, "$START_TIME", name_values["from"]);
- boost::algorithm::replace_all (body, "$END_TIME", name_values["to"]);
+ boost::algorithm::replace_all (body, "$START_TIME", name_values['f']);
+ boost::algorithm::replace_all (body, "$END_TIME", name_values['t']);
boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
locked_stringstream screens;
diff --git a/src/lib/kdm_name_format.cc b/src/lib/kdm_name_format.cc
index fe4a3fc62..bf17acbf1 100644
--- a/src/lib/kdm_name_format.cc
+++ b/src/lib/kdm_name_format.cc
@@ -25,9 +25,14 @@ using std::string;
KDMNameFormat::KDMNameFormat (string specification)
: NameFormat (specification)
{
- add ("film_name", 'f', "film name");
- add ("cinema", 'c', "cinema");
- add ("screen", 's', "screen");
- add ("from", 'b', "from date/time");
- add ("to", 'e', "to date/time");
+ /* film name */
+ add ('f');
+ /* cinema */
+ add ('c');
+ /* screen */
+ add ('s');
+ /* from date/time */
+ add ('b');
+ /* to date/time */
+ add ('e');
}
diff --git a/src/lib/screen_kdm.cc b/src/lib/screen_kdm.cc
index 22081fc81..3290d2a68 100644
--- a/src/lib/screen_kdm.cc
+++ b/src/lib/screen_kdm.cc
@@ -39,8 +39,8 @@ ScreenKDM::write_files (list<ScreenKDM> screen_kdms, boost::filesystem::path dir
{
/* Write KDMs to the specified directory */
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
- name_values["cinema"] = i.screen->cinema->name;
- name_values["screen"] = i.screen->name;
+ name_values['c'] = i.screen->cinema->name;
+ name_values['s'] = i.screen->name;
boost::filesystem::path out = directory / (name_format.get(name_values) + ".xml");
i.kdm.as_xml (out);
}
diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc
index 3bf1887f4..e4b20167e 100644
--- a/src/lib/send_kdm_email_job.cc
+++ b/src/lib/send_kdm_email_job.cc
@@ -51,7 +51,7 @@ SendKDMEmailJob::SendKDMEmailJob (
string
SendKDMEmailJob::name () const
{
- dcp::NameFormat::Map::const_iterator i = _name_values.find ("film_name");
+ dcp::NameFormat::Map::const_iterator i = _name_values.find ('f');
if (i == _name_values.end() || i->second.empty ()) {
return _("Email KDMs");
}
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 09f32dfda..59974c24c 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -620,8 +620,8 @@ string
video_asset_filename (shared_ptr<dcp::PictureAsset> asset)
{
dcp::NameFormat::Map values;
- values["type"] = "j2c";
- values["id"] = asset->id();
+ values['t'] = "j2c";
+ values['i'] = asset->id();
return Config::instance()->dcp_filename_format().get(values) + ".mxf";
}
@@ -629,8 +629,8 @@ string
audio_asset_filename (shared_ptr<dcp::SoundAsset> asset)
{
dcp::NameFormat::Map values;
- values["type"] = "pcm";
- values["id"] = asset->id();
+ values['t'] = "pcm";
+ values['i'] = asset->id();
return Config::instance()->dcp_filename_format().get(values) + ".mxf";
}