2 Copyright (C) 2014-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 "compose.hpp"
25 #include "environment_info.h"
29 #include "send_problem_report_job.h"
32 #include <libxml++/libxml++.h>
38 using std::shared_ptr;
42 /** @param film Film that the problem is with, or 0.
43 * @param from Email address to use for From:
44 * @param summary Summary of the problem.
46 SendProblemReportJob::SendProblemReportJob (
47 shared_ptr<const Film> film,
59 SendProblemReportJob::~SendProblemReportJob ()
66 SendProblemReportJob::name () const
69 return _("Email problem report");
72 return String::compose (_("Email problem report for %1"), _film->name());
77 SendProblemReportJob::json_name () const
79 return N_("send_problem_report");
84 SendProblemReportJob::run ()
86 sub (_("Sending email"));
87 set_progress_unknown ();
89 string body = _summary + "\n\n";
91 body += "Version: " + string(dcpomatic_version) + " " + string(dcpomatic_git_commit) + "\n\n";
93 for (auto i: environment_info ()) {
100 body += "log head and tail:\n";
101 body += "---<8----\n";
102 body += _film->log()->head_and_tail (4096);
103 body += "---<8----\n\n";
105 add_file (body, "ffprobe.log");
107 body += "---<8----\n";
108 body += _film->metadata()->write_to_string_formatted("UTF-8");
109 body += "---<8----\n";
112 Email email(_from, {"carl@dcpomatic.com"}, variant::insert_dcpomatic("%1 problem report"), body);
113 email.send("main.carlh.net", 2525, EmailProtocol::STARTTLS);
116 set_state (FINISHED_OK);
121 SendProblemReportJob::add_file (string& body, boost::filesystem::path file) const
123 body += file.string() + ":\n";
124 body += "---<8----\n";
126 body += dcp::file_to_string (_film->file(file));
128 body += "[could not be read]\n";
130 body += "---<8----\n\n";