Add debug option to log SMTP session transcripts.
[dcpomatic.git] / src / tools / dcpomatic.cc
index 5abf47182a89a46e44dc131256c4678b062cffcb..47237eee6de872fe607d98b653893f6cffc986fa 100644 (file)
 #include "lib/job_manager.h"
 #include "lib/exceptions.h"
 #include "lib/cinema.h"
-#include "lib/kdm.h"
+#include "lib/screen_kdm.h"
 #include "lib/send_kdm_email_job.h"
 #include "lib/server_finder.h"
 #include "lib/update_checker.h"
 #include "lib/cross.h"
 #include "lib/content_factory.h"
 #include "lib/compose.hpp"
+#include "lib/cinema_kdms.h"
 #include <dcp/exceptions.h>
 #include <wx/generic/aboutdlgg.h>
 #include <wx/stdpaths.h>
@@ -445,11 +446,23 @@ private:
                }
 
                try {
+                       list<ScreenKDM> screen_kdms = _film->make_kdms (d->screens(), d->cpl(), d->from(), d->until(), d->formulation());
                        if (d->write_to ()) {
-                               write_kdm_files (_film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation (), d->directory ());
+                               ScreenKDM::write_files (
+                                       _film->name(),
+                                       screen_kdms,
+                                       d->directory()
+                                       );
                        } else {
                                JobManager::instance()->add (
-                                       shared_ptr<Job> (new SendKDMEmailJob (_film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation ()))
+                                       shared_ptr<Job> (new SendKDMEmailJob (
+                                                                _film->name(),
+                                                                _film->dcp_name(),
+                                                                d->from(),
+                                                                d->until(),
+                                                                CinemaKDMs::collect (screen_kdms),
+                                                                _film->log()
+                                                                ))
                                        );
                        }
                } catch (dcp::NotEncryptedError& e) {
@@ -919,9 +932,22 @@ private:
                try {
                        throw;
                } catch (FileError& e) {
-                       error_dialog (0, wxString::Format (_("An exception occurred: %s (%s).\n\n" + REPORT_PROBLEM), e.what(), e.file().string().c_str ()));
+                       error_dialog (
+                               0,
+                               wxString::Format (
+                                       _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
+                                       std_to_wx (e.what()),
+                                       std_to_wx (e.file().string().c_str ())
+                                       )
+                               );
                } catch (exception& e) {
-                       error_dialog (0, wxString::Format (_("An exception occurred: %s.\n\n"), e.what ()) + "  " + REPORT_PROBLEM);
+                       error_dialog (
+                               0,
+                               wxString::Format (
+                                       _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM,
+                                       std_to_wx (e.what ())
+                                       )
+                               );
                } catch (...) {
                        error_dialog (0, _("An unknown exception occurred.") + "  " + REPORT_PROBLEM);
                }