Add start/end time option to KDM email.
authorCarl Hetherington <cth@carlh.net>
Mon, 23 Dec 2013 01:58:30 +0000 (01:58 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 23 Dec 2013 01:58:30 +0000 (01:58 +0000)
ChangeLog
src/lib/config.cc
src/lib/kdm.cc

index 9295e4a575c683c75f30e3dc97c5878f478e5b75..6cd71b30f4284710e9ee291e6ac8a192e86c3c38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2013-12-23  Carl Hetherington  <cth@carlh.net>
 
+       * Add $START_TIME and $END_TIME as variables for the KDM email.
+
        * Add top/bottom option for 3D frames.
 
 2013-12-20  Carl Hetherington  <cth@carlh.net>
index 93eec9bc0330fb4258f3f90d78de59759adc83b7..87cce9d7b4575e14e9eda7d50bc7bf886c9a63dd 100644 (file)
@@ -66,7 +66,7 @@ Config::Config ()
        , _default_j2k_bandwidth (200000000)
        , _default_audio_delay (0)
        , _kdm_email (
-               "Dear Projectionist\n\nPlease find attached KDMs for $CPL_NAME.\n\nBest regards,\nDCP-o-matic"
+               "Dear Projectionist\n\nPlease find attached KDMs for $CPL_NAME.\n\nThe KDMs are valid from $START_TIME until $END_TIME.\n\nBest regards,\nDCP-o-matic"
                )
 {
        _allowed_dcp_frame_rates.push_back (24);
index 4d8f29723d5f400bddb0b53455b607bf31d4e02d..97e0536d1d9a40ec7c6d06b769e7781a7a0726c0 100644 (file)
@@ -31,6 +31,7 @@
 
 using std::list;
 using std::string;
+using std::stringstream;
 using boost::shared_ptr;
 
 struct ScreenKDM
@@ -226,14 +227,20 @@ email_kdms (
                quickmail_add_to (mail, i->cinema->email.c_str ());
                
                string body = Config::instance()->kdm_email().c_str();
-               boost::algorithm::replace_all (body, "$DCP_NAME", film->dcp_name ());
-               
+               boost::algorithm::replace_all (body, "$CPL_NAME", film->dcp_name ());
+               stringstream start;
+               start << from.date() << " " << from.time_of_day();
+               boost::algorithm::replace_all (body, "$START_TIME", start.str ());
+               stringstream end;
+               end << to.date() << " " << to.time_of_day();
+               boost::algorithm::replace_all (body, "$END_TIME", end.str ());
+
                quickmail_set_body (mail, body.c_str());
                quickmail_add_attachment_file (mail, zip_file.string().c_str(), "application/zip");
                char const* error = quickmail_send (mail, Config::instance()->mail_server().c_str(), 25, "", "");
                if (error) {
                        quickmail_destroy (mail);
-                       throw StringError (String::compose ("Failed to send KDM email (%1)", error));
+                       throw KDMError (String::compose ("Failed to send KDM email (%1)", error));
                }
                quickmail_destroy (mail);
        }