2 Copyright (C) 2013-2021 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/>.
22 #include "send_kdm_email_job.h"
23 #include "compose.hpp"
24 #include "kdm_with_metadata.h"
33 using std::shared_ptr;
34 using boost::optional;
37 SendKDMEmailJob::SendKDMEmailJob (
38 list<KDMWithMetadataPtr> kdms,
39 dcp::NameFormat container_name_format,
40 dcp::NameFormat filename_format,
43 : Job (shared_ptr<Film>())
44 , _container_name_format (container_name_format)
45 , _filename_format (filename_format)
46 , _cpl_name (cpl_name)
49 list<KDMWithMetadataPtr> s;
56 /** @param kdms KDMs to email.
57 * @param container_name_format Format to ues for folders / ZIP files.
58 * @param filename_format Format to use for filenames.
59 * @param name_values Values to substitute into \p container_name_format and \p filename_format.
60 * @param cpl_name Name of the CPL that the KDMs are for.
62 SendKDMEmailJob::SendKDMEmailJob (
63 list<list<KDMWithMetadataPtr> > kdms,
64 dcp::NameFormat container_name_format,
65 dcp::NameFormat filename_format,
68 : Job (shared_ptr<Film>())
69 , _container_name_format (container_name_format)
70 , _filename_format (filename_format)
71 , _cpl_name (cpl_name)
78 SendKDMEmailJob::~SendKDMEmailJob ()
85 SendKDMEmailJob::name () const
87 auto f = _kdms.front().front()->get('f');
88 if (!f || f->empty()) {
89 return _("Email KDMs");
92 return String::compose (_("Email KDMs for %1"), *f);
97 SendKDMEmailJob::json_name () const
99 return N_("send_kdm_email");
104 SendKDMEmailJob::run ()
106 set_progress_unknown ();
107 send_emails (_kdms, _container_name_format, _filename_format, _cpl_name);
109 set_state (FINISHED_OK);