2 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "send_kdm_email_job.h"
22 #include "compose.hpp"
24 #include "cinema_kdms.h"
31 using boost::shared_ptr;
33 /** @param log Log to write to, or 0 */
34 SendKDMEmailJob::SendKDMEmailJob (
35 list<CinemaKDMs> cinema_kdms,
36 dcp::NameFormat name_format,
37 dcp::NameFormat::Map name_values,
41 : Job (shared_ptr<Film>())
42 , _name_format (name_format)
43 , _name_values (name_values)
44 , _cpl_name (cpl_name)
45 , _cinema_kdms (cinema_kdms)
52 SendKDMEmailJob::name () const
54 dcp::NameFormat::Map::const_iterator i = _name_values.find ('f');
55 if (i == _name_values.end() || i->second.empty ()) {
56 return _("Email KDMs");
59 return String::compose (_("Email KDMs for %1"), i->second);
63 SendKDMEmailJob::json_name () const
65 return N_("send_kdm_email");
69 SendKDMEmailJob::run ()
71 set_progress_unknown ();
72 CinemaKDMs::email (_cinema_kdms, _name_format, _name_values, _cpl_name, _log);
74 set_state (FINISHED_OK);