2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "send_problem_report_job.h"
21 #include "compose.hpp"
26 #include <quickmail.h>
32 using boost::shared_ptr;
34 SendProblemReportJob::SendProblemReportJob (
35 shared_ptr<const Film> film,
47 SendProblemReportJob::name () const
49 return String::compose (_("Email problem report for %1"), _film->name());
53 SendProblemReportJob::run ()
55 set_progress_unknown ();
57 quickmail mail = quickmail_create (_from.c_str(), "DCP-o-matic problem report");
59 quickmail_add_to (mail, "carl@dcpomatic.com");
61 string body = _summary;
63 body += "log head and tail:\n";
64 body += "---<8----\n";
65 body += _film->log()->head_and_tail ();
66 body += "---<8----\n\n";
68 FILE* ffprobe = fopen_boost (_film->file ("ffprobe.log"), "r");
70 body += "ffprobe.log:\n";
71 body += "---<8----\n";
72 uintmax_t const size = boost::filesystem::file_size (_film->file ("ffprobe.log"));
73 char* buffer = new char[size + 1];
74 int const N = fread (buffer, size, 1, ffprobe);
78 body += "---<8----\n\n";
82 quickmail_set_body (mail, body.c_str());
84 char const* error = quickmail_send (mail, "main.carlh.net", 2525, 0, 0);
87 set_state (FINISHED_ERROR);
88 set_error (error, "");
90 set_state (FINISHED_OK);
93 quickmail_destroy (mail);