2 Copyright (C) 2013-2020 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"
23 #include "kdm_with_metadata.h"
31 using boost::shared_ptr;
32 using boost::optional;
34 /** @param kdms KDMs to email.
35 * @param container_name_format Format to ues for folders / ZIP files.
36 * @param filename_format Format to use for filenames.
37 * @param name_values Values to substitute into \p container_name_format and \p filename_format.
38 * @param cpl_name Name of the CPL that the KDMs are for.
40 SendKDMEmailJob::SendKDMEmailJob (
41 list<list<KDMWithMetadataPtr> > kdms,
42 dcp::NameFormat container_name_format,
43 dcp::NameFormat filename_format,
46 : Job (shared_ptr<Film>())
47 , _container_name_format (container_name_format)
48 , _filename_format (filename_format)
49 , _cpl_name (cpl_name)
55 SendKDMEmailJob::~SendKDMEmailJob ()
61 SendKDMEmailJob::name () const
63 optional<string> f = _kdms.front().front()->get('f');
64 if (!f || f->empty()) {
65 return _("Email KDMs");
68 return String::compose (_("Email KDMs for %2"), *f);
72 SendKDMEmailJob::json_name () const
74 return N_("send_kdm_email");
78 SendKDMEmailJob::run ()
80 set_progress_unknown ();
81 email (_kdms, _container_name_format, _filename_format, _cpl_name);
83 set_state (FINISHED_OK);