From 692e67b9dc1e8cd72546b3766e8f38956932ee58 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 23 Dec 2013 01:58:30 +0000 Subject: [PATCH] Add start/end time option to KDM email. --- ChangeLog | 2 ++ src/lib/config.cc | 2 +- src/lib/kdm.cc | 13 ++++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9295e4a57..6cd71b30f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2013-12-23 Carl Hetherington + * Add $START_TIME and $END_TIME as variables for the KDM email. + * Add top/bottom option for 3D frames. 2013-12-20 Carl Hetherington diff --git a/src/lib/config.cc b/src/lib/config.cc index 93eec9bc0..87cce9d7b 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -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); diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc index 4d8f29723..97e0536d1 100644 --- a/src/lib/kdm.cc +++ b/src/lib/kdm.cc @@ -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); } -- 2.30.2